@Override public void setPerPartitionTxnIds(long[] perPartitionTxnIds) { boolean foundMultipartTxnId = false; boolean foundSinglepartTxnId = false; for (long txnId : perPartitionTxnIds) { if (TxnEgo.getPartitionId(txnId) == m_partitionId) { if (foundSinglepartTxnId) { VoltDB.crashLocalVoltDB( "Found multiple transactions ids during restore for a partition", false, null); } foundSinglepartTxnId = true; m_initiatorMailbox.setMaxLastSeenTxnId(txnId); } if (TxnEgo.getPartitionId(txnId) == MpInitiator.MP_INIT_PID) { if (foundMultipartTxnId) { VoltDB.crashLocalVoltDB( "Found multiple transactions ids during restore for a multipart txnid", false, null); } foundMultipartTxnId = true; m_initiatorMailbox.setMaxLastSeenMultipartTxnId(txnId); } } if (!foundMultipartTxnId) { VoltDB.crashLocalVoltDB("Didn't find a multipart txnid on restore", false, null); } }
/** Start fixing survivors: setup scoreboard and request repair logs. */ void prepareForFaultRecovery() { for (Long hsid : m_survivors) { m_replicaRepairStructs.put(hsid, new ReplicaRepairStruct()); } tmLog.info( m_whoami + "found (including self) " + m_survivors.size() + " surviving replicas to repair. " + " Survivors: " + CoreUtils.hsIdCollectionToString(m_survivors)); VoltMessage logRequest = new Iv2RepairLogRequestMessage(m_requestId, Iv2RepairLogRequestMessage.SPREQUEST); m_mailbox.send(com.google.common.primitives.Longs.toArray(m_survivors), logRequest); }
/** Send missed-messages to survivors. */ public void repairSurvivors() { // cancel() and repair() must be synchronized by the caller (the deliver lock, // currently). If cancelled and the last repair message arrives, don't send // out corrections! if (this.m_promotionResult.isCancelled()) { tmLog.debug(m_whoami + "Skipping repair message creation for cancelled Term."); return; } int queued = 0; tmLog.debug(m_whoami + "received all repair logs and is repairing surviving replicas."); for (Iv2RepairLogResponseMessage li : m_repairLogUnion) { List<Long> needsRepair = new ArrayList<Long>(5); for (Entry<Long, ReplicaRepairStruct> entry : m_replicaRepairStructs.entrySet()) { if (entry.getValue().needs(li.getHandle())) { ++queued; tmLog.debug( m_whoami + "repairing " + CoreUtils.hsIdToString(entry.getKey()) + ". Max seen " + entry.getValue().m_maxSpHandleSeen + ". Repairing with " + li.getHandle()); needsRepair.add(entry.getKey()); } } if (!needsRepair.isEmpty()) { if (tmLog.isTraceEnabled()) { tmLog.trace( m_whoami + "repairing: " + CoreUtils.hsIdCollectionToString(needsRepair) + " with message: " + li.getPayload()); } m_mailbox.repairReplicasWith(needsRepair, li.getPayload()); } } tmLog.debug(m_whoami + "finished queuing " + queued + " replica repair messages."); m_promotionResult.done(m_maxSeenTxnId); }