示例#1
0
  public void testCatalogUpdateAfterRejoin() throws Exception {
    System.out.println("testCatalogUpdateAfterRejoin");
    VoltProjectBuilder builder = getBuilderForTest();

    LocalCluster cluster = new LocalCluster("rejoin.jar", 2, 2, 1, BackendTarget.NATIVE_EE_JNI);
    boolean success = cluster.compile(builder);
    assertTrue(success);
    MiscUtils.copyFile(
        builder.getPathToDeployment(), Configuration.getPathToCatalogForTest("rejoin.xml"));

    try {
      cluster.startUp();

      for (int ii = 0; ii < 3; ii++) {
        cluster.shutDownSingleHost(1);
        Thread.sleep(1000);
        cluster.recoverOne(1, 0, "localhost");

        File newCatalog = new File(Configuration.getPathToCatalogForTest("rejoin.jar"));
        File deployment = new File(Configuration.getPathToCatalogForTest("rejoin.xml"));

        Client client = ClientFactory.createClient();
        client.createConnection("localhost");

        VoltTable[] results = client.updateApplicationCatalog(newCatalog, deployment).getResults();
        assertTrue(results.length == 1);
        client.close();
      }
    } finally {
      cluster.shutDown();
    }
  }
示例#2
0
  public void testRejoinInlineStringBug() throws Exception {
    VoltProjectBuilder builder = getBuilderForTest();

    LocalCluster cluster =
        new LocalCluster("rejoin.jar", 1, 2, 1, BackendTarget.NATIVE_EE_JNI, true);
    boolean success = cluster.compile(builder);
    assertTrue(success);
    MiscUtils.copyFile(
        builder.getPathToDeployment(), Configuration.getPathToCatalogForTest("rejoin.xml"));
    cluster.setHasLocalServer(false);

    cluster.startUp();
    Client client;

    client = ClientFactory.createClient(m_cconfig);
    client.createConnection("localhost");

    ProcedureCallback callback =
        new ProcedureCallback() {

          @Override
          public void clientCallback(ClientResponse clientResponse) throws Exception {
            if (clientResponse.getStatus() != ClientResponse.SUCCESS) {
              System.out.println(clientResponse.getStatusString());
            }
          }
        };

    StringBuffer shortBuffer = new StringBuffer();
    for (int ii = 0; ii < 33; ii++) {
      shortBuffer.append('a');
    }
    String shortString = shortBuffer.toString();

    StringBuffer longBuffer = new StringBuffer();
    for (int ii = 0; ii < 17700; ii++) {
      longBuffer.append('a');
    }
    String longString = longBuffer.toString();

    for (int ii = 0; ii < 119; ii++) {
      client.callProcedure(callback, "InsertInlinedString", ii, shortString, longString);
    }

    shortBuffer.append("aaa");
    client.callProcedure(callback, "InsertInlinedString", 120, shortBuffer.toString(), longString);

    client.drain();
    client.close();

    cluster.shutDownSingleHost(0);
    cluster.recoverOne(0, 1, "localhost");

    cluster.shutDown();
  }