poorbarcode commented on code in PR #23231:
URL: https://github.com/apache/pulsar/pull/23231#discussion_r1746465968


##########
pulsar-broker-common/src/main/java/org/apache/pulsar/broker/ServiceConfiguration.java:
##########
@@ -949,6 +949,48 @@ The max allowed delay for delayed delivery (in 
milliseconds). If the broker rece
             + " back and unack count reaches to `limit/2`. Using a value of 0, 
is disabling unackedMessage-limit"
             + " check and broker doesn't block dispatchers")
     private int maxUnackedMessagesPerBroker = 0;
+
+    @FieldContext(
+            category = CATEGORY_POLICIES,
+            doc = "For Key_Shared subscriptions, if messages cannot be 
dispatched to consumers due to a slow consumer"
+                    + " or a blocked key hash (because of ordering 
constraints), the broker will continue reading more"
+                    + " messages from the backlog and attempt to dispatch them 
to consumers until the number of replay"
+                    + " messages reaches the calculated threshold.\n"
+                    + "Formula: threshold = 
max(keySharedLookAheadMsgInReplayThresholdPerConsumer *"
+                    + " connected consumer count, 
keySharedLookAheadMsgInReplayThresholdPerSubscription)"
+                    + ".\n"
+                    + "Setting this value to 0 will disable the limit 
calculated per consumer.",
+            dynamic = true
+    )
+    private int keySharedLookAheadMsgInReplayThresholdPerConsumer = 1000;
+
+    @FieldContext(
+            category = CATEGORY_POLICIES,
+            doc = "For Key_Shared subscriptions, if messages cannot be 
dispatched to consumers due to a slow consumer"
+                    + " or a blocked key hash (because of ordering 
constraints), the broker will continue reading more"
+                    + " messages from the backlog and attempt to dispatch them 
to consumers until the number of replay"
+                    + " messages reaches the calculated threshold.\n"
+                    + "Formula: threshold = 
max(keySharedLookAheadMsgInReplayThresholdPerConsumer *"
+                    + " connected consumer count, 
keySharedLookAheadMsgInReplayThresholdPerSubscription)"
+                    + ".\n"
+                    + "This value should be set to a value less than 2 * 
managedLedgerMaxUnackedRangesToPersist.\n"
+                    + "Setting this value to 0 will disable the limit 
calculated per subscription.\n",
+            dynamic = true
+    )
+    private int keySharedLookAheadMsgInReplayThresholdPerSubscription = 10000;
+
+
+    @FieldContext(
+            category = CATEGORY_POLICIES,
+            doc = "For Key_Shared subscriptions, if messages cannot be 
dispatched to consumers due to a slow consumer"
+                    + " or a blocked key hash (because of ordering 
constraints), the broker will continue reading more"
+                    + " messages from the backlog and attempt to dispatch them 
to consumers until the number of replay"
+                    + " messages reaches the calculated threshold.\n"
+                    + "This setting controls whether look ahead is enabled 
when recently joined consumers are present.",
+            dynamic = true
+    )
+    private boolean keySharedLookAheadEnabledWhenRecentlyJoinedConsumersExist 
= false;

Review Comment:
   Two things
   - Even if `keySharedLookAheadEnabledWhenRecentlyJoinedConsumersExist` is 
`false`, the broker will still look ahead and read entries, because it only 
affects when `messagesSent == 0`, see 
https://github.com/apache/pulsar/pull/23231/files#diff-c48d5c94842ac8c9a0c9314b207298069f38c8dcfeda4a9886fb3bb1f77843f2R362.
 
   - Since you set the default value of 
`keySharedLookAheadEnabledWhenRecentlyJoinedConsumersExist` to `false`, all 
tests will run with `keySharedLookAheadEnabledWhenRecentlyJoinedConsumersExist 
= false`, so we have no tests cover the cases that 
`keySharedLookAheadEnabledWhenRecentlyJoinedConsumersExist = true`.



-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to