Search in sources :

Example 1 with ReplicationResponseMessageV2

use of org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationResponseMessageV2 in project activemq-artemis by apache.

the class ServerPacketDecoder method slowPathDecode.

// separating for performance reasons
private Packet slowPathDecode(ActiveMQBuffer in, byte packetType, CoreRemotingConnection connection) {
    Packet packet;
    switch(packetType) {
        case SESS_SEND_LARGE:
            {
                packet = new SessionSendLargeMessage(new CoreMessage());
                break;
            }
        case REPLICATION_APPEND:
            {
                packet = new ReplicationAddMessage();
                break;
            }
        case REPLICATION_APPEND_TX:
            {
                packet = new ReplicationAddTXMessage();
                break;
            }
        case REPLICATION_DELETE:
            {
                packet = new ReplicationDeleteMessage();
                break;
            }
        case REPLICATION_DELETE_TX:
            {
                packet = new ReplicationDeleteTXMessage();
                break;
            }
        case REPLICATION_PREPARE:
            {
                packet = new ReplicationPrepareMessage();
                break;
            }
        case REPLICATION_COMMIT_ROLLBACK:
            {
                packet = new ReplicationCommitMessage();
                break;
            }
        case REPLICATION_RESPONSE:
            {
                packet = new ReplicationResponseMessage();
                break;
            }
        case REPLICATION_RESPONSE_V2:
            {
                packet = new ReplicationResponseMessageV2();
                break;
            }
        case REPLICATION_PAGE_WRITE:
            {
                packet = new ReplicationPageWriteMessage();
                break;
            }
        case REPLICATION_PAGE_EVENT:
            {
                packet = new ReplicationPageEventMessage();
                break;
            }
        case REPLICATION_LARGE_MESSAGE_BEGIN:
            {
                packet = new ReplicationLargeMessageBeginMessage();
                break;
            }
        case REPLICATION_LARGE_MESSAGE_END:
            {
                packet = new ReplicationLargeMessageEndMessage();
                break;
            }
        case REPLICATION_LARGE_MESSAGE_WRITE:
            {
                packet = new ReplicationLargeMessageWriteMessage();
                break;
            }
        case PacketImpl.BACKUP_REGISTRATION:
            {
                packet = new BackupRegistrationMessage();
                break;
            }
        case PacketImpl.BACKUP_REGISTRATION_FAILED:
            {
                packet = new BackupReplicationStartFailedMessage();
                break;
            }
        case PacketImpl.REPLICATION_START_FINISH_SYNC:
            {
                packet = new ReplicationStartSyncMessage();
                break;
            }
        case PacketImpl.REPLICATION_SYNC_FILE:
            {
                packet = new ReplicationSyncFileMessage();
                break;
            }
        case PacketImpl.REPLICATION_SCHEDULED_FAILOVER:
            {
                packet = new ReplicationLiveIsStoppingMessage();
                break;
            }
        case CLUSTER_CONNECT:
            {
                packet = new ClusterConnectMessage();
                break;
            }
        case CLUSTER_CONNECT_REPLY:
            {
                packet = new ClusterConnectReplyMessage();
                break;
            }
        case NODE_ANNOUNCE:
            {
                packet = new NodeAnnounceMessage();
                break;
            }
        case BACKUP_REQUEST:
            {
                packet = new BackupRequestMessage();
                break;
            }
        case BACKUP_REQUEST_RESPONSE:
            {
                packet = new BackupResponseMessage();
                break;
            }
        case QUORUM_VOTE:
            {
                packet = new QuorumVoteMessage();
                break;
            }
        case QUORUM_VOTE_REPLY:
            {
                packet = new QuorumVoteReplyMessage();
                break;
            }
        case SCALEDOWN_ANNOUNCEMENT:
            {
                packet = new ScaleDownAnnounceMessage();
                break;
            }
        default:
            {
                packet = super.decode(packetType, connection);
            }
    }
    packet.decode(in);
    return packet;
}
Also used : QuorumVoteMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.QuorumVoteMessage) ReplicationAddTXMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationAddTXMessage) ReplicationLargeMessageWriteMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageWriteMessage) ReplicationLargeMessageBeginMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageBeginMessage) BackupRequestMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupRequestMessage) ReplicationCommitMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationCommitMessage) ReplicationPageWriteMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPageWriteMessage) ReplicationLargeMessageEndMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLargeMessageEndMessage) ReplicationAddMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationAddMessage) BackupResponseMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupResponseMessage) ReplicationLiveIsStoppingMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationLiveIsStoppingMessage) SessionSendLargeMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.SessionSendLargeMessage) BackupRegistrationMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupRegistrationMessage) Packet(org.apache.activemq.artemis.core.protocol.core.Packet) ClusterConnectReplyMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ClusterConnectReplyMessage) BackupReplicationStartFailedMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupReplicationStartFailedMessage) ReplicationDeleteMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationDeleteMessage) ScaleDownAnnounceMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ScaleDownAnnounceMessage) QuorumVoteReplyMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.QuorumVoteReplyMessage) CoreMessage(org.apache.activemq.artemis.core.message.impl.CoreMessage) ReplicationPageEventMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPageEventMessage) NodeAnnounceMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.NodeAnnounceMessage) ReplicationSyncFileMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationSyncFileMessage) ClusterConnectMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ClusterConnectMessage) ReplicationPrepareMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationPrepareMessage) ReplicationDeleteTXMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationDeleteTXMessage) ReplicationStartSyncMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationStartSyncMessage) ReplicationResponseMessage(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationResponseMessage) ReplicationResponseMessageV2(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationResponseMessageV2)

