You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "BewareMyPower (via GitHub)" <gi...@apache.org> on 2024/03/16 09:03:42 UTC
[PR] [improve][broker] Remove the atomicity on active consumer of a dispatcher [pulsar]
BewareMyPower opened a new pull request, #22285:
URL: https://github.com/apache/pulsar/pull/22285
### Motivation
The modifications on
`AbstractDispatcherSingleActiveConsumer#activeConsumer` only happen on `pickAndScheduleActiveConsumer`, which is only called in `addConsumer` and `removeConsumer`. However, both `addConsumer` and `removeConsumer` are synchronized methods so that we don't have to perform an atomic operation on `activeConsumer`.
The composite operations on `activeConsumer` also happen on synchronized methods like `disconnectActiveConsumers`. The only access to `activeConsumer` that is not synchronized is the read on `activeConsumer` like `getActiveConsumer()` and `isConsumerConnected()`.
### Modifications
Remove the `ACTIVE_CONSUMER_UPDATER` and note some methods are not thread safe or there is no need to make them thread safe.
Besides, since `pickAndScheduleActiveConsumer` is never called concurrently, we don't need a double-checked locking on `readOnActiveConsumerTask`. Instead, just synchronize the modification in the scheduled task.
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [x] `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:
--
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
Re: [PR] [improve][broker] Remove the atomicity on active consumer of a dispatcher [pulsar]
Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- merged PR #22285:
URL: https://github.com/apache/pulsar/pull/22285
--
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
Re: [PR] [improve][broker] Remove the atomicity on active consumer of a dispatcher [pulsar]
Posted by "Technoboy- (via GitHub)" <gi...@apache.org>.
Technoboy- closed pull request #22285: [improve][broker] Remove the atomicity on active consumer of a dispatcher
URL: https://github.com/apache/pulsar/pull/22285
--
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