leizhiyuan opened a new pull request, #11661: URL: https://github.com/apache/rocketmq/pull/11661
### Which Issue(s) This PR Fixes - Fixes #11657 - Part of #11659 ### Brief Description In JRaft mode, `RaftReplicasInfoManager#isBrokerActive` compares `lastUpdateTimestamp` (taken from the leader's clock when the heartbeat is proposed) with the request's `invokeTime`, which was taken from the sender's clock (broker or admin tool). Liveness decisions in `electMaster`, `alterSyncStateSet`, `registerBroker` and `cleanBrokerData` therefore depended on the broker-to-controller clock skew. `JRaftController` now overwrites `invokeTime` with the leader's clock right before the request is appended to the raft log. The value is still carried in the log, so followers and log replay evaluate exactly the same value and the state machine stays deterministic. The DLedger controller does not use `invokeTime` and is unchanged. ### How Did You Test This Change? - New `JRaftControllerTest#testBrokerLivenessShouldNotDependOnRequesterClock`, on a single-node JRaft controller: both brokers' heartbeats are 10s old with a 1s timeout, and broker 2 requests an election with an `invokeTime` 20s in the past. On `develop` the controller answers `CONTROLLER_MASTER_STILL_EXIST` (2011) for the dead master; with this change it answers `CONTROLLER_ELECT_MASTER_FAILED` (2012). - `mvn -pl controller test` (JDK 8): 90 tests, 0 failures, checkstyle passed. -- 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]
