Integer port = CollectionUtil.random(CatalogUtil.getExecutionSitePorts(catalog_site));
assert(port != null);
client.createConnection(null, catalog_host.getIpaddr(), port, "user", "password");
LOG.info(String.format("Connected to H-Store cluster at %s:%d", catalog_host.getIpaddr(), port));
ClientResponse cresponse = VoltProcedureInvoker.invoke(args.catalog,
client,
procName,
parameters);
if (cresponse == null) System.exit(-1);
// m.put("Status", cresponse.getStatus());
// m.put("Length", String.format("%d [bytes=%d]", cresponse.getResults().length, cresponse.getResultsSize()));
// m.put("Results", StringUtil.join("\n", ));
Map<String, Object> m = new LinkedHashMap<String, Object>();
for (int i = 0; i < cresponse.getResults().length; i++) {
VoltTable vt = cresponse.getResults()[i];
m.put(String.format(" [%02d]", i), vt);
} // FOR
LOG.info(StringUtil.repeat("-", 50));
LOG.info(String.format("%s Txn #%d - Status %s\n%s",
procName,
cresponse.getTransactionId(),
cresponse.getStatus(),
cresponse.toString()));
}