Search in sources :

Example 1 with MultiPartitionParticipantMessage

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

the class InvocationDispatcher method sendSentinel.

private final void sendSentinel(long txnId, long initiatorHSId, long ciHandle, long connectionId, boolean forReplay) {
    //The only field that is relevant is txnid, and forReplay.
    MultiPartitionParticipantMessage mppm = new MultiPartitionParticipantMessage(m_siteId, initiatorHSId, txnId, ciHandle, connectionId, // isReadOnly
    false, // isForReplay
    forReplay);
    m_mailbox.send(initiatorHSId, mppm);
}
Also used : MultiPartitionParticipantMessage(org.voltdb.messaging.MultiPartitionParticipantMessage)

Example 2 with MultiPartitionParticipantMessage

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

the class TestReplaySequencer method makeSentinel.

TransactionInfoBaseMessage makeSentinel(long unused) {
    MultiPartitionParticipantMessage m = mock(MultiPartitionParticipantMessage.class);
    when(m.isForReplay()).thenReturn(true);
    return m;
}
Also used : MultiPartitionParticipantMessage(org.voltdb.messaging.MultiPartitionParticipantMessage)

Example 3 with MultiPartitionParticipantMessage

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

the class SpScheduler method sequenceForReplay.

/**
     * Sequence the message for replay if it's for CL or DR.
     *
     * @param message
     * @return true if the message can be delivered directly to the scheduler,
     * false if the message is queued
     */
@Override
public boolean sequenceForReplay(VoltMessage message) {
    boolean canDeliver = false;
    long sequenceWithUniqueId = Long.MIN_VALUE;
    boolean commandLog = (message instanceof TransactionInfoBaseMessage && (((TransactionInfoBaseMessage) message).isForReplay()));
    boolean sentinel = message instanceof MultiPartitionParticipantMessage;
    boolean replay = commandLog || sentinel;
    boolean sequenceForReplay = m_isLeader && replay;
    if (replay) {
        sequenceWithUniqueId = ((TransactionInfoBaseMessage) message).getUniqueId();
    }
    if (sequenceForReplay) {
        InitiateResponseMessage dupe = m_replaySequencer.dedupe(sequenceWithUniqueId, (TransactionInfoBaseMessage) message);
        if (dupe != null) {
            // Duplicate initiate task message, send response
            m_mailbox.send(dupe.getInitiatorHSId(), dupe);
        } else if (!m_replaySequencer.offer(sequenceWithUniqueId, (TransactionInfoBaseMessage) message)) {
            canDeliver = true;
        } else {
            deliverReadyTxns();
        }
        // If it's a DR sentinel, send an acknowledgement
        if (sentinel && !commandLog) {
            MultiPartitionParticipantMessage mppm = (MultiPartitionParticipantMessage) message;
            final InitiateResponseMessage response = new InitiateResponseMessage(mppm);
            ClientResponseImpl clientResponse = new ClientResponseImpl(ClientResponseImpl.UNEXPECTED_FAILURE, new VoltTable[0], ClientResponseImpl.IGNORED_TRANSACTION);
            response.setResults(clientResponse);
            m_mailbox.send(response.getInitiatorHSId(), response);
        }
    } else {
        if (replay) {
            // Update last seen and last polled uniqueId for replicas
            m_replaySequencer.updateLastSeenUniqueId(sequenceWithUniqueId, (TransactionInfoBaseMessage) message);
            m_replaySequencer.updateLastPolledUniqueId(sequenceWithUniqueId, (TransactionInfoBaseMessage) message);
        }
        canDeliver = true;
    }
    return canDeliver;
}
Also used : MultiPartitionParticipantMessage(org.voltdb.messaging.MultiPartitionParticipantMessage) TransactionInfoBaseMessage(org.voltcore.messaging.TransactionInfoBaseMessage) InitiateResponseMessage(org.voltdb.messaging.InitiateResponseMessage) ClientResponseImpl(org.voltdb.ClientResponseImpl)

Aggregations

MultiPartitionParticipantMessage (org.voltdb.messaging.MultiPartitionParticipantMessage)3 TransactionInfoBaseMessage (org.voltcore.messaging.TransactionInfoBaseMessage)1 ClientResponseImpl (org.voltdb.ClientResponseImpl)1 InitiateResponseMessage (org.voltdb.messaging.InitiateResponseMessage)1