Package org.voltdb.compiler

Examples of org.voltdb.compiler.ClusterConfig$Node


  }


  @Override
  public void process(NodeContainer nodeContainer) {
    Node node = nodeContainer.getEntity();

    if (nodesSeen) {
      left = Math.min(left, node.getLongitude());
      right = Math.max(right, node.getLongitude());

      bottom = Math.min(bottom, node.getLatitude());
      top = Math.max(top, node.getLatitude());
    } else {
      left = node.getLongitude();
      right = node.getLongitude();
      top = node.getLatitude();
      bottom = node.getLatitude();
      nodesSeen = true;
    }

    objects.add(nodeContainer);
  }
View Full Code Here


    DatasetContext dsCtx = dataset.createReader();
   
    try {
      EntityManager<Node> nodeManager = dsCtx.getNodeManager();
      OsmUser user;
      Node node;
     
      // Create the user for edits to be performed under. This is an existing user with an
      // updated name.
      user = new OsmUser(10, "user10b");
     
      // Modify node 1 to add a new tag.
      node = nodeManager.getEntity(1).getWriteableInstance();
      node.setUser(user);
      node.getTags().add(new Tag("change", "new tag"));
      nodeManager.modifyEntity(node);
     
      // Delete node 6.
      nodeManager.removeEntity(6);
     
      // Add node 7 using the NONE user.
      node = new Node(new CommonEntityData(7, 16, buildDate("2008-01-02 18:19:20"), OsmUser.NONE, 93), -11, -12);
      node.getTags().addAll(
          Arrays.asList(new Tag[]{new Tag("created_by", "Me7"), new Tag("change", "new node")}));
      nodeManager.addEntity(node);
     
      dsCtx.complete();
     
View Full Code Here

  @Test
  public void badSortOrderVersion() throws Exception {
    ChangeSimplifier simplifier = new ChangeSimplifier();
    simplifier.setChangeSink(new NullChangeWriter());
    simplifier.initialize(new HashMap<String, Object>());
    Node node;

    node = new Node(new CommonEntityData(1, 2, new Date(), OsmUser.NONE, 2), 1, 1);
    simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify));

    try {
      node = new Node(new CommonEntityData(1, 1, new Date(), OsmUser.NONE, 1), 1, 1);
      simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify));
    } catch (OsmosisRuntimeException e) {
      if (e.getMessage().startsWith("Pipeline entities are not sorted")) {
        return;
      }
View Full Code Here

            }
          }
          continue;
        }

        Node node = (Node)inode;
        if(node.getIndex() != index) continue;
        Attribute [] attrs = inode.getAttributes();
        if(attrs == null || attrs.length < 1) {
          list.add(item);
        } else {
          String data = (String)item.getData();
View Full Code Here

        File projectFile = VoltProjectBuilder.writeStringToTempFile(simpleProject);
        String projectPath = projectFile.getPath();

        VoltCompiler compiler = new VoltCompiler();
        ClusterConfig cluster_config = new ClusterConfig(1, 1, 0, "localhost");
        assertTrue(compiler.compile(projectPath, cluster_config,
                                    "testout.jar", System.out, null));

        // Now read the jar file back in and make sure that we can grab the
        // class file from it using JarClassLoader
View Full Code Here

        m_hm = mock(HostMessenger.class);
        m_zk = getClient(0);
        when(m_hm.getZK()).thenReturn(m_zk);
        VoltZK.createPersistentZKNodes(m_zk);

        m_config = new ClusterConfig(hostCount, sitesPerHost, replicationFactor);
        TheHashinator.initialize(TheHashinator.getConfiguredHashinatorClass(), TheHashinator.getConfigureBytes(m_config.getPartitionCount()));
        m_hostIds = new ArrayList<Integer>();
        for (int i = 0; i < hostCount; i++) {
            m_hostIds.add(i);
        }
View Full Code Here

             */
            JSONObject topo = getTopology(config.m_startAction, m_joinCoordinator);
            m_partitionsToSitesAtStartupForExportInit = new ArrayList<Integer>();
            try {
                // IV2 mailbox stuff
                ClusterConfig clusterConfig = new ClusterConfig(topo);
                m_configuredReplicationFactor = clusterConfig.getReplicationFactor();
                m_cartographer = new Cartographer(m_messenger, m_configuredReplicationFactor,
                        m_catalogContext.cluster.getNetworkpartition());
                List<Integer> partitions = null;
                if (isRejoin) {
                    m_configuredNumberOfPartitions = m_cartographer.getPartitionCount();
                    partitions = m_cartographer.getIv2PartitionsToReplace(m_configuredReplicationFactor,
                                                                          clusterConfig.getSitesPerHost());
                    if (partitions.size() == 0) {
                        VoltDB.crashLocalVoltDB("The VoltDB cluster already has enough nodes to satisfy " +
                                "the requested k-safety factor of " +
                                m_configuredReplicationFactor + ".\n" +
                                "No more nodes can join.", false, null);
                    }
                }
                else {
                    m_configuredNumberOfPartitions = clusterConfig.getPartitionCount();
                    partitions = ClusterConfig.partitionsForHost(topo, m_messenger.getHostId());
                }
                for (int ii = 0; ii < partitions.size(); ii++) {
                    Integer partition = partitions.get(ii);
                    m_iv2InitiatorStartingTxnIds.put( partition, TxnEgo.makeZero(partition).getTxnId());
View Full Code Here

        }
        else if (!startAction.doesRejoin()) {
            int sitesperhost = m_deployment.getCluster().getSitesperhost();
            int hostcount = m_deployment.getCluster().getHostcount();
            int kfactor = m_deployment.getCluster().getKfactor();
            ClusterConfig clusterConfig = new ClusterConfig(hostcount, sitesperhost, kfactor);
            if (!clusterConfig.validate()) {
                VoltDB.crashLocalVoltDB(clusterConfig.getErrorMsg(), false, null);
            }
            topo = registerClusterConfig(clusterConfig);
        }
        else {
            Stat stat = new Stat();
View Full Code Here

        ClusterType cluster = deployment.getCluster();
        int hostCount = cluster.getHostcount();
        int sitesPerHost = cluster.getSitesperhost();
        int kFactor = cluster.getKfactor();

        ClusterConfig config = new ClusterConfig(hostCount, sitesPerHost, kFactor);

        if (!config.validate()) {
            hostLog.error(config.getErrorMsg());
        } else {
            Cluster catCluster = catalog.getClusters().get("cluster");
            // copy the deployment info that is currently not recorded anywhere else
            Deployment catDeploy = catCluster.getDeployment().get("deployment");
            catDeploy.setHostcount(hostCount);
View Full Code Here

     * @throws JSONException
     */
    public static List<Integer> getPartitionsToAdd(ZooKeeper zk, JSONObject topo)
            throws JSONException
    {
        ClusterConfig  clusterConfig = new ClusterConfig(topo);
        List<Integer> newPartitions = new ArrayList<Integer>();
        Set<Integer> existingParts = new HashSet<Integer>(getPartitions(zk));
        // Remove MPI
        existingParts.remove(MpInitiator.MP_INIT_PID);
        int partsToAdd = clusterConfig.getPartitionCount() - existingParts.size();

        if (partsToAdd > 0) {
            hostLog.info("Computing new partitions to add. Total partitions: " + clusterConfig.getPartitionCount());
            for (int i = 0; newPartitions.size() != partsToAdd; i++) {
                if (!existingParts.contains(i)) {
                    newPartitions.add(i);
                }
            }
View Full Code Here

TOP

Related Classes of org.voltdb.compiler.ClusterConfig$Node

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.