Caideyipi opened a new pull request, #18738: URL: https://github.com/apache/iotdb/pull/18738
## Description Consensus subscription ownership can assign a consumer only regions that temporarily have no matching events. Even when another region has prefetched data ready, the consumer repeatedly receives empty polls and may hit its idle timeout, reducing the group and leaving a large WAL backlog. This change keeps stable ownership as the preferred polling path, but when all assigned queues are empty it allows the consumer to borrow one already-prefetched event from an unassigned queue. Fallback queues are ordered by lag, are never waited on, and only one fallback event is returned per topic poll, preserving ownership affinity and response-size behavior. Unit tests cover both fallback borrowing from a ready queue and retaining strict affinity when an assigned queue has data. <hr> This PR has: - [x] been self-reviewed. - [x] added comments explaining the intent of the fallback polling path. - [x] added unit tests for the new code paths. Tests: - `mvn spotless:apply -pl iotdb-core/datanode` - `mvn surefire:test -pl iotdb-core/datanode -Dtest=ConsensusSubscriptionBrokerPayloadLimitTest,ConsensusSubscriptionBrokerOwnershipTest -DforkCount=0 -Dsurefire.excludes=` <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]
