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

   ### Which Issue(s) This PR Fixes
   
   - Fixes #11170
   - Related: #8316, #5862, #5865
   
   ### Brief Description
   
   A transaction send can add a group-to-cluster subscription before the 
producer's first heartbeat registers its channel with the proxy. If the 
transaction heartbeat scan runs in between, it removes the subscription. The 
later producer heartbeat does not rebuild it, so a producer that sends no 
further transaction messages can miss transaction checks.
   
   Retain recently active subscriptions while the group is not yet online:
   
   - Add a monotonic activity timestamp to the existing `ClusterData` entries 
and refresh it on subscription updates and online scans.
   - Skip broker heartbeats immediately when the group is offline, preserving 
the behavior required by #5862.
   - Reclaim offline subscriptions after the existing `channelExpiredTimeout` 
(120 seconds by default). Explicit unsubscription still removes them 
immediately.
   
   `ClusterData` currently has no timestamp. A channel's last-update time is 
unavailable before its first registration, and per-message `TransactionData` 
expiry has a different lifecycle. This change adds no new configuration, map, 
or background task.
   
   ### How Did You Test This Change?
   
   - The delayed-first-heartbeat regression fails against unmodified `develop` 
at `80e1ae55773c2330d2005b86f020ed028f649e94` because the subscription is 
removed.
   - Added six deterministic regression tests covering delayed registration, 
never-registered expiry, repeated subscription updates to the same cluster, 
online activity, replacement, and explicit unsubscription. All six pass with 
the fix; they use no timing sleeps.
   - Ran with Amazon Corretto 11.0.23 and Maven 3.9.8:
   
     ```sh
     mvn -B -pl proxy -am \
       
-Dtest=ClusterTransactionServiceTest,AbstractTransactionServiceTest,TransactionDataManagerTest
 \
       -Dsurefire.failIfNoSpecifiedTests=false test
     ```
   
     Result: **16 passed, 0 failures/errors, 1 skipped**. The skip is the 
existing macOS guard in 
`TransactionDataManagerTest.testWaitTransactionDataClear`. Checkstyle and 
SpotBugs passed.
   
   Validation is at the service/unit-test level; a full broker/client E2E run 
has not been performed for this patch.
   


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