qianye1001 opened a new pull request, #1341:
URL: https://github.com/apache/rocketmq-clients/pull/1341

   ## What is the purpose of the change
   
   Fixes #1340.
   
   Java PushConsumer currently waits for the full one-second cache backoff 
after a `ProcessQueue` becomes 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
   
   - Add a distinct `CachePause` token for each cache-full pause and retain 
that round's not-yet-sent receive `attemptId`.
   - Store the active pause in an `AtomicReference` and use token-identity CAS 
so ACK/NACK completions and the fallback timer can schedule at most one resume.
   - Resume through the consumer scheduler when both cached message count and 
cached bytes are at or below 20% of their current per-queue thresholds 
(`threshold / 5L`). Thresholds below five therefore use a zero low watermark.
   - Keep the existing one-second task as a liveness fallback.
   - Ignore stale timers from older pause rounds, preventing ABA against a 
newer pause.
   - Stop recovery for dropped queues and stopped consumers.
   
   The total count/byte cache limits and their existing per-queue 
high-watermark calculation are unchanged.
   
   ## Verifying this change
   
   Added unit coverage for:
   
   - exact 20% count and byte low-watermark boundaries;
   - zero low watermark when a threshold is below five;
   - concurrent cache eviction and fallback timer scheduling only one resume;
   - a stale timer not affecting a newer pause;
   - reuse of the paused receive `attemptId`;
   - dropped queues and stopped consumers.
   
   Validation with JDK 11:
   
   ```text
   mvn -pl client -am -DskipITs -DfailIfNoTests=false 
-Dtest=ProcessQueueImplTest test
   Tests run: 19, Failures: 0, Errors: 0, Skipped: 0
   
   mvn -pl test -am -DskipITs -DfailIfNoTests=false 
-Dtest=AttemptIdIntegrationTest test
   Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
   ```
   
   Both reactor builds also completed Checkstyle and SpotBugs successfully.
   


-- 
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]

Reply via email to