Technoboy- commented on a change in pull request #11564:
URL: https://github.com/apache/pulsar/pull/11564#discussion_r689964478



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/compaction/TwoPhaseCompactor.java
##########
@@ -145,14 +149,17 @@ private void phaseOneLoop(RawReader reader,
                     Pair<String, Integer> keyAndSize = extractKeyAndSize(m);
                     if (keyAndSize != null) {
                         if (keyAndSize.getRight() > 0) {
-                            latestForKey.put(keyAndSize.getLeft(), id);
+                            MessageId old = 
latestForKey.put(keyAndSize.getLeft(), id);
+                            replaceMessage = old != null;
                         } else {
                             deletedMessage = true;
                             latestForKey.remove(keyAndSize.getLeft());
                         }
                     }
                 }
-
+                if (replaceMessage || deletedMessage) {
+                    mxBean.addCompactRemovedEvent(reader.getTopic());
+                }

Review comment:
       `compactRemoveEvent` indicates how many duplicate messages have been 
removed in this compact task.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to