Caideyipi opened a new pull request, #18448:
URL: https://github.com/apache/iotdb/pull/18448
## Description
### Problem
The subscription consumer round-robins all available DataNode providers.
After any provider returned an empty poll response, it slept for 50-150 ms
before trying the next provider. In a multi-DataNode deployment where only some
providers own active subscription queues, these per-provider sleeps made
consumption time grow with the provider count even when another provider
already had data ready.
### Fix
Track the number of currently available providers in each serial poll round.
An empty response now immediately advances to the next provider, and the
existing random backoff runs only after a complete round returns no user
message. Provider RPCs remain serial, and single-provider behavior is unchanged.
### Tests
Added unit coverage for:
- finding data on the next provider without backing off;
- backing off exactly once after all three providers return empty, then
continuing the next round.
Verified with:
- `mvn spotless:apply -pl iotdb-client/subscription`
- `mvn -Ddevelocity.off=true test -pl iotdb-client/subscription` (50 tests)
- `mvn -Ddevelocity.off=true -DskipTests test-compile -pl
iotdb-client/subscription -P with-zh-locale`
<hr>
This PR has:
- [x] been self-reviewed.
- [x] concurrent read
- [ ] concurrent write
- [ ] concurrent read and write
- [x] added comments explaining the why and the intent of the code wherever
would not be obvious for an unfamiliar reader.
- [x] added unit tests or modified existing tests to cover new code paths,
ensuring the threshold for code coverage.
<hr>
##### Key changed/added classes (or packages if there are too many classes)
in this PR
- `AbstractSubscriptionConsumer`
- `AbstractSubscriptionProviders`
- `SubscriptionConsumerMultiProviderPollTest`
--
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]