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));
}
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;
}
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));
}
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());
}
}
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;
}
Aggregations