// Fire off a single-partition txn
// It should always come back with zero restarts
String procName = neworder.class.getSimpleName();
Object params[] = RegressionSuiteUtil.generateNewOrder(catalogContext.numberOfPartitions, false, (short)1);
ClientResponse cresponse = client.callProcedure(procName, params);
assertEquals(cresponse.toString(), Status.OK, cresponse.getStatus());
assertTrue(cresponse.toString(), cresponse.isSinglePartition());
assertEquals(cresponse.toString(), 0, cresponse.getRestartCounter());
// Sleep a little bit to give them for the txn to get cleaned up
ThreadUtil.sleep(2500);
// Then execute the same thing again multiple times.
// It should use the cache estimate from the first txn
// We are going to execute them asynchronously to check whether we
// can share the cache properly
final int num_invocations = 10;
final CountDownLatch latch = new CountDownLatch(num_invocations);
final List<ClientResponse> cresponses = new ArrayList<ClientResponse>();
ProcedureCallback callback = new ProcedureCallback() {
@Override
public void clientCallback(ClientResponse clientResponse) {
cresponses.add(clientResponse);
latch.countDown();
}
};
for (int i = 0; i < num_invocations; i++) {
client.callProcedure(callback, procName, params);
} // FOR
// Now wait for the responses
boolean result = latch.await(5, TimeUnit.SECONDS);
assertTrue(result);
for (ClientResponse cr : cresponses) {
assertEquals(cr.toString(), Status.OK, cr.getStatus());
assertTrue(cr.toString(), cr.isSinglePartition());
assertEquals(cr.toString(), 0, cr.getRestartCounter());
} // FOR
// So we need to grab the MarkovEstimatorProfiler stats and check
// that the cache counter is greater than one
cresponse = RegressionSuiteUtil.getStats(client, SysProcSelector.MARKOVPROFILER);
VoltTable results[] = cresponse.getResults();
long cached_cnt = 0;
boolean found = false;
String targetCol = "CACHED_ESTIMATE_CNT";
while (results[0].advanceRow()) {
for (int i = 0; i < results[0].getColumnCount(); i++) {