use of org.voltdb.StoredProcedureInvocation in project voltdb by VoltDB.
the class ReplaySequencer method dedupe.
/**
* Dedupe initiate task messages. Check if the initiate task message is seen before.
*
* @param inUniqueId The uniqueId of the message
* @param in The initiate task message
* @return A client response to return if it's a duplicate, otherwise null.
*/
public InitiateResponseMessage dedupe(long inUniqueId, TransactionInfoBaseMessage in) {
if (in instanceof Iv2InitiateTaskMessage) {
final Iv2InitiateTaskMessage init = (Iv2InitiateTaskMessage) in;
final StoredProcedureInvocation invocation = init.getStoredProcedureInvocation();
final String procName = invocation.getProcName();
/*
* Ning - @LoadSinglepartTable and @LoadMultipartTable always have the same txnId
* which is the txnId of the snapshot.
*/
if (!(procName.equalsIgnoreCase("@LoadSinglepartitionTable") || procName.equalsIgnoreCase("@LoadMultipartitionTable")) && inUniqueId <= m_lastSeenUniqueId) {
// already sequenced
final InitiateResponseMessage resp = new InitiateResponseMessage(init);
resp.setResults(new ClientResponseImpl(ClientResponseImpl.UNEXPECTED_FAILURE, new VoltTable[0], ClientResponseImpl.IGNORED_TRANSACTION));
return resp;
}
}
return null;
}
use of org.voltdb.StoredProcedureInvocation in project voltdb by VoltDB.
the class RandomMsgGenerator method makeIv2InitiateTaskMsg.
private Iv2InitiateTaskMessage makeIv2InitiateTaskMsg(boolean readOnly, boolean binaryLog, boolean isMp) {
StoredProcedureInvocation spi = mock(StoredProcedureInvocation.class);
ParameterSet ps = mock(ParameterSet.class);
when(spi.getParams()).thenReturn(ps);
if (binaryLog) {
when(ps.toArray()).thenReturn(new Object[] { null, 0l, 0l, Long.MIN_VALUE, Long.MIN_VALUE, null });
if (!isMp) {
when(spi.getProcName()).thenReturn("@ApplyBinaryLogSP");
} else {
when(spi.getProcName()).thenReturn("@ApplyBinaryLogMP");
}
} else {
when(ps.toArray()).thenReturn(new Object[] { null, 0l, 0l, Long.MIN_VALUE, null });
when(spi.getProcName()).thenReturn("dummy");
}
Iv2InitiateTaskMessage msg = new Iv2InitiateTaskMessage(0l, 0l, 0l, Long.MIN_VALUE, 0l, readOnly, !isMp, spi, 0l, 0l, false);
return msg;
}
use of org.voltdb.StoredProcedureInvocation in project voltdb by VoltDB.
the class TestProcedureInvocation method testRoundTrip.
/** Mimic the de/ser path from client to client interface */
public void testRoundTrip() throws Exception {
assertEquals(10, pi.getHandle());
ByteBuffer buf = ByteBuffer.allocate(pi.getSerializedSize());
try {
pi.flattenToBuffer(buf);
} catch (IOException e) {
e.printStackTrace();
fail();
}
buf.flip();
StoredProcedureInvocation spi = new StoredProcedureInvocation();
try {
spi.initFromBuffer(buf);
} catch (IOException e) {
e.printStackTrace();
fail();
}
verifySpi(spi);
}
Aggregations