Source:
@Override public synchronized Map<Integer, Map<Integer, Long>> reserveHistoryForExchange() { assert reservedForExchange == null : reservedForExchange; Map< Integer, Set< Integer>> applicableGroupsAndPartitions = partitionsApplicableForWalRebalance(); Map< Integer, T2< ReservationReason, Map< Integer, CheckpointEntry>>> earliestValidCheckpoints; checkpointReadLock(); try { earliestValidCheckpoints = cpHistory.searchAndReserveCheckpoints(applicableGroupsAndPartitions); } finally { checkpointReadUnlock(); } Map< Integer, Map< Integer, Long>> grpPartsWithCnts = new HashMap<>(); for (Map.Entry<Integer, T2< ReservationReason, Map< Integer, CheckpointEntry>>> e : earliestValidCheckpoints.entrySet()) { int grpId = e.getKey(); if (e.getValue().get2() == null) { if (log.isDebugEnabled()) log.debug("This group does not have a history reservation [grpId=" + e.getKey() + ", " + "reason=" + e.getValue().get1() + ']'); continue; } for (Map.Entry<Integer, CheckpointEntry> e0 : e.getValue().get2().entrySet()) { CheckpointEntry cpEntry = e0.getValue(); int partId = e0.getKey(); assert cctx.wal().reserved(cpEntry.checkpointMark()) : "WAL segment for checkpoint " + cpEntry + " has not reserved"; Long updCntr = cpEntry.partitionCounter(cctx, grpId, partId); if (updCntr != null) { if (reservedForExchange == null || ((FileWALPointer)cpEntry.checkpointMark()).index() < ((FileWALPointer)reservedForExchange).index()) reservedForExchange = cpEntry.checkpointMark(); grpPartsWithCnts.computeIfAbsent(grpId, k -> new HashMap<>()).put(partId, updCntr); } } } if (log.isInfoEnabled() && !F.isEmpty(earliestValidCheckpoints)) printReservationToLog(earliestValidCheckpoints); return grpPartsWithCnts; }

Target:
@Override public synchronized Map<Integer, Map<Integer, Long>> reserveHistoryForExchange() { assert reservedForExchange == null : reservedForExchange; Map< Integer, Set< Integer>> applicableGroupsAndPartitions = partitionsApplicableForWalRebalance(); Map< Integer, T2< ReservationReason, Map< Integer, CheckpointEntry>>> earliestValidCheckpoints; checkpointReadLock(); try { earliestValidCheckpoints = cpHistory.searchAndReserveCheckpoints(applicableGroupsAndPartitions); } finally { checkpointReadUnlock(); } Map< Integer, Map< Integer, Long>> grpPartsWithCnts = new HashMap<>(); for (Map.Entry<Integer, T2< ReservationReason, Map< Integer, CheckpointEntry>>> e : earliestValidCheckpoints.entrySet()) { int grpId = e.getKey(); if (e.getValue().get2() == null) continue; for (Map.Entry<Integer, CheckpointEntry> e0 : e.getValue().get2().entrySet()) { CheckpointEntry cpEntry = e0.getValue(); int partId = e0.getKey(); assert cctx.wal().reserved(cpEntry.checkpointMark()) : "WAL segment for checkpoint " + cpEntry + " has not reserved"; Long updCntr = cpEntry.partitionCounter(cctx, grpId, partId); if (updCntr != null) { if (reservedForExchange == null || ((FileWALPointer)cpEntry.checkpointMark()).index() < ((FileWALPointer)reservedForExchange).index()) reservedForExchange = cpEntry.checkpointMark(); grpPartsWithCnts.computeIfAbsent(grpId, k -> new HashMap<>()).put(partId, updCntr); } } } if (log.isInfoEnabled() && !F.isEmpty(earliestValidCheckpoints)) printReservationToLog(earliestValidCheckpoints); return grpPartsWithCnts; }