You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/07/12 13:55:25 UTC

[GitHub] [pulsar] HQebupt opened a new pull request, #16546: [fix][broker]check the cursor status when handling flowPermits

HQebupt opened a new pull request, #16546:
URL: https://github.com/apache/pulsar/pull/16546

   Fixes #14559
   
   ### Motivation
   `Reader` belongs to exclusive subscription type, and it uses `nonDurable` cursor. After receiving messages, `Reader` will ack cumulatively immediately.
   `FlowPermits` are triggered in multiple scenarios from the client side and it is isolated from `seek` of `Consumer`. Therefore, it is possibile that `flowPermits` will execute after `seek` from the client side, like the following flow chart. 
   
   <img width="613" alt="image" src="https://user-images.githubusercontent.com/4970972/178506611-b02a1127-c8d8-40df-be61-7645deb5f48e.png">
   
   When `handleSeek` processing is delay from the server side, the `MarkDelete position` is modified in a wrong way.
   The expected result is that `Reader`can re-consume messages from `mark delete:(1,1)` after `seek`. But it doesn't work.
   
   ### Modifications
   It is necessary to check the current cursor status when handling `flowPermits` from the server side.
   
   
   ### Verifying this change
   
   - [x]  Make sure that the change passes the CI checks.
   
   This change is a trivial rework / code cleanup without any test coverage.
   ### Does this pull request potentially affect one of the following parts:
   
   If `yes` was chosen, please highlight the changes
   
   - Dependencies (does it add or upgrade a dependency): (no)
   - The public API: (no)
   - The schema: (no)
   - The default values of configurations: (no)
   - The wire protocol: (no)
   - The rest endpoints: (no)
   - The admin cli options: (no)
   - Anything that affects deployment: (no)
   
   ### Documentation
   Check the box below and label this PR (if you have committer privilege).
   
   Need to update docs? 
   - [x] `doc-not-needed` 
   


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt commented on pull request #16546: [fix][broker]check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1182690869

   /pulsarbot run-failure-checks


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] codelipenghui commented on a diff in pull request #16546: [fix][broker]check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
codelipenghui commented on code in PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#discussion_r919629700


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherSingleActiveConsumer.java:
##########
@@ -278,6 +279,11 @@ private synchronized void internalConsumerFlow(Consumer consumer) {
                 log.debug("[{}-{}] Ignoring flow control message since consumer is waiting for cursor to be rewinded",
                         name, consumer);
             }
+        } else if (((ManagedCursorImpl) cursor).resetCursorInProgress()) {
+            if (log.isDebugEnabled()) {
+                log.debug("[{}-{}] Ignoring flow control message since cursor reset in progress - cursor {}",
+                        name, consumer, cursor.getName());
+            }

Review Comment:
   This can avoid the new flow permit requests but can't prevent an in-process entry reading operation? The client-side also has an opportunity to receive messages after the seek position.



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -3283,4 +3283,13 @@ public void setState(State state) {
     public ManagedLedgerConfig getConfig() {
         return config;
     }
+
+    /**
+     * check cursor reset status.
+     *
+     * @return true if the cursor reset in progress
+     */
+    public boolean resetCursorInProgress() {

Review Comment:
   ```suggestion
       public boolean isResetCursorInProgress() {
   ```



-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1183141874

   /pulsarbot run-failure-checks


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1192084533

   /pulsarbot run-failure-checks


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] github-actions[bot] commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1260310210

   The pr had no activity for 30 days, mark with Stale label.


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] Jason918 commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
Jason918 commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1229151673

   @HQebupt Please fix CI failure.


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] github-actions[bot] commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1356980039

   The pr had no activity for 30 days, mark with Stale label.


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt closed pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt closed pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits
URL: https://github.com/apache/pulsar/pull/16546


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt commented on pull request #16546: [fix][broker]check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1182655903

   /pulsarbot run-failure-checks


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1193316514

   /pulsarbot run-failure-checks


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1193261102

   /pulsarbot run-failure-checks


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1185099613

   /pulsarbot run-failure-checks


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt commented on a diff in pull request #16546: [fix][broker]check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt commented on code in PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#discussion_r919656030


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherSingleActiveConsumer.java:
##########
@@ -278,6 +279,11 @@ private synchronized void internalConsumerFlow(Consumer consumer) {
                 log.debug("[{}-{}] Ignoring flow control message since consumer is waiting for cursor to be rewinded",
                         name, consumer);
             }
+        } else if (((ManagedCursorImpl) cursor).resetCursorInProgress()) {
+            if (log.isDebugEnabled()) {
+                log.debug("[{}-{}] Ignoring flow control message since cursor reset in progress - cursor {}",
+                        name, consumer, cursor.getName());
+            }

Review Comment:
   It makes sense. We have to check the seek request status before ack. I have an idea: add a similar status like `resetCursorInProgress `in `ConsumerImpl`. Client has to check the status before sending ack request. How about it ? @codelipenghui 



-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] github-actions[bot] commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1226691605

   The pr had no activity for 30 days, mark with Stale label.


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1229400176

   /pulsarbot run-failure-checks


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1182813056

   /pulsarbot run-failure-checks


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1183088091

   /pulsarbot run-failure-checks


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1183917962

   /pulsarbot run-failure-checks


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1184028499

   /pulsarbot run-failure-checks


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt commented on pull request #16546: [fix][broker]check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1182740250

   
   /pulsarbot run-failure-checks
   
   


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] HQebupt commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
HQebupt commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1229394126

   /pulsarbot run-failure-checks


-- 
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-unsubscribe@pulsar.apache.org

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


[GitHub] [pulsar] congbobo184 commented on pull request #16546: [fix][broker]stage 1: check the cursor status when handling flowPermits

Posted by GitBox <gi...@apache.org>.
congbobo184 commented on PR #16546:
URL: https://github.com/apache/pulsar/pull/16546#issuecomment-1318543363

   @HQebupt  hi, I move this PR to release/2.9.5, if you have any questions, please ping me. thanks.


-- 
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-unsubscribe@pulsar.apache.org

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