Package com.splout.db.qnode.beans

Examples of com.splout.db.qnode.beans.DeployInfo


   * {@link QNodeHandler}. Returns a {@link QueryStatus} with the status of the request.
   *
   * @throws InterruptedException
   */
  public DeployInfo deploy(List<DeployRequest> deployRequests) throws InterruptedException {
    DeployInfo deployInfo = new DeployInfo();

    // A new unique version number is generated.
    long version = context.getCoordinationStructures().uniqueVersionId();
    deployInfo.setVersion(version);

    List<String> tablespaces = new ArrayList<String>();
    List<String> dataURIs = new ArrayList<String>();

    for(DeployRequest request : deployRequests) {
      tablespaces.add(request.getTablespace());
      dataURIs.add(request.getData_uri());
    }

    deployInfo.setTablespacesDeployed(tablespaces);
    deployInfo.setDataURIs(dataURIs);

    Date startTime = new Date();
    deployInfo.setStartedAt(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(startTime));

    context.getCoordinationStructures().logDeployMessage(version,
        "Deploy [" + version + "] for tablespaces " + tablespaces + " started.");
    context.getCoordinationStructures().getDeploymentsStatusPanel().put(version, DeployStatus.ONGOING);

    // Generate the list of actions per DNode
    Map<String, List<DeployAction>> actionsPerDNode = generateDeployActionsPerDNode(deployRequests,
        version);

    // Starting the countdown latch.
    ICountDownLatch countDownLatchForDeploy = context.getCoordinationStructures()
        .getCountDownLatchForDeploy(version);
    Set<String> dnodesInvolved = actionsPerDNode.keySet();
    countDownLatchForDeploy.trySetCount(dnodesInvolved.size());

    // Sending deploy signals to each DNode
    for(Map.Entry<String, List<DeployAction>> actionPerDNode : actionsPerDNode.entrySet()) {
      DNodeService.Client client = null;
      boolean renew = false;
      try {
        try {
          client = context.getDNodeClientFromPool(actionPerDNode.getKey());
        } catch(TTransportException e) {
          renew = true;
          throw e;
        }
        client.deploy(actionPerDNode.getValue(), version);
      } catch(Exception e) {
        String errorMsg = "Error sending deploy actions to DNode [" + actionPerDNode.getKey() + "]";
        log.error(errorMsg, e);
        abortDeploy(new ArrayList<String>(actionsPerDNode.keySet()), errorMsg, version);
        deployInfo.setError("Error connecting to DNode " + actionPerDNode.getKey());
        context.getCoordinationStructures().getDeployInfoPanel().put(version, deployInfo);
        return deployInfo;
      } finally {
        context.returnDNodeClientToPool(actionPerDNode.getKey(), client, renew);
      }
View Full Code Here


          throws Exception {
        return new ArrayList<QueryStatus>();
      }
      @Override
      public DeployInfo deploy(List<DeployRequest> deployRequest) throws Exception {
        return new DeployInfo();
      }
      @Override
      public StatusMessage rollback(List<SwitchVersionRequest> rollbackRequest) throws Exception {
        return new StatusMessage();
      }
View Full Code Here

      tIndex++;
    }

    // Finally we send the deploy request
    DeployInfo dInfo = client.deploy(deployRequests);

    log.info("Deploy request of [" + deployments.size() + "] tablespaces performed. Deploy on [" + qnode + "] with version [" + dInfo.getVersion() + "] in progress.");
  }
View Full Code Here

      assertEquals("t1 k1 SELECT * FROM foo;", queryStatus.getError());

      List<String> dnodes = client.dNodeList();
      assertEquals("ok", dnodes.get(0));

      DeployInfo info = client.deploy("t1", PartitionMap.oneShardOpenedMap(), ReplicationMap.oneToOneMap("http://localhost:4444"), new URI("file:///foo"));
      assertEquals("ok", info.getError());
     
    } finally {
      qnode.close();
    }
  }
View Full Code Here

TOP

Related Classes of com.splout.db.qnode.beans.DeployInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.