vinkal-chudgar opened a new pull request, #24965:
URL: https://github.com/apache/pulsar/pull/24965
Fixes #24963
### Motivation
The in-flight deduplication for
`BinaryProtoLookupService#getPartitionedTopicMetadata `used only `TopicName`.
Calls that differ in `metadataAutoCreationEnabled` or
`useFallbackForNonPIP344Brokers` were coalesced, which could return a future
that does not match the requested behavior.
**Concrete example:**
- Thread A calls `getPartitionedTopicMetadata(topic, true, false)` and
creates a future
- Thread B calls `getPartitionedTopicMetadata(topic, false, true) `and
receives the same future from A
- Thread B gets a result that reflects `metadataAutoCreationEnabled=true`,
which is incorrect
This PR fixes deduplication by keying in-flight requests on all method
parameters.
### Modifications
- Introduced `PartitionedTopicMetadataKey(topicName,
metadataAutoCreationEnabled, useFallbackForNonPIP344Brokers)`
- Changed `partitionedMetadataInProgress` to use
`PartitionedTopicMetadataKey` as the map key instead of `TopicName`
- Used `computeIfAbsent` with the new key and removed the entry on
completion with `remove(key, future)`
- Tests
- Added
BinaryProtoLookupServiceTest#testPartitionedMetadataDeduplicationAndCleanup
- Added
BinaryProtoLookupServiceTest#testPartitionedMetadataDeduplicationDifferentParameterCombinations
### Verifying this change
- [ ] Make sure that the change passes the CI checks.
This change added tests and can be verified as follows:
- Added
BinaryProtoLookupServiceTest#testPartitionedMetadataDeduplicationAndCleanup
- Added
BinaryProtoLookupServiceTest#testPartitionedMetadataDeduplicationDifferentParameterCombinations
### Does this pull request potentially affect one of the following parts:
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
*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
- [ ] The metrics
- [ ] Anything that affects deployment
### 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 -->
- [ ] `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/vinkal-chudgar/pulsar/pull/5
--
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]