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

   PIP: #20776 
   
   <!-- Details of when a PIP is required and how the PIP process work, please 
see: https://github.com/apache/pulsar/blob/master/pip/README.md -->
   
   ### Motivation
   
   Key_Shared has a mechanism called the "recently joined consumers" to keep 
message ordering.
   However, currently, it doesn't care about some corner cases.
   More specifically, we found two out-of-order issues cased by:
   
   1. [issue-1] The race condition in the "recently joined consumers", where 
consumers can be added before finishing reading and dispatching messages from 
ledgers.
   2. [issue-2] Messages could be added to messagesToRedeliver without 
consumer-side operations such as unacknowledgement.
   
   We should care about these cases in Key_Shared subscription.
   (For more details, please see the PIP document.)
   
   ### Modifications
   
   1. Introduce the new position (the lastSentPosition and 
individuallySentPositions) and use them in 
PersistentStickyKeyDispatcherMultipleConsumers.
   2. Rename the consumer stats `readPositionWhenJoining` to 
`lastSentPositionWhenJoining`.
   3. Modify the subscription stats (consumersAfterMarkDeletePosition) of the 
definition.
   
   (For more details, please see the PIP document.)
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   This change added tests and can be verified as follows:
   
   - Unit tests for the lastSentPosition and individuallySentPositions
   - Test for guaranteed message ordering in corner cases
   
   ### Does this pull request potentially affect one of the following parts:
   
   *If the box was checked, please highlight the changes*
   
   - [ ] Dependencies (add or upgrade a dependency)
   - [ ] The public API
   - [ ] The schema
   - [ ] The default values of configurations
   - [ ] The threading model
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [x] The metrics
     - 
https://github.com/apache/pulsar/blob/43a2dc3f9fd9ab68e7429f2345899a6b0cb0bcbe/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java#L1281-L1288
     - 
https://github.com/apache/pulsar/blob/43a2dc3f9fd9ab68e7429f2345899a6b0cb0bcbe/pulsar-client-admin-api/src/main/java/org/apache/pulsar/common/policies/data/ConsumerStats.java#L72-L73
   - [ ] Anything that affects deployment
   
   ### Documentation
   
   - [ ] `doc` <!-- Your PR contains doc changes. -->
   - [x] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: https://github.com/equanz/pulsar/pull/6
   


-- 
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]

Reply via email to