@Override public void handleResponse(ClientResponse resp) { if (resp == null) { VoltDB.crashLocalVoltDB( "Received a null response to a snapshot initiation request. " + "This should be impossible.", true, null); } else if (resp.getStatus() != ClientResponse.SUCCESS) { tmLog.info( "Failed to complete partition detection snapshot, status: " + resp.getStatus() + ", reason: " + resp.getStatusString()); tmLog.info("Retrying partition detection snapshot..."); SnapshotUtil.requestSnapshot( 0L, m_partSnapshotSchedule.getPath(), m_partSnapshotSchedule.getPrefix() + System.currentTimeMillis(), true, SnapshotFormat.NATIVE, null, m_snapshotHandler, true); } else if (!SnapshotUtil.didSnapshotRequestSucceed(resp.getResults())) { VoltDB.crashGlobalVoltDB( "Unable to complete partition detection snapshot: " + resp.getResults()[0], false, null); } else { VoltDB.crashGlobalVoltDB( "Partition detection snapshot completed. Shutting down.", false, null); } }
private void doPartitionDetectionActivities() { // We should never re-enter here once we've decided we're partitioned and doomed assert (!m_partitionDetected); // After everything is resolved, write the new surviving set to ZK List<Integer> currentNodes = null; try { currentNodes = m_hostMessenger.getLiveHostIds(); } catch (Exception e) { } Set<Integer> currentHosts = new HashSet<Integer>(currentNodes); Set<Integer> previousHosts = readPriorKnownLiveNodes(); boolean partitionDetectionTriggered = makePPDDecision(previousHosts, currentHosts); if (partitionDetectionTriggered) { m_partitionDetected = true; if (m_usingCommandLog) { // Just shut down immediately VoltDB.crashGlobalVoltDB( "Use of command logging detected, no additional database snapshot will " + "be generated. Please use the 'recover' action to restore the database if necessary.", false, null); } else { SnapshotUtil.requestSnapshot( 0L, m_partSnapshotSchedule.getPath(), m_partSnapshotSchedule.getPrefix() + System.currentTimeMillis(), true, SnapshotFormat.NATIVE, null, m_snapshotHandler, true); } } // If the cluster host set has changed, then write the new set to ZK // NOTE: we don't want to update the known live nodes if we've decided that our subcluster is // dying, otherwise a poorly timed subsequent failure might reverse this decision. Any future // promoted // LeaderAppointer should make their partition detection decision based on the pre-partition // cluster state. else if (!currentHosts.equals(previousHosts)) { writeKnownLiveNodes(currentNodes); } }