heesung-sn commented on code in PR #20951:
URL: https://github.com/apache/pulsar/pull/20951#discussion_r1287419830
##########
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,
Review Comment:
Updated.
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BacklogQuotaManager.java:
##########
@@ -103,6 +105,7 @@ public void handleExceededBacklogQuota(PersistentTopic
persistentTopic, BacklogQ
break;
case producer_exception:
case producer_request_hold:
+ advanceSlowestMessageDeduplicationCursor(persistentTopic,
backlogQuotaType);
Review Comment:
updated
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -195,6 +195,10 @@ public class PersistentTopic extends AbstractTopic
implements Topic, AddEntryCal
private final TopicName shadowSourceTopic;
static final String DEDUPLICATION_CURSOR_NAME = "pulsar.dedup";
+
+ public static boolean isDedupCursorName(String name) {
+ return name.equals(DEDUPLICATION_CURSOR_NAME);
Review Comment:
updated.
##########
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 forcefully, 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]