deleteTestFiles();
setUpSnapshotDir();
VoltTable results[] = null;
Client client = this.getClient();
CatalogContext cc = this.getCatalogContext();
// Load database
try {
initializeTPCCDatabase(cc, client, false);
} catch (Exception e) {
e.printStackTrace();
}
// Take Snapshot
results = null;
results = saveTables(client);
validateSnapshot(true);
final String MOCK_ARGS[] = { "HOST=localhost", "NUMCLIENTS=1",
// XXX HACK to find catalog jar
"CATALOG=" + "./obj/release/testobjects/" + projectJAR, "" };
MOCK_ARGS[MOCK_ARGS.length - 1] = HStoreConstants.BENCHMARK_PARAM_PREFIX;
TPCCClient tpccClient = new TPCCClient(MOCK_ARGS);
// Run transactions
long k_itr = 0;
long numTransactions = NUM_TRANSACTIONS;
long period = numTransactions / 10;
for (k_itr = 0; k_itr < numTransactions; k_itr++) {
boolean response = tpccClient.runOnce();
assertEquals(response, true);
if (k_itr % period == 0)
System.out.println(String.format("Transactions Processed: %6d / %d", k_itr, numTransactions));
}
// Statistics
results = client.callProcedure("@Statistics", "table", 0).getResults();
System.out.println(results[0]);
VoltTable[] results_tmp = null;
results_tmp = client.callProcedure("@Statistics", "table", 0).getResults();
System.out.println("@Statistics before restart :");
System.out.println(results_tmp[0]);
// Kill and restart all the execution sites.
m_config.shutDown();
m_config.startUp();
client = getClient();
Calendar calendar;
long t1,t2;
calendar = Calendar.getInstance();
t1 = calendar.getTimeInMillis();
// LOGICAL : SNAPSHOT + CMD LOG
try {
results = client.callProcedure("@SnapshotRestore", TMPDIR, TESTNONCE, ALLOWEXPORT).getResults();
System.out.println(results[0]);
while (results[0].advanceRow()) {
if (results[0].getString("RESULT").equals("FAILURE")) {
fail(results[0].getString("ERR_MSG"));
}
}
} catch (Exception ex) {
ex.printStackTrace();
fail("SnapshotRestore exception: " + ex.getMessage());
}
validateSnapshot(true);
System.out.println("@Statistics after LOGICAL snapshot restore:");
results = client.callProcedure("@Statistics", "table", 0).getResults();
System.out.println(results[0]);
//File logDir = new File("/mnt/pmfs" + File.separator + "cmdlog");
File logDir = new File("./obj" + File.separator + "cmdlog");