codelipenghui commented on code in PR #17056:
URL: https://github.com/apache/pulsar/pull/17056#discussion_r943080290
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -2326,14 +2328,27 @@ public void checkInactiveSubscriptions() {
@Override
public void checkBackloggedCursors() {
// activate caught up cursors which include consumers
+ AtomicReference<PositionImpl> slowestNonDurableReadPosition = new
AtomicReference<>();
subscriptions.forEach((subName, subscription) -> {
+ ManagedCursor cursor = subscription.getCursor();
+ if (cursor instanceof NonDurableCursorImpl) {
+ PositionImpl readPosition = (PositionImpl)
cursor.getReadPosition();
+ if (slowestNonDurableReadPosition.get() == null ||
readPosition.compareTo(
+ slowestNonDurableReadPosition.get()) < 0) {
+ slowestNonDurableReadPosition.set(readPosition);
+ }
+ }
if (!subscription.getConsumers().isEmpty()
&& subscription.getCursor().getNumberOfEntries() <
backloggedCursorThresholdEntries) {
subscription.getCursor().setActive();
} else {
subscription.getCursor().setInactive();
}
});
+ if (slowestNonDurableReadPosition.get() != null) {
+ ManagedLedger managedLedger = getManagedLedger();
Review Comment:
+1
--
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]