Search in sources :

Example 6 with FragmentTaskMessage

use of org.voltdb.messaging.FragmentTaskMessage in project voltdb by VoltDB.

the class TestSpSchedulerDedupe method testPrimaryFragmentTaskResponseNoReplicas.

@Test
public void testPrimaryFragmentTaskResponseNoReplicas() throws Exception {
    long txnid = TxnEgo.makeZero(0).getTxnId();
    long primary_hsid = 1111l;
    createObjs();
    dut.setLeaderState(true);
    dut.updateReplicas(new ArrayList<Long>(), null);
    FragmentTaskMessage sptask = createFrag(txnid, true, primary_hsid);
    dut.deliver(sptask);
    // verify no response sent yet
    verify(mbox, times(0)).send(anyLong(), (VoltMessage) anyObject());
    verify(mbox, times(0)).send(new long[] { anyLong() }, (VoltMessage) anyObject());
    FragmentResponseMessage resp = new FragmentResponseMessage(sptask, 0l);
    dut.deliver(resp);
    verify(mbox, times(1)).send(eq(primary_hsid), eq(resp));
}
Also used : FragmentTaskMessage(org.voltdb.messaging.FragmentTaskMessage) Matchers.anyLong(org.mockito.Matchers.anyLong) FragmentResponseMessage(org.voltdb.messaging.FragmentResponseMessage) Test(org.junit.Test)

Example 7 with FragmentTaskMessage

use of org.voltdb.messaging.FragmentTaskMessage in project voltdb by VoltDB.

the class TestSpSchedulerDedupe method createFrag.

private FragmentTaskMessage createFrag(long txnId, boolean readOnly, long destHSId) {
    FragmentTaskMessage frag = new // don't care
    FragmentTaskMessage(// don't care
    destHSId, // don't care
    destHSId, txnId, System.currentTimeMillis(), readOnly, false, false);
    frag.setSpHandle(TxnEgo.makeZero(0).getTxnId());
    return frag;
}
Also used : FragmentTaskMessage(org.voltdb.messaging.FragmentTaskMessage)

Example 8 with FragmentTaskMessage

use of org.voltdb.messaging.FragmentTaskMessage in project voltdb by VoltDB.

the class TestSpSchedulerDedupe method testReplicaFragmentTaskResponse.

@Test
public void testReplicaFragmentTaskResponse() throws Exception {
    long txnid = TxnEgo.makeZero(0).getTxnId();
    long primary_hsid = 1111l;
    createObjs();
    // read only message will not be received on replicas.
    FragmentTaskMessage sptask = createFrag(txnid, false, primary_hsid);
    dut.deliver(sptask);
    // verify no response sent yet
    verify(mbox, times(0)).send(anyLong(), (VoltMessage) anyObject());
    verify(mbox, times(0)).send(new long[] { anyLong() }, (VoltMessage) anyObject());
    FragmentResponseMessage resp = new FragmentResponseMessage(sptask, 0l);
    dut.deliver(resp);
    verify(mbox, times(1)).send(eq(primary_hsid), eq(resp));
}
Also used : FragmentTaskMessage(org.voltdb.messaging.FragmentTaskMessage) FragmentResponseMessage(org.voltdb.messaging.FragmentResponseMessage) Test(org.junit.Test)

Example 9 with FragmentTaskMessage

use of org.voltdb.messaging.FragmentTaskMessage in project voltdb by VoltDB.

the class CompleteTransactionTask method logToDR.

private void logToDR(PartitionDRGateway drGateway) {
    // Log invocation to DR
    if (drGateway != null && !m_txnState.isForReplay() && !m_txnState.isReadOnly() && !m_completeMsg.isRollback()) {
        FragmentTaskMessage fragment = (FragmentTaskMessage) m_txnState.getNotice();
        Iv2InitiateTaskMessage initiateTask = fragment.getInitiateTask();
        assert (initiateTask != null);
        if (initiateTask == null) {
            hostLog.error("Unable to log MP transaction to DR because of missing InitiateTaskMessage, " + "fragment: " + fragment.toString());
        }
        StoredProcedureInvocation invocation = initiateTask.getStoredProcedureInvocation().getShallowCopy();
        drGateway.onSuccessfulMPCall(m_txnState.m_spHandle, m_txnState.txnId, m_txnState.uniqueId, m_completeMsg.getHash(), invocation, m_txnState.getResults());
    }
}
Also used : StoredProcedureInvocation(org.voltdb.StoredProcedureInvocation) FragmentTaskMessage(org.voltdb.messaging.FragmentTaskMessage) Iv2InitiateTaskMessage(org.voltdb.messaging.Iv2InitiateTaskMessage)

Example 10 with FragmentTaskMessage

use of org.voltdb.messaging.FragmentTaskMessage in project voltdb by VoltDB.

the class TestMpPromoteAlgo method makeFragResponse.

Iv2RepairLogResponseMessage makeFragResponse(long handle, long uniqueId) {
    FragmentTaskMessage frag = mock(FragmentTaskMessage.class);
    Iv2RepairLogResponseMessage m = mock(Iv2RepairLogResponseMessage.class);
    when(m.getPayload()).thenReturn(frag);
    when(m.getHandle()).thenReturn(-1L);
    when(m.getTxnId()).thenReturn(handle);
    return m;
}
Also used : Iv2RepairLogResponseMessage(org.voltdb.messaging.Iv2RepairLogResponseMessage) FragmentTaskMessage(org.voltdb.messaging.FragmentTaskMessage)

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