heesung-sn commented on code in PR #22048:
URL: https://github.com/apache/pulsar/pull/22048#discussion_r1486985248


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java:
##########
@@ -298,6 +299,12 @@ public synchronized void start() throws 
PulsarServerException {
 
             ExtensibleLoadManagerImpl.createSystemTopic(pulsar, TOPIC);
 
+            Long threshold = 
pulsar.getAdminClient().topicPolicies().getCompactionThreshold(TOPIC);
+            if (threshold == null || COMPACTION_THRESHOLD != threshold) {
+                
pulsar.getAdminClient().topicPolicies().setCompactionThreshold(TOPIC, 
COMPACTION_THRESHOLD);
+                log.info("Set compaction threshold for system topic {}.", 
TOPIC);
+            }

Review Comment:
   I think currently topic policy is required to set this compaction threshold. 
   
    pulsar.getAdminClient().topics().setCompcationThreshold(..) has been 
deprecated by https://github.com/apache/pulsar/pull/7881/files



##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelTest.java:
##########
@@ -984,6 +984,9 @@ public void conflictAndCompactionTest() throws 
ExecutionException, InterruptedEx
         channel3.close();
         FieldUtils.writeDeclaredField(channel2,
                 "inFlightStateWaitingTimeInMillis", 30 * 1000, true);
+        admin.topicPolicies()
+                .setCompactionThreshold(ServiceUnitStateChannelImpl.TOPIC, 
threshold);

Review Comment:
   I think this should always pass. I wonder in what cases this 
`setCompactionThreshold ` might fail?



-- 
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