Search in sources :

Example 6 with SyncCallback

use of org.voltdb.client.SyncCallback in project voltdb by VoltDB.

the class TestUpdateDeployment method testBadMaskPassword.

public void testBadMaskPassword() throws Exception {
    System.out.println("\n\n-----\n testBadMaskPassword \n-----\n\n");
    Client client = getClient();
    loadSomeData(client, 0, 10);
    client.drain();
    assertTrue(callbackSuccess);
    String deploymentURL = Configuration.getPathToCatalogForTest("catalogupdate-bad-masked-password.xml");
    // Try to change schema setting
    SyncCallback cb = new SyncCallback();
    client.updateApplicationCatalog(cb, null, new File(deploymentURL));
    cb.waitForResponse();
    assertEquals(ClientResponse.GRACEFUL_FAILURE, cb.getResponse().getStatus());
    assertTrue(cb.getResponse().getStatusString().contains("Unable to update deployment configuration"));
}
Also used : Client(org.voltdb.client.Client) SyncCallback(org.voltdb.client.SyncCallback) File(java.io.File)

Example 7 with SyncCallback

use of org.voltdb.client.SyncCallback in project voltdb by VoltDB.

the class TestUpdateDeployment method testUpdateBadExport.

public void testUpdateBadExport() throws Exception {
    System.out.println("\n\n-----\n testUpdateBadExport \n-----\n\n");
    System.setProperty(ExportDataProcessor.EXPORT_TO_TYPE, "org.voltdb.export.ExportTestClient");
    Map<String, String> additionalEnv = new HashMap<>();
    additionalEnv.put(ExportDataProcessor.EXPORT_TO_TYPE, "org.voltdb.export.ExportTestClient");
    LocalCluster config = new LocalCluster("catalogupdate-bad-export.jar", SITES_PER_HOST, HOSTS, K, BackendTarget.NATIVE_EE_JNI, LocalCluster.FailureState.ALL_RUNNING, true, false, additionalEnv);
    TPCCProjectBuilder project = new TPCCProjectBuilder();
    project.addDefaultSchema();
    project.addDefaultPartitioning();
    project.addProcedures(BASEPROCS);
    Properties props = buildProperties("type", "csv", "batched", "false", "with-schema", "true", "complain", "true", "outdir", "/tmp/" + System.getProperty("user.name"));
    project.addExport(true, /* enabled */
    "custom", props);
    // build the jarfile
    boolean compile = config.compile(project);
    assertTrue(compile);
    Client client = getClient();
    loadSomeData(client, 0, 10);
    client.drain();
    assertTrue(callbackSuccess);
    // Try to change the schem setting
    SyncCallback cb = new SyncCallback();
    client.updateApplicationCatalog(cb, null, new File(project.getPathToDeployment()));
    cb.waitForResponse();
    assertEquals(ClientResponse.GRACEFUL_FAILURE, cb.getResponse().getStatus());
    System.out.println(cb.getResponse().getStatusString());
    assertTrue(cb.getResponse().getStatusString().contains("Unable to update"));
}
Also used : HashMap(java.util.HashMap) Properties(java.util.Properties) Client(org.voltdb.client.Client) TPCCProjectBuilder(org.voltdb.benchmark.tpcc.TPCCProjectBuilder) SyncCallback(org.voltdb.client.SyncCallback) File(java.io.File)

Example 8 with SyncCallback

use of org.voltdb.client.SyncCallback in project voltdb by VoltDB.

the class TestOrderBySuite method load.

/** add 20 shuffled rows
     * @throws InterruptedException */
private void load(Client client) throws NoConnectionsException, ProcCallException, IOException, InterruptedException {
    client.callProcedure("Truncate01");
    int pkey = 0;
    a_int.clear();
    a_inline_str.clear();
    a_pool_str.clear();
    // if you want to test synchronous latency, this
    //  is a good variable to change
    boolean async = true;
    for (int i = 0; i < 20; i++) {
        a_int.add(i);
        a_inline_str.add("a_" + i);
        a_pool_str.add(bigString + i);
    }
    Collections.shuffle(a_int);
    Collections.shuffle(a_inline_str);
    Collections.shuffle(a_pool_str);
    for (int i = 0; i < 20; i++) {
        SyncCallback cb = new SyncCallback();
        client.callProcedure(cb, "InsertO1", pkey++, a_int.get(i), a_inline_str.get(i), a_pool_str.get(i));
        if (!async) {
            cb.waitForResponse();
            VoltTable vt = cb.getResponse().getResults()[0];
            assertTrue(vt.getRowCount() == 1);
        }
    }
    client.drain();
}
Also used : SyncCallback(org.voltdb.client.SyncCallback) VoltTable(org.voltdb.VoltTable)

Example 9 with SyncCallback

use of org.voltdb.client.SyncCallback in project voltdb by VoltDB.

the class TestCatalogUpdateSuite method testUpdateWithNoDeploymentFile.

