use of org.voltdb.iv2.Initiator in project voltdb by VoltDB.
the class RealVoltDB method onReplayCompletion.
@Override
public void onReplayCompletion(long txnId, Map<Integer, Long> perPartitionTxnIds) {
/*
* Remove the terminus file if it is there, which is written on shutdown --save
*/
new File(m_nodeSettings.getVoltDBRoot(), VoltDB.TERMINUS_MARKER).delete();
/*
* Command log is already initialized if this is a rejoin or a join
*/
if ((m_commandLog != null) && (m_commandLog.needsInitialization())) {
// Initialize command logger
m_commandLog.init(m_catalogContext.cluster.getLogconfig().get("log").getLogsize(), txnId, m_cartographer.getPartitionCount(), m_config.m_commandLogBinding, perPartitionTxnIds);
try {
ZKCountdownLatch latch = new ZKCountdownLatch(m_messenger.getZK(), VoltZK.commandlog_init_barrier, m_messenger.getLiveHostIds().size());
latch.countDown(true);
latch.await();
} catch (Exception e) {
VoltDB.crashLocalVoltDB("Failed to init and wait on command log init barrier", true, e);
}
}
/*
* IV2: After the command log is initialized, force the writing of the initial
* viable replay set. Turns into a no-op with no command log, on the non-leader sites, and on the MPI.
*/
for (Initiator initiator : m_iv2Initiators.values()) {
initiator.enableWritingIv2FaultLog();
}
/*
* IV2: From this point on, not all node failures should crash global VoltDB.
*/
if (m_leaderAppointer != null) {
m_leaderAppointer.onReplayCompletion();
}
deleteStagedCatalogIfNeeded();
if (m_startMode != null) {
m_mode = m_startMode;
} else {
// Shouldn't be here, but to be safe
m_mode = OperationMode.RUNNING;
}
if (!m_rejoining && !m_joining) {
if (m_clientInterface != null) {
try {
m_clientInterface.startAcceptingConnections();
} catch (IOException e) {
hostLog.l7dlog(Level.FATAL, LogKeys.host_VoltDB_ErrorStartAcceptingConnections.name(), e);
VoltDB.crashLocalVoltDB("Error starting client interface.", true, e);
}
// send hostUp trap
m_snmp.hostUp("host is now a cluster member");
}
// Start listening on the DR ports
createDRConsumerIfNeeded();
prepareReplication();
startHealthMonitor();
// Allow export datasources to start consuming their binary deques safely
// as at this juncture the initial truncation snapshot is already complete
ExportManager.instance().startPolling(m_catalogContext);
//Tell import processors that they can start ingesting data.
ImportManager.instance().readyForData(m_catalogContext, m_messenger);
}
try {
if (m_adminListener != null) {
m_adminListener.start();
}
} catch (Exception e) {
hostLog.l7dlog(Level.FATAL, LogKeys.host_VoltDB_ErrorStartHTTPListener.name(), e);
VoltDB.crashLocalVoltDB("HTTP service unable to bind to port.", true, e);
}
if (!m_rejoining && !m_joining) {
Object[] args = { (m_mode == OperationMode.PAUSED) ? "PAUSED" : "NORMAL" };
consoleLog.l7dlog(Level.INFO, LogKeys.host_VoltDB_ServerOpMode.name(), args, null);
consoleLog.l7dlog(Level.INFO, LogKeys.host_VoltDB_ServerCompletedInitialization.name(), null, null);
m_statusTracker.setNodeState(NodeState.UP);
}
// Create a zk node to indicate initialization is completed
m_messenger.getZK().create(VoltZK.init_completed, null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, new ZKUtil.StringCallback(), null);
}
Aggregations