codelipenghui commented on code in PR #19045:
URL: https://github.com/apache/pulsar/pull/19045#discussion_r1090373736


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -1563,6 +1571,8 @@ public void checkCompaction() {
                 }
 
                 if (backlogEstimate > compactionThreshold) {
+                    log.info("topic:{} backlogEstimate:{} is bigger than 
compactionThreshold:{}. Triggering compaction",

Review Comment:
   It should be a debug-level log. 



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -202,6 +205,11 @@ public class PersistentTopic extends AbstractTopic 
implements Topic, AddEntryCal
     private CompletableFuture<Long> currentCompaction = 
CompletableFuture.completedFuture(COMPACTION_NEVER_RUN);
     private final CompactedTopic compactedTopic;
 
+    // TODO: Create compaction strategy from topic policy when exposing 
strategic compaction to users.
+    private static Map<String, TopicCompactionStrategy> strategicCompactionMap 
= Map.of(
+            ServiceUnitStateChannelImpl.TOPIC,
+            new ServiceUnitStateCompactionStrategy());

Review Comment:
   Is it better to use `Optional<TopicCompactionStrategy> compactionStrategy` 
and set the value to `ServiceUnitStateCompactionStrategy` if the topic is 
`ServiceUnitStateChannelImpl.TOPIC`. Maintaining a map with the topic name as 
the key in a `PersistentTopic` instance is a little confusing.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to