Source:
<code>public long[] updateReplicas(final List<Long> replicas, final Map<Integer, Long> partitionMasters, boolean balanceSPI) { applyLeaderMigration(replicas, balanceSPI); m_iv2Masters.clear(); m_iv2Masters.addAll(replicas); m_partitionMasters.clear(); m_partitionMasters.putAll(partitionMasters); if (!m_isLeader) { return new long[0]; } if (!balanceSPI) { List<Long> doneCounters = new LinkedList<Long>(); for (Entry<Long, DuplicateCounter> entry : m_duplicateCounters.entrySet()) { DuplicateCounter counter = entry.getValue(); int result = counter.updateReplicas(m_iv2Masters); if (result == DuplicateCounter.DONE) { doneCounters.add(entry.getKey()); } } Collections.sort(doneCounters); for (Long key : doneCounters) { DuplicateCounter counter = m_duplicateCounters.remove(key); VoltMessage resp = counter.getLastResponse(); if (resp != null && resp instanceof InitiateResponseMessage) { InitiateResponseMessage msg = (InitiateResponseMessage)resp; if (msg.haveSentMpFragment()) { m_repairLogTruncationHandle = m_repairLogAwaitingCommit; m_pendingTasks.setRepairLogTruncationHandle(m_repairLogTruncationHandle); <START> m_repairLogAwaitingCommit = msg.getTxnId(); <END> } m_outstandingTxns.remove(msg.getTxnId()); m_mailbox.send(counter.m_destinationId, resp); } else { hostLog.warn("TXN " + counter.getTxnId() + " lost all replicas and " + "had no responses. This should be impossible?"); } } } Set<Integer> partitionLeaderHosts = CoreUtils.getHostIdsFromHSIDs(m_iv2Masters); partitionLeaderHosts.removeAll(((MpInitiatorMailbox)m_mailbox).m_messenger.getLiveHostIds()); MpRepairTask repairTask = new MpRepairTask((InitiatorMailbox)m_mailbox, replicas, balanceSPI, partitionLeaderHosts.isEmpty()); m_pendingTasks.repair(repairTask, replicas, partitionMasters, balanceSPI); return new long[0]; }</code><technical_language>Is this assignment OK messages committed? "awaiting commit" in this context</technical_language>

Target:
public long[] updateReplicas(final List<Long> replicas, final Map<Integer, Long> partitionMasters, boolean balanceSPI) { applyLeaderMigration(replicas, balanceSPI); m_iv2Masters.clear(); m_iv2Masters.addAll(replicas); m_partitionMasters.clear(); m_partitionMasters.putAll(partitionMasters); if (!m_isLeader) { return new long[0]; } if (!balanceSPI) { List<Long> doneCounters = new LinkedList<Long>(); for (Entry<Long, DuplicateCounter> entry : m_duplicateCounters.entrySet()) { DuplicateCounter counter = entry.getValue(); int result = counter.updateReplicas(m_iv2Masters); if (result == DuplicateCounter.DONE) { doneCounters.add(entry.getKey()); } } Collections.sort(doneCounters); for (Long key : doneCounters) { DuplicateCounter counter = m_duplicateCounters.remove(key); VoltMessage resp = counter.getLastResponse(); if (resp != null && resp instanceof InitiateResponseMessage) { InitiateResponseMessage msg = (InitiateResponseMessage)resp; advanceRepairTruncationHandle(msg); m_outstandingTxns.remove(msg.getTxnId()); m_mailbox.send(counter.m_destinationId, resp); } else { hostLog.warn("TXN " + counter.getTxnId() + " lost all replicas and " + "had no responses. This should be impossible?"); } } } Set<Integer> partitionLeaderHosts = CoreUtils.getHostIdsFromHSIDs(m_iv2Masters); partitionLeaderHosts.removeAll(((MpInitiatorMailbox)m_mailbox).m_messenger.getLiveHostIds()); MpRepairTask repairTask = new MpRepairTask((InitiatorMailbox)m_mailbox, replicas, balanceSPI, partitionLeaderHosts.isEmpty()); m_pendingTasks.repair(repairTask, replicas, partitionMasters, balanceSPI); return new long[0]; }