Skip to content

Commit d1e2fb7

Browse files
committed
Address review comment about comments for removeWaitingCursor call in PersistentSubscription.removeConsumer
1 parent be91670 commit d1e2fb7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,14 @@ public synchronized void removeConsumer(Consumer consumer, boolean isResetCursor
355355
if (dispatcher != null && dispatcher.getConsumers().isEmpty()) {
356356
deactivateCursor();
357357
// Remove the cursor from the waiting cursors list.
358-
// For durable cursors, we should *not* cancel the pending read. This is because internally,
359-
// in the dispatcher implementations, there is a "havePendingRead" flag that is not reset. If the pending
360-
// read is cancelled, the dispatcher will not continue reading from the managed ledger when a new
361-
// consumer is added to the dispatcher since based on the "havePendingRead" state, it will continue to
362-
// expect that a read is pending and will not submit a new read.
358+
// For durable cursors, we should *not* cancel the pending read with cursor.cancelPendingReadRequest.
359+
// This is because internally, in the dispatcher implementations, there is a "havePendingRead" flag
360+
// that is not reset. If the pending read is cancelled, the dispatcher will not continue reading from
361+
// the managed ledger when a new consumer is added to the dispatcher since based on the "havePendingRead"
362+
// state, it will continue to expect that a read is pending and will not submit a new read.
363+
// For non-durable cursors, there's no difference since the cursor is not expected to be used again.
364+
365+
// remove waiting cursor from the managed ledger, this applies to both durable and non-durable cursors.
363366
topic.getManagedLedger().removeWaitingCursor(cursor);
364367

365368
if (!cursor.isDurable()) {

0 commit comments

Comments
 (0)