use of org.voltdb.messaging.Iv2InitiateTaskMessage in project voltdb by VoltDB.
the class TestRepairLog method testTrackBinaryLogUniqueId.
@Test
public void testTrackBinaryLogUniqueId() {
// The end unique id for an @ApplyBinaryLogSP invocation is recorded
// as its fifth parameter. Create a realistic invocation, deliver it
// to the repair log, and see what we get
final long endSpUniqueId = 42;
final long endMpUniqueId = 25;
StoredProcedureInvocation spi = new StoredProcedureInvocation();
spi.setProcName("@ApplyBinaryLogSP");
spi.setParams(0, endSpUniqueId - 10, endSpUniqueId, endSpUniqueId, endMpUniqueId, new byte[] { 0 });
Iv2InitiateTaskMessage msg = new Iv2InitiateTaskMessage(0l, 0l, 0l, Long.MIN_VALUE, 0l, false, true, spi, 0l, 0l, false);
msg.setSpHandle(900l);
RepairLog log = new RepairLog();
log.deliver(msg);
validateRepairLog(log.contents(1l, false), endSpUniqueId, endMpUniqueId);
}
use of org.voltdb.messaging.Iv2InitiateTaskMessage in project voltdb by VoltDB.
the class TestRepairLog method testFuzz.
@Test
public void testFuzz() {
TxnEgo sphandle = TxnEgo.makeZero(0);
UniqueIdGenerator spbuig = new UniqueIdGenerator(0, 0);
UniqueIdGenerator mpbuig = new UniqueIdGenerator(0, 0);
sphandle = sphandle.makeNext();
RandomMsgGenerator msgGen = new RandomMsgGenerator();
RepairLog dut = new RepairLog();
long spBinaryLogSpUniqueId = Long.MIN_VALUE;
long spBinaryLogMpUniqueId = Long.MIN_VALUE;
long mpBinaryLogMpUniqueId = Long.MIN_VALUE;
for (int i = 0; i < 4000; i++) {
// get next message, update the sphandle according to SpScheduler rules,
// but only submit messages that would have been forwarded by the master
// to the repair log.
TransactionInfoBaseMessage msg = msgGen.generateRandomMessageInStream();
msg.setSpHandle(sphandle.getTxnId());
if (msg instanceof Iv2InitiateTaskMessage) {
Pair<Long, Long> uids = setBinaryLogUniqueId(msg, spbuig, mpbuig);
spBinaryLogSpUniqueId = Math.max(spBinaryLogSpUniqueId, uids.getFirst());
spBinaryLogMpUniqueId = Math.max(spBinaryLogMpUniqueId, uids.getSecond());
} else if (msg instanceof FragmentTaskMessage) {
mpBinaryLogMpUniqueId = Math.max(mpBinaryLogMpUniqueId, setBinaryLogUniqueId(msg, null, mpbuig).getSecond());
}
sphandle = sphandle.makeNext();
if (!msg.isReadOnly() || msg instanceof CompleteTransactionMessage) {
dut.deliver(msg);
}
}
List<Iv2RepairLogResponseMessage> stuff = dut.contents(1l, false);
validateRepairLog(stuff, spBinaryLogSpUniqueId, spBinaryLogMpUniqueId);
// Also check the MP version
stuff = dut.contents(1l, true);
validateRepairLog(stuff, Long.MIN_VALUE, mpBinaryLogMpUniqueId);
}
use of org.voltdb.messaging.Iv2InitiateTaskMessage in project voltdb by VoltDB.
the class TestRepairLog method truncInitMsg.
VoltMessage truncInitMsg(long truncPt, long handle) {
Iv2InitiateTaskMessage msg = mock(Iv2InitiateTaskMessage.class);
when(msg.getTruncationHandle()).thenReturn(truncPt);
when(msg.getSpHandle()).thenReturn(handle);
return msg;
}
use of org.voltdb.messaging.Iv2InitiateTaskMessage in project voltdb by VoltDB.
the class TestSite method makeInit.
private static Iv2InitiateTaskMessage makeInit(String procName) {
Iv2InitiateTaskMessage msg = mock(Iv2InitiateTaskMessage.class);
doReturn(procName).when(msg).getStoredProcedureName();
return msg;
}
use of org.voltdb.messaging.Iv2InitiateTaskMessage in project voltdb by VoltDB.
the class TestSpPromoteAlgo method makeResponse.
Iv2RepairLogResponseMessage makeResponse(long spHandle) {
Iv2RepairLogResponseMessage m = mock(Iv2RepairLogResponseMessage.class);
when(m.getHandle()).thenReturn(spHandle);
Iv2InitiateTaskMessage im = mock(Iv2InitiateTaskMessage.class);
when(m.getPayload()).thenReturn(im);
return m;
}
Aggregations