nTruncates++;
}
shouldRollback = 0;
}
catch (ProcCallException e) {
ClientResponseImpl cri = (ClientResponseImpl) e.getClientResponse();
if (shouldRollback == 0) {
// this implies bad data and is fatal
if ((cri.getStatus() == ClientResponse.GRACEFUL_FAILURE) ||
(cri.getStatus() == ClientResponse.USER_ABORT)) {
// on exception, log and end the thread, but don't kill the process
log.error("TruncateTableLoader failed a TruncateTable ProcCallException call for table " + tableName, e);
Benchmark.printJStack();
System.exit(-1);
}
}
}
catch (InterruptedIOException e) {
// just need to fall through and get out
}
catch (Exception e) {
// on exception, log and end the thread, but don't kill the process
log.error("TruncateTableLoader failed a non-proc call exception for table " + tableName, e);
try { Thread.sleep(3000); } catch (Exception e2) {}
}
// scan-agg table
try {
currentRowCount = getRowCount();
log.debug("TruncateTableLoader scan agg table..." + tableName + " current row count is " + currentRowCount);
shouldRollback = (byte) (r.nextInt(10) == 0 ? 1 : 0);
long p = Math.abs(r.nextLong());
String sp = this.scanAggProcedure;
if (tableName == "trup")
sp += r.nextInt(100) < mpRatio * 100. ? "MP" : "SP";
ClientResponse clientResponse = client.callProcedure(tableName.toUpperCase() + sp, p, shouldRollback);
byte status = clientResponse.getStatus();
if (status == ClientResponse.GRACEFUL_FAILURE ||
(shouldRollback == 0 && status == ClientResponse.USER_ABORT)) {
log.error("TruncateTableLoader gracefully failed to scan-agg table " + tableName + " and this shoudn't happen. Exiting.");
log.error(((ClientResponseImpl) clientResponse).toJSONString());
Benchmark.printJStack();
// stop the world
System.exit(-1);
}
if (status != ClientResponse.SUCCESS) {
// log what happened
log.error("TruncateTableLoader ungracefully failed to scan-agg table " + tableName);
log.error(((ClientResponseImpl) clientResponse).toJSONString());
}
shouldRollback = 0;
}
catch (ProcCallException e) {
ClientResponseImpl cri = (ClientResponseImpl) e.getClientResponse();
if (shouldRollback == 0) {
// this implies bad data and is fatal
if ((cri.getStatus() == ClientResponse.GRACEFUL_FAILURE) ||
(cri.getStatus() == ClientResponse.USER_ABORT)) {
// on exception, log and end the thread, but don't kill the process
log.error("TruncateTableLoader failed a ScanAgg ProcCallException call for table " + tableName, e);
Benchmark.printJStack();
System.exit(-1);
}