use of org.voltdb.messaging.FragmentTaskMessage 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.FragmentTaskMessage in project voltdb by VoltDB.
the class TestRepairLog method truncFragMsg.
VoltMessage truncFragMsg(long truncPt, long mpTxnId) {
FragmentTaskMessage msg = mock(FragmentTaskMessage.class);
when(msg.getTxnId()).thenReturn(mpTxnId);
when(msg.getTruncationHandle()).thenReturn(truncPt);
return msg;
}
use of org.voltdb.messaging.FragmentTaskMessage in project voltdb by VoltDB.
the class TestSite method makeFrag.
private static FragmentTaskMessage makeFrag(boolean sysproc, long id) {
FragmentTaskMessage msg = mock(FragmentTaskMessage.class);
doReturn(sysproc).when(msg).isSysProcTask();
doReturn(VoltSystemProcedure.fragIdToHash(id)).when(msg).getPlanHash(anyInt());
return msg;
}
use of org.voltdb.messaging.FragmentTaskMessage in project voltdb by VoltDB.
the class TestReplaySequencer method makeFragment.
TransactionInfoBaseMessage makeFragment(long unused) {
FragmentTaskMessage m = mock(FragmentTaskMessage.class);
when(m.isForReplay()).thenReturn(true);
return m;
}
use of org.voltdb.messaging.FragmentTaskMessage in project voltdb by VoltDB.
the class TestSpSchedulerDedupe method testPrimaryFragmentTaskResponseReplicas.
@Test
public void testPrimaryFragmentTaskResponseReplicas() throws Exception {
long txnid = TxnEgo.makeZero(0).getTxnId();
long primary_hsid = 1111l;
createObjs();
dut.setLeaderState(true);
List<Long> replicas = new ArrayList<Long>();
replicas.add(2l);
dut.updateReplicas(replicas, null);
FragmentTaskMessage sptask = createFrag(txnid, false, primary_hsid);
dut.deliver(sptask);
// verify no response sent yet
verify(mbox, times(0)).send(anyLong(), (VoltMessage) anyObject());
ArgumentCaptor<FragmentTaskMessage> replmsg = ArgumentCaptor.forClass(FragmentTaskMessage.class);
verify(mbox, times(1)).send(eq(new long[] { 2 }), replmsg.capture());
assertEquals(dut_hsid, replmsg.getValue().getCoordinatorHSId());
FragmentResponseMessage resp = new FragmentResponseMessage(sptask, 0l);
dut.deliver(resp);
FragmentResponseMessage replresp = new FragmentResponseMessage(replmsg.getValue(), 0l);
dut.deliver(replresp);
verify(mbox, times(1)).send(eq(primary_hsid), eq(resp));
}
Aggregations