lhotari opened a new pull request, #23423: URL: https://github.com/apache/pulsar/pull/23423
### Motivation Key_Shared PIP-379 implementation performs snapshots of hash range assignments after adding or removing a consumer in order to detect the existing consumers and hash ranges that changed as a result. This result is only used in Key_Shared AUTO_SPLIT ordered mode. Therefore, it's an unnecessary overhead for all other use cases. Any unnecessary work that can be avoided is a useful optimization although performance of the current snapshotting isn't a concern based on the microbenchmark and optimizations performed in the initial PR ([comment](https://github.com/apache/pulsar/pull/23352#discussion_r1791091365), simple microbenchmark). ### Modifications - modify `StickyKeyConsumerSelector` interface: - `CompletableFuture<ImpactedConsumersResult> addConsumer(Consumer consumer)` -> `CompletableFuture<Optional<ImpactedConsumersResult>> addConsumer(Consumer consumer)` - `ImpactedConsumersResult removeConsumer(Consumer consumer)` -> `Optional<ImpactedConsumersResult> removeConsumer(Consumer consumer)` - adjust `ConsistentHashingStickyKeyConsumerSelector` and `HashRangeAutoSplitStickyKeyConsumerSelector` to this change - drop snapshotting in `addConsumer` and `removeConsumer` for `HashRangeExclusiveStickyKeyConsumerSelector` since it's not needed. - adjust `PersistentStickyKeyDispatcherMultipleConsumers` to configure `ConsistentHashingStickyKeyConsumerSelector` and `HashRangeAutoSplitStickyKeyConsumerSelector` classes to use snapshotting when needed (Key_Shared AUTO_SPLIT ordered mode) and adapt to interface changes. ### 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 --> -- 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]
