Search in sources :

Example 21 with FragmentTaskMessage

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);
}
Also used : Iv2RepairLogResponseMessage(org.voltdb.messaging.Iv2RepairLogResponseMessage) FragmentTaskMessage(org.voltdb.messaging.FragmentTaskMessage) Iv2InitiateTaskMessage(org.voltdb.messaging.Iv2InitiateTaskMessage) AtomicLong(java.util.concurrent.atomic.AtomicLong) CompleteTransactionMessage(org.voltdb.messaging.CompleteTransactionMessage) TransactionInfoBaseMessage(org.voltcore.messaging.TransactionInfoBaseMessage) Test(org.junit.Test)

Example 22 with FragmentTaskMessage

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;
}
Also used : FragmentTaskMessage(org.voltdb.messaging.FragmentTaskMessage)

Example 23 with FragmentTaskMessage

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;
}
Also used : FragmentTaskMessage(org.voltdb.messaging.FragmentTaskMessage)

Example 24 with FragmentTaskMessage

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;
}
Also used : FragmentTaskMessage(org.voltdb.messaging.FragmentTaskMessage)

Example 25 with FragmentTaskMessage

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));
}
Also used : FragmentTaskMessage(org.voltdb.messaging.FragmentTaskMessage) ArrayList(java.util.ArrayList) Matchers.anyLong(org.mockito.Matchers.anyLong) FragmentResponseMessage(org.voltdb.messaging.FragmentResponseMessage) Test(org.junit.Test)

Aggregations

FragmentTaskMessage (org.voltdb.messaging.FragmentTaskMessage)28 CompleteTransactionMessage (org.voltdb.messaging.CompleteTransactionMessage)9 Iv2InitiateTaskMessage (org.voltdb.messaging.Iv2InitiateTaskMessage)9 Test (org.junit.Test)6 Iv2RepairLogResponseMessage (org.voltdb.messaging.Iv2RepairLogResponseMessage)6 FragmentResponseMessage (org.voltdb.messaging.FragmentResponseMessage)5 ArrayList (java.util.ArrayList)4 TransactionInfoBaseMessage (org.voltcore.messaging.TransactionInfoBaseMessage)3 VoltTrace (org.voltdb.utils.VoltTrace)3 AtomicLong (java.util.concurrent.atomic.AtomicLong)2 Matchers.anyLong (org.mockito.Matchers.anyLong)2 StoredProcedureInvocation (org.voltdb.StoredProcedureInvocation)2 TransactionState (org.voltdb.dtxn.TransactionState)2 HashMap (java.util.HashMap)1 List (java.util.List)1 Random (java.util.Random)1 Mailbox (org.voltcore.messaging.Mailbox)1 VoltMessage (org.voltcore.messaging.VoltMessage)1 ParameterSet (org.voltdb.ParameterSet)1 VoltTable (org.voltdb.VoltTable)1