[ISSUE #1340] [Java] Resume PushConsumer receive after cache drains - #1341
[ISSUE #1340] [Java] Resume PushConsumer receive after cache drains#1341qianye1001 wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1341 +/- ##
============================================
+ Coverage 53.26% 62.72% +9.45%
- Complexity 651 828 +177
============================================
Files 208 108 -100
Lines 14303 4663 -9640
Branches 5845 366 -5479
============================================
- Hits 7619 2925 -4694
+ Misses 6308 1540 -4768
+ Partials 376 198 -178
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
843c349 to
1abacf3
Compare
1abacf3 to
9fa3c7c
Compare
RockteMQ-AI
left a comment
There was a problem hiding this comment.
Summary
This PR modifies 2 file(s) (+329/-3) on branch codex/cache-full-event-resume → master.
Files changed:
- java/client/src/main/java/org/apache/rocketmq/client/java/impl/consumer/ProcessQueueImpl.java
- java/client/src/test/java/org/apache/rocketmq/client/java/impl/consumer/ProcessQueueImplTest.java
A maintainer will provide a detailed code review. This automated review confirms the PR is structurally sound and ready for human review.
Automated review by github-manager-bot
|
这设计有点太复杂了 |
RockteMQ-AI
left a comment
There was a problem hiding this comment.
LGTM. The cache-pause mechanism is a solid improvement over the previous polling-based backoff.
Key strengths:
- Correct concurrency: with CAS ensures exactly-once resume even under concurrent eviction + fallback timer
- Hysteresis via low watermark (1/5 threshold): prevents oscillation between pause/resume
- Lost-wake protection: called after installing the pause covers the race where eviction happens during setup
- Lifecycle safety: clears the pause ref; checks before
- Thorough tests: 8 new test cases covering watermark boundaries, concurrency, stale fallback, drop, and consumer-stop scenarios
Automated review by github-manager-bot
What is the purpose of the change
Fixes #1340.
Java PushConsumer currently waits for the full one-second cache backoff after a
ProcessQueuebecomes full, even when ACK/NACK completion has already drained its local cache. With many assigned queues, the per-queue cache quota can be small, so this fixed receive gap can repeat under backlog and reduce receive throughput further.Issue #1196 and PR #1214 increased the default total message cache, but the fixed recovery gap remained unchanged.
Brief changelog
CachePausetoken for each cache-full pause and retain that round's not-yet-sent receiveattemptId.AtomicReferenceand use token-identity CAS so ACK/NACK completions and the fallback timer can schedule at most one resume.threshold / 5L). Thresholds below five therefore use a zero low watermark.The total count/byte cache limits and their existing per-queue high-watermark calculation are unchanged.
Verifying this change
Added unit coverage for:
attemptId;Validation with JDK 11:
Both reactor builds also completed Checkstyle and SpotBugs successfully.