Caideyipi opened a new pull request, #18736:
URL: https://github.com/apache/iotdb/pull/18736
## Description
### Problem
Consensus subscription consumers poll only the regions assigned by the
ownership snapshot. The supplied 40-consumer/40-region result shows consumers
closing after 60 seconds without a message while another consumer continues
receiving data. Once consumers close, ownership redistribution increases the
surviving consumers' region load and amplifies the failure.
### Fix
Keep assigned regions as the preferred polling path. If every assigned
region is currently empty, a consumer may borrow exactly one event that is
already prefetched by another active region.
Fallback candidates are restricted to ready events, so polling does not
block on another consumer's region. They are ordered by descending lag and
stable region ID. If an assigned region returns data, no fallback region is
polled, preserving normal ownership affinity.
### Tests
- Added coverage for borrowing a ready event after an assigned-region dry
spell.
- Added coverage confirming that assigned-region data prevents fallback
polling.
- Ran the targeted ConsensusSubscriptionBrokerPayloadLimitTest and
ConsensusSubscriptionBrokerOwnershipTest tests.
- Result: 9 tests, 0 failures, 0 errors.
<hr>
This PR has:
- [x] been self-reviewed.
- [x] concurrent read and write
- [x] added comments explaining the why and intent of the new fallback path.
- [x] added unit tests covering the new code paths.
<hr>
##### Key changed/added classes
- ConsensusSubscriptionBroker
- ConsensusSubscriptionBrokerPayloadLimitTest
--
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]