You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "Denovo1998 (via GitHub)" <gi...@apache.org> on 2026/10/14 13:42:30 UTC
[PR] [fix][broker] Honor dynamic decreases of dispatcherMaxReadBatchSize [pulsar]
Denovo1998 opened a new pull request, #26908:
URL: https://github.com/apache/pulsar/pull/26908
### Motivation
Lowering `dispatcherMaxReadBatchSize` dynamically does not consistently limit reads issued by existing persistent dispatchers and replicators. After a 500 → 100 update, dispatchers can continue requesting 500 entries; an idle replicator can also issue its first new read at 500 before read completion corrects the cached batch size. This prevents a live rollback of the default increase in apache/pulsar#26744 from taking full effect.
### Modifications
- Cap read batches by both the adaptive batch size and the current configured maximum in the multiple-consumer and single-active-consumer dispatchers.
- Apply the live maximum in `PersistentReplicator#getReadLimits()` before issuing a new cursor read.
- Cover normal and precise dispatcher flow control, plus replication with and without dispatch rate limiting.
- Add regressions that keep the existing dispatcher and replicator instances throughout the dynamic update.
### Verifying this change
- [x] Make sure that the change passes the CI checks.
This change added `testDynamicMaxReadBatchSizeDecrease`, covering Shared, Key_Shared, Exclusive and Failover subscriptions with precise flow control enabled and disabled. Each case first reads with a batch size of 500, lowers the maximum to 100 through the broker admin API, and verifies subsequent cursor read requests without recreating the dispatcher.
`testReplicatorHonorsDynamicReadBatchSizeDecrease` pauses an existing replicator using a topic-level dispatch limiter, lowers the maximum from 500 to 100, and checks its first resumed cursor read. It covers both removing and reconfiguring the limiter, and also runs through `OneWayReplicatorUsingGlobalZKTest` and `OneWayReplicatorUsingGlobalPartitionedTest`.
Before the replication fix, both new cases fail because the first read requests 500 entries. With the fix, all 22 focused cases pass with no failures or skipped tests. `quickCheck` also passes.
```bash
./gradlew :pulsar-broker:test \
--tests 'PersistentDispatcherMultipleConsumersReadLimitsTest' \
--tests 'OneWayReplicatorTest.testReplicatorHonorsDynamicReadBatchSizeDecrease' \
--tests 'OneWayReplicatorUsingGlobalZKTest.testReplicatorHonorsDynamicReadBatchSizeDecrease' \
--tests 'OneWayReplicatorUsingGlobalPartitionedTest.testReplicatorHonorsDynamicReadBatchSizeDecrease' \
--tests 'OneWayReplicatorTest.testReplicatorContinuesAfterRateLimiterHasNoPermits' \
--tests 'PersistentReplicatorInflightTaskTest.testReadMoreEntriesSchedulesCursorReadWithReadLimits' \
--max-workers=2 -PtestMaxParallelForks=1 -PtestRetryCount=0 -PtestFailFast=false
./gradlew quickCheck --max-workers=2
```
### Does this pull request potentially affect one of the following parts:
- [ ] 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
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][broker] Honor dynamic decreases of dispatcherMaxReadBatchSize [pulsar]
Posted by "codelipenghui (via GitHub)" <gi...@apache.org>.
codelipenghui merged PR #26908:
URL: https://github.com/apache/pulsar/pull/26908
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org