public void blockUntilNoOutstandingTransactions() {
}
public void testUpdate() throws Exception {
Client client = getClient();
String newCatalogURL;
VoltTable[] results;
CatTestCallback callback;
loadSomeData(client, 0, 25);
client.drain();
testStuffThatShouldObviouslyFail(client);
// asynchronously call some random inserts
loadSomeData(client, 25, 25);
// add a procedure "InsertOrderLineBatched"
newCatalogURL = VoltServerConfig.getPathToCatalogForTest("catalogupdate-cluster-expanded.jar");
callback = new CatTestCallback(Status.OK);
client.callProcedure(callback, "@UpdateApplicationCatalog", newCatalogURL);
client.drain();
// 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
client.drain();
// 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}, 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);
// this is a do nothing change... shouldn't affect anything
newCatalogURL = VoltServerConfig.getPathToCatalogForTest("catalogupdate-cluster-expanded.jar");
results = client.callProcedure("@UpdateApplicationCatalog", newCatalogURL).getResults();
assertTrue(results.length == 1);
client.drain();
// now calling the new proc better work
x = 4;
client.callProcedure(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"});
loadSomeData(client, 55, 5);
// remove the procedure we just added async
newCatalogURL = VoltServerConfig.getPathToCatalogForTest("catalogupdate-cluster-base.jar");
callback = new CatTestCallback(Status.OK);
client.callProcedure(callback, "@UpdateApplicationCatalog", newCatalogURL);
// don't care if this works now
x = 4;
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
client.drain();
// now calling the new proc better fail
x = 5;
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();
assertNotSame(cb.getResponse().getStatus(), Status.OK);
loadSomeData(client, 60, 5);
// change the insert new order procedure
newCatalogURL = VoltServerConfig.getPathToCatalogForTest("catalogupdate-cluster-conflict.jar");
results = client.callProcedure("@UpdateApplicationCatalog", newCatalogURL).getResults();
assertTrue(results.length == 1);
// call the new proc and make sure the one we want gets run
results = client.callProcedure(InsertNewOrder.class.getSimpleName(), 100, 100, 100, 100, 100, 100, 1.0, "a").getResults();
assertEquals(1, results.length);
assertEquals(1776, results[0].asScalarLong());
// load a big catalog change just to make sure nothing fails horribly
newCatalogURL = VoltServerConfig.getPathToCatalogForTest("catalogupdate-cluster-many.jar");
results = client.callProcedure("@UpdateApplicationCatalog", newCatalogURL).getResults();
assertTrue(results.length == 1);
loadSomeData(client, 65, 5);
client.drain();
assertTrue(true);
}