ivankelly commented on a change in pull request #2591: Fix: Compaction with last deleted keys not completing compaction URL: https://github.com/apache/incubator-pulsar/pull/2591#discussion_r217979707
########## File path: pulsar-broker/src/main/java/org/apache/pulsar/compaction/TwoPhaseCompactor.java ########## @@ -217,10 +229,11 @@ private void phaseTwoLoop(RawReader reader, MessageId to, Map<String, MessageId> } } else { Pair<String,Integer> keyAndSize = extractKeyAndSize(m); + MessageId msg; if (keyAndSize == null) { // pass through messages without a key messageToAdd = Optional.of(m); - } else if (latestForKey.get(keyAndSize.getLeft()).equals(id) - && keyAndSize.getRight() > 0) { + } else if ((msg = latestForKey.get(keyAndSize.getLeft())) != null && msg.equals(id) + && keyAndSize.getRight() > 0) { // consider message only if present into latestForKey map Review comment: I guess this check is redundant now. No harm in leaving it though ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services