public InitiateResponseMessage processInitiateTask(
TransactionState txnState,
final VoltMessage task)
{
final InitiateTaskMessage itask = (InitiateTaskMessage)task;
final ProcedureRunner runner = m_loadedProcedures.procs.get(itask.getStoredProcedureName());
final InitiateResponseMessage response = new InitiateResponseMessage(itask);
// feasible to receive a transaction initiated with an earlier catalog.
if (runner == null) {
response.setResults(
new ClientResponseImpl(ClientResponse.GRACEFUL_FAILURE,
new VoltTable[] {},
"Procedure does not exist: " + itask.getStoredProcedureName()));
}
else {
try {
Object[] callerParams = null;
/*
* Parameters are lazily deserialized. We may not find out until now
* that the parameter set is corrupt
*/
try {
callerParams = itask.getParameters();
} catch (RuntimeException e) {
Writer result = new StringWriter();
PrintWriter pw = new PrintWriter(result);
e.printStackTrace(pw);
response.setResults(
new ClientResponseImpl(ClientResponse.GRACEFUL_FAILURE,
new VoltTable[] {},
"Exception while deserializing procedure params procedure="
+ itask.getStoredProcedureName() + "\n"
+ result.toString()));
}
if (callerParams != null) {
ClientResponseImpl cr = null;
// call the proc
runner.setupTransaction(txnState);
cr = runner.call(itask.getParameters());
txnState.setHash(cr.getHash());
response.setResults(cr);
// record the results of write transactions to the transaction state
// this may be used to verify the DR replica cluster gets the same value
// skip for multi-partition txns because only 1 of k+1 partitions will
// have the real results
if ((!itask.isReadOnly()) && itask.isSinglePartition()) {
txnState.storeResults(cr);
}
}
}
catch (final ExpectedProcedureException e) {