Search in sources :

Example 1 with RejoinMessage

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

the class RejoinProducer method doInitiation.

/**
     * Runs when the RejoinCoordinator decides this site should start
     * rejoin.
     */
void doInitiation(RejoinMessage message) {
    m_coordinatorHsId = message.m_sourceHSId;
    m_schemaHasNoTables = message.schemaHasNoTables();
    if (!m_schemaHasNoTables) {
        m_streamSnapshotMb = VoltDB.instance().getHostMessenger().createMailbox();
        m_rejoinSiteProcessor = new StreamSnapshotSink(m_streamSnapshotMb);
    } else {
        m_streamSnapshotMb = null;
        m_rejoinSiteProcessor = null;
    }
    // MUST choose the leader as the source.
    long sourceSite = m_mailbox.getMasterHsId(m_partitionId);
    // Provide a valid sink host id unless it is an empty database.
    long hsId = (m_rejoinSiteProcessor != null ? m_rejoinSiteProcessor.initialize(message.getSnapshotSourceCount(), message.getSnapshotBufferPool()) : Long.MIN_VALUE);
    REJOINLOG.debug(m_whoami + "received INITIATION message. Doing rejoin" + ". Source site is: " + CoreUtils.hsIdToString(sourceSite) + " and destination rejoin processor is: " + CoreUtils.hsIdToString(hsId) + " and snapshot nonce is: " + message.getSnapshotNonce());
    registerSnapshotMonitor(message.getSnapshotNonce());
    // Tell the RejoinCoordinator everything it will need to know to get us our snapshot stream.
    RejoinMessage initResp = new RejoinMessage(m_mailbox.getHSId(), sourceSite, hsId);
    m_mailbox.send(m_coordinatorHsId, initResp);
    // Start waiting for snapshot data
    m_taskQueue.offer(this);
}
Also used : RejoinMessage(org.voltdb.messaging.RejoinMessage) StreamSnapshotSink(org.voltdb.rejoin.StreamSnapshotSink)

Example 2 with RejoinMessage

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

the class ElasticJoinProducer method doInitiation.

private void doInitiation(RejoinMessage message) {
    m_coordinatorHsId = message.m_sourceHSId;
    registerSnapshotMonitor(message.getSnapshotNonce());
    long sinkHSId = m_dataSink.initialize(message.getSnapshotSourceCount(), message.getSnapshotBufferPool());
    // respond to the coordinator with the sink HSID
    RejoinMessage msg = new RejoinMessage(m_mailbox.getHSId(), -1, sinkHSId);
    m_mailbox.send(m_coordinatorHsId, msg);
    m_taskQueue.offer(this);
    JOINLOG.info("P" + m_partitionId + " received initiation");
}
Also used : RejoinMessage(org.voltdb.messaging.RejoinMessage)

Example 3 with RejoinMessage

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

the class Iv2RejoinCoordinator method deliver.

@Override
public void deliver(VoltMessage message) {
    if (!(message instanceof RejoinMessage)) {
        VoltDB.crashLocalVoltDB("Unknown message type " + message.getClass().toString() + " sent to the rejoin coordinator", false, null);
    }
    RejoinMessage rm = (RejoinMessage) message;
    Type type = rm.getType();
    if (type == RejoinMessage.Type.SNAPSHOT_FINISHED) {
        REJOINLOG.info("Finished streaming snapshot to site: " + CoreUtils.hsIdToString(rm.m_sourceHSId));
    } else if (type == RejoinMessage.Type.REPLAY_FINISHED) {
        assert (m_catalog != null);
        boolean schemaHasNoTables = m_catalog.getTables().isEmpty();
        initiateNextSite(schemaHasNoTables);
        onReplayFinished(rm.m_sourceHSId);
    } else if (type == RejoinMessage.Type.INITIATION_RESPONSE) {
        onSiteInitialized(rm.m_sourceHSId, rm.getMasterHSId(), rm.getSnapshotSinkHSId(), rm.schemaHasNoTables());
    } else {
        VoltDB.crashLocalVoltDB("Wrong rejoin message of type " + type + " sent to the rejoin coordinator", false, null);
    }
}
Also used : Type(org.voltdb.messaging.RejoinMessage.Type) SnapshotPathType(org.voltdb.sysprocs.saverestore.SnapshotPathType) RejoinMessage(org.voltdb.messaging.RejoinMessage)

Example 4 with RejoinMessage

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

the class Iv2RejoinCoordinator method initiateRejoinOnSites.

private void initiateRejoinOnSites(List<Long> HSIds, boolean schemaHasNoTables) {
    // We're going to share this snapshot across the provided HSIDs.
    // Steal just the first one to disabiguate it.
    String nonce = makeSnapshotNonce("Rejoin", HSIds.get(0));
    // acquisition ordering with other in-process mailboxes.
    synchronized (m_lock) {
        for (long HSId : HSIds) {
            m_nonces.put(HSId, nonce);
        }
    }
    RejoinMessage msg = new RejoinMessage(getHSId(), m_liveRejoin ? RejoinMessage.Type.INITIATION : RejoinMessage.Type.INITIATION_COMMUNITY, nonce, // 1 source per rejoining site
    1, m_snapshotBufPool, schemaHasNoTables);
    send(com.google_voltpatches.common.primitives.Longs.toArray(HSIds), msg);
    // For testing, exit if only one property is set...
    if (m_rejoinDeathTestMode && !m_rejoinDeathTestCancel && (m_sitesRejoinedCount.incrementAndGet() == 2)) {
        System.exit(0);
    }
}
Also used : RejoinMessage(org.voltdb.messaging.RejoinMessage)

Example 5 with RejoinMessage

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

the class ElasticJoinProducer method sendFirstFragResponse.

/**
     * Notify the coordinator that this site has received the first fragment message
     */
private void sendFirstFragResponse() {
    if (JOINLOG.isDebugEnabled()) {
        JOINLOG.debug("P" + m_partitionId + " sending first fragment response to coordinator " + CoreUtils.hsIdToString(m_coordinatorHsId));
    }
    RejoinMessage msg = new RejoinMessage(m_mailbox.getHSId(), RejoinMessage.Type.FIRST_FRAGMENT_RECEIVED);
    m_mailbox.send(m_coordinatorHsId, msg);
    m_firstFragResponseSent = true;
}
Also used : RejoinMessage(org.voltdb.messaging.RejoinMessage)

Aggregations

RejoinMessage (org.voltdb.messaging.RejoinMessage)6 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ExecutionException (java.util.concurrent.ExecutionException)1 DRConsumerDrIdTracker (org.voltdb.DRConsumerDrIdTracker)1 SiteProcedureConnection (org.voltdb.SiteProcedureConnection)1 SnapshotCompletionEvent (org.voltdb.SnapshotCompletionInterest.SnapshotCompletionEvent)1 Type (org.voltdb.messaging.RejoinMessage.Type)1 StreamSnapshotSink (org.voltdb.rejoin.StreamSnapshotSink)1 TaskLog (org.voltdb.rejoin.TaskLog)1 SnapshotPathType (org.voltdb.sysprocs.saverestore.SnapshotPathType)1