Example 2 with ReplicationResponseMessageV2

use of org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationResponseMessageV2 in project activemq-artemis by apache.

the class ReplicationEndpoint method handleStartReplicationSynchronization.

/**
 * Reserves files (with the given fileID) in the specified journal, and places a
 * {@link FileWrapperJournal} in place to store messages while synchronization is going on.
 *
 * @param packet
 * @return if the incoming packet indicates the synchronization is finished then return an acknowledgement otherwise
 * return an empty response
 * @throws Exception
 */
private ReplicationResponseMessageV2 handleStartReplicationSynchronization(final ReplicationStartSyncMessage packet) throws Exception {
    if (logger.isTraceEnabled()) {
        logger.trace("handleStartReplicationSynchronization:: nodeID = " + packet);
    }
    ReplicationResponseMessageV2 replicationResponseMessage = new ReplicationResponseMessageV2();
    if (!started)
        return replicationResponseMessage;
    if (packet.isSynchronizationFinished()) {
        finishSynchronization(packet.getNodeID());
        replicationResponseMessage.setSynchronizationIsFinishedAcknowledgement(true);
        return replicationResponseMessage;
    }
    switch(packet.getDataType()) {
        case LargeMessages:
            for (long msgID : packet.getFileIds()) {
                createLargeMessage(msgID, true);
            }
            break;
        case JournalBindings:
        case JournalMessages:
            if (wantedFailBack && !packet.isServerToFailBack()) {
                ActiveMQServerLogger.LOGGER.autoFailBackDenied();
            }
            final JournalContent journalContent = SyncDataType.getJournalContentType(packet.getDataType());
            final Journal journal = journalsHolder.get(journalContent);
            if (packet.getNodeID() != null) {
                // At the start of replication, we still do not know which is the nodeID that the live uses.
                // This is the point where the backup gets this information.
                backupQuorum.liveIDSet(packet.getNodeID());
            }
            Map<Long, JournalSyncFile> mapToFill = filesReservedForSync.get(journalContent);
            for (Entry<Long, JournalFile> entry : journal.createFilesForBackupSync(packet.getFileIds()).entrySet()) {
                mapToFill.put(entry.getKey(), new JournalSyncFile(entry.getValue()));
            }
            FileWrapperJournal syncJournal = new FileWrapperJournal(journal);
            registerJournal(journalContent.typeByte, syncJournal);
            break;
        default:
            throw ActiveMQMessageBundle.BUNDLE.replicationUnhandledDataType();
    }
    return replicationResponseMessage;
}
Also used : JournalFile(org.apache.activemq.artemis.core.journal.impl.JournalFile) FileWrapperJournal(org.apache.activemq.artemis.core.journal.impl.FileWrapperJournal) Journal(org.apache.activemq.artemis.core.journal.Journal) FileWrapperJournal(org.apache.activemq.artemis.core.journal.impl.FileWrapperJournal) JournalContent(org.apache.activemq.artemis.core.persistence.impl.journal.AbstractJournalStorageManager.JournalContent) ReplicationResponseMessageV2(org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationResponseMessageV2)

Aggregations

ReplicationResponseMessageV2 (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationResponseMessageV2)2 Journal (org.apache.activemq.artemis.core.journal.Journal)1 FileWrapperJournal (org.apache.activemq.artemis.core.journal.impl.FileWrapperJournal)1 JournalFile (org.apache.activemq.artemis.core.journal.impl.JournalFile)1 CoreMessage (org.apache.activemq.artemis.core.message.impl.CoreMessage)1 JournalContent (org.apache.activemq.artemis.core.persistence.impl.journal.AbstractJournalStorageManager.JournalContent)1 Packet (org.apache.activemq.artemis.core.protocol.core.Packet)1 BackupRegistrationMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupRegistrationMessage)1 BackupReplicationStartFailedMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupReplicationStartFailedMessage)1 BackupRequestMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupRequestMessage)1 BackupResponseMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.BackupResponseMessage)1 ClusterConnectMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ClusterConnectMessage)1 ClusterConnectReplyMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ClusterConnectReplyMessage)1 NodeAnnounceMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.NodeAnnounceMessage)1 QuorumVoteMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.QuorumVoteMessage)1 QuorumVoteReplyMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.QuorumVoteReplyMessage)1 ReplicationAddMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationAddMessage)1 ReplicationAddTXMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationAddTXMessage)1 ReplicationCommitMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationCommitMessage)1 ReplicationDeleteMessage (org.apache.activemq.artemis.core.protocol.core.impl.wireformat.ReplicationDeleteMessage)1