示例#1
0
  private static void buildCatalog() throws IOException {
    // build a real catalog
    File cat = File.createTempFile("temp-log-reinitiator", "catalog");
    cat.deleteOnExit();

    VoltProjectBuilder builder = new VoltProjectBuilder();
    String schema = "create table A (i integer not null, primary key (i));";
    builder.addLiteralSchema(schema);
    builder.addPartitionInfo("A", "i");
    builder.addStmtProcedure("hello", "select * from A where i = ?", "A.i: 0");

    if (!builder.compile(cat.getAbsolutePath())) {
      throw new IOException();
    }

    byte[] bytes = CatalogUtil.toBytes(cat);
    String serializedCat = CatalogUtil.loadCatalogFromJar(bytes, null);
    assertNotNull(serializedCat);
    Catalog catalog = new Catalog();
    catalog.execute(serializedCat);

    String deploymentPath = builder.getPathToDeployment();
    CatalogUtil.compileDeploymentAndGetCRC(catalog, deploymentPath, true);

    m_context = new CatalogContext(0, 0, catalog, bytes, 0, 0, 0);
    TheHashinator.initialize(LegacyHashinator.class, LegacyHashinator.getConfigureBytes(3));
  }
示例#2
0
文件: Inits.java 项目: tnn/voltdb
    @Override
    public void run() {
      // Initialize the complex partitioning scheme
      int partitionCount;
      if (m_config.m_startAction == StartAction.JOIN) {
        // Initialize the hashinator with the existing partition count in the cluster,
        // don't include the partitions that we're adding because they shouldn't contain
        // any ranges yet.
        partitionCount = m_rvdb.m_cartographer.getPartitionCount();
      } else {
        partitionCount = m_rvdb.m_configuredNumberOfPartitions;
      }

      TheHashinator.initialize(
          TheHashinator.getConfiguredHashinatorClass(),
          TheHashinator.getConfigureBytes(partitionCount));
    }