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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BacklogQuotaManager.java:
##########
@@ -268,4 +271,29 @@ private void disconnectProducers(PersistentTopic 
persistentTopic) {
 
         });
     }
+
+    private void advanceSlowestMessageDeduplicationCursor(PersistentTopic 
persistentTopic,
+                                                          BacklogQuotaType 
backlogQuotaType) {
+
+        if (backlogQuotaType != destination_storage) {
+            return;
+        }
+
+        MessageDeduplication dedup = persistentTopic.getMessageDeduplication();
+        if (dedup == null) {
+            return;
+        }
+
+        ManagedLedgerImpl mLedger = (ManagedLedgerImpl) 
persistentTopic.getManagedLedger();
+        ManagedCursor slowestConsumer = mLedger.getSlowestConsumer();
+        if (slowestConsumer == null) {
+            return;
+        }
+
+        if (!PersistentTopic.isDedupCursorName(slowestConsumer.getName())) {
+            return;
+        }
+
+        dedup.takeSnapshot();

Review Comment:
   I think we can keep and honor this interval check. We want to trigger 
snapshots when needed, but it won't make sense to take snapshots too frequently.
   
   As I mentioned in the motivation, producers can eventually be created when 
the next snapshot cycle kicks in if the time-based snapshot is enabled. 
   
   This PR is trying to particularly help the problem when the time-based 
snapshot is disabled(by default), where producer creation is indefinitely 
blocked. For this, this snapshot trigger can unblock producer creation.
   



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