Search in sources :

Example 1 with StreamSnapshotSink

use of org.voltdb.rejoin.StreamSnapshotSink 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)

Aggregations

RejoinMessage (org.voltdb.messaging.RejoinMessage)1 StreamSnapshotSink (org.voltdb.rejoin.StreamSnapshotSink)1