public void testUpdateWithNoDeploymentFile() throws Exception {
    System.out.println("\n\n-----\n testUpdateWithNoDeploymentFile \n-----\n\n");
    Client client = getClient();
    String newCatalogURL;
    CatTestCallback callback;
    loadSomeData(client, 0, 25);
    assertCallbackSuccess(client);
    negativeTests(client);
    assertCallbackSuccess(client);
    // asynchronously call some random inserts
    loadSomeData(client, 25, 25);
    assertCallbackSuccess(client);
    // add a procedure "InsertOrderLineBatched"
    newCatalogURL = Configuration.getPathToCatalogForTest("catalogupdate-cluster-expanded.jar");
    callback = new CatTestCallback(ClientResponse.SUCCESS);
    client.updateApplicationCatalog(callback, new File(newCatalogURL), null);
    // don't care if this succeeds or fails.
    // calling the new proc before the cat change returns is not guaranteed to work
    // we just hope it doesn't crash anything
    int x = 3;
    SyncCallback cb = new SyncCallback();
    client.callProcedure(cb, org.voltdb.benchmark.tpcc.procedures.InsertOrderLineBatched.class.getSimpleName(), new long[] { x }, new long[] { x }, x, new long[] { x }, new long[] { x }, new long[] { x }, new TimestampType[] { new TimestampType() }, new long[] { x }, new double[] { x }, new String[] { "a" });
    cb.waitForResponse();
    // make sure the previous catalog change has completed
    assertCallbackSuccess(client);
    // now calling the new proc better work
    x = 2;
    client.callProcedure(org.voltdb.benchmark.tpcc.procedures.InsertOrderLineBatched.class.getSimpleName(), new long[] { x }, new long[] { x }, (short) x, new long[] { x }, new long[] { x }, new long[] { x }, new TimestampType[] { new TimestampType() }, new long[] { x }, new double[] { x }, new String[] { "a" });
    loadSomeData(client, 50, 5);
    assertCallbackSuccess(client);
}
Also used : TimestampType(org.voltdb.types.TimestampType) Client(org.voltdb.client.Client) File(java.io.File) SyncCallback(org.voltdb.client.SyncCallback)

Example 10 with SyncCallback

use of org.voltdb.client.SyncCallback in project voltdb by VoltDB.

the class TestNTProcs method testOverlappingNT.

//
// This should stress the callbacks, handles and futures for NT procs
//
public void testOverlappingNT() throws Exception {
    ServerThread localServer = start();
    Client client = ClientFactory.createClient();
    client.createConnection("localhost");
    final int CALL_COUNT = 400;
    ClientResponseImpl response;
    SyncCallback[] cb = new SyncCallback[CALL_COUNT];
    for (int i = 0; i < CALL_COUNT; i++) {
        cb[i] = new SyncCallback();
        boolean success = client.callProcedure(cb[i], "TestNTProcs$NTProcWithFutures");
        assert (success);
    }
    response = (ClientResponseImpl) client.callProcedure("TestNTProcs$NTProcWithFutures");
    System.out.println("1: " + response.toJSONString());
    for (int i = 0; i < CALL_COUNT; i++) {
        cb[i].waitForResponse();
        response = (ClientResponseImpl) cb[i].getResponse();
        System.out.println("2: " + response.toJSONString());
    }
    Thread.sleep(3000);
    // CHECK STATS
    VoltTable statsT = getStats(client, "PROCEDURE");
    System.out.println("STATS: " + statsT.toFormattedString());
    assertTrue(VoltTableUtil.tableContainsString(statsT, "NTProcWithFutures", true));
    System.out.println(statsT.toFormattedString());
    // repeatedly call stats until they match
    long start = System.currentTimeMillis();
    boolean found = false;
    while ((System.currentTimeMillis() - start) < 30000) {
        Map<String, Long> stats = aggregateProcRow(client, NTProcWithFutures.class.getName());
        if ((CALL_COUNT + 1) == stats.get("INVOCATIONS").longValue()) {
            found = true;
            break;
        }
        Thread.sleep(1000);
    }
    localServer.shutdown();
    localServer.join();
    if (!found) {
        fail();
    }
}
Also used : SyncCallback(org.voltdb.client.SyncCallback) AtomicLong(java.util.concurrent.atomic.AtomicLong) Client(org.voltdb.client.Client)

Aggregations

SyncCallback (org.voltdb.client.SyncCallback)15 Client (org.voltdb.client.Client)9 File (java.io.File)8 VoltTable (org.voltdb.VoltTable)6 ClientResponse (org.voltdb.client.ClientResponse)2 TimestampType (org.voltdb.types.TimestampType)2 HashMap (java.util.HashMap)1 Properties (java.util.Properties)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 ZooKeeper (org.apache.zookeeper_voltpatches.ZooKeeper)1 TPCCProjectBuilder (org.voltdb.benchmark.tpcc.TPCCProjectBuilder)1 InsertNewOrder (org.voltdb.benchmark.tpcc.procedures.InsertNewOrder)1 ProcCallException (org.voltdb.client.ProcCallException)1 DrRoleType (org.voltdb.compiler.deploymentfile.DrRoleType)1