DefaultElectPolicy sorted broker candidates by subtracting maxOffset values and casting the long delta to int. Large offset gaps can overflow the comparator result and rank a lower-offset broker first. This replaces subtraction with safe comparator helpers and adds a focused overflow regression test.
Constraint: Preserve existing election order: higher epoch, higher maxOffset, lower electionPriority
Rejected: Keep subtraction comparator | unsafe for long offset deltas greater than Integer.MAX_VALUE
Confidence: high
Scope-risk: narrow
Tested: mvn -q -pl controller -DskipTests=false -Dtest=DefaultElectPolicyTest -Djacoco.skip=true test
Tested: mvn -q -pl controller -DskipTests compile -Dspotbugs.skip=true -Dcheckstyle.skip=true
Tested: mvn -q -DskipTests compile -Dspotbugs.skip=true -Dcheckstyle.skip=true
Not-tested: Full controller suite on local JDK due existing JaCoCo/Hessian module-access failures
Related: #10578
* Use fastjson2 in all modules
* Update test
* Update test
* Update test
* Add serialization compatibility test tool class
* Update RemotingSerializableCompatTest.java
* Update RemotingSerializableCompatTest.java
* Update RemotingSerializableCompatTest.java
* Update BitSet problem
* Update
* Update
* Update test
* Update test
* Update BUILD.bazel
* Update BUILD.bazel
* Update test
* Update BitSet problem
* Add test
* Add compat test
* merge develop
* Update test
* merge develop
* [ISSUE #7493] Introduce a new event NettyEventType.ACTIVE for ChannelEventListener
* introduce a new event NettyEventType.ACTIVE,
* implement channelActive interface for NettyRemotingClient#NettyConnectManageHandler
* add onChannelActive for ChannelEventListener interface.
* Move send heartbeat to onChannelActive
* feat(controller): build metrics framework in controller module
1. build metrics framework in controller module
* feat(controller): record metrics about controller
1. record metrics about controller
* fix(controller): fix after review
1. fix after review
Closes https://github.com/apache/rocketmq/issues/6777
* fix(controller): fix after review
1. fix lack of dependency
Closes https://github.com/apache/rocketmq/issues/6777
* Make configPath unable to update at runtime
* Make configPath unable to update at runtime
* Add ASF header
* Add ASF header
* Pass the check style
* Polish the response code
* Polish the response code
* (fix): logback config path seperator and brokerLogDir default value missing
* (fix): replace / with file.seperator in proxy test logback config
---------
Co-authored-by: Robin Han <robin@Robindendiannao.lan>
* [ISSUE #6414] polish MQClientAPIImpl.getDefaultTopicRouteInfoFromNameServer parameters
* Fix to make Bazel CI pass
Signed-off-by: Li Zhanhui <lizhanhui@gmail.com>
* Fix typo
Signed-off-by: Li Zhanhui <lizhanhui@gmail.com>
---------
Signed-off-by: Li Zhanhui <lizhanhui@gmail.com>
Co-authored-by: Li Zhanhui <lizhanhui@gmail.com>
* feat(controller): concurrent protect ReplicasInfoManager#replicaInfoTable and ReplicasInfoManager#syncStateSetInfoTable
1. concurrent protect ReplicasInfoManager#replicaInfoTable and
ReplicasInfoManager#syncStateSetInfoTable
* docs(controller): make statemachine thread-safe and support timed checking inactive master in each broker-set
1. make statemachine thread-safe
2. support timed checking inactive
master in each broker-set
* fix(controller): Add some logic when visit the BrokerReplicaInfo to avoid NPE
1. Add some logic when visit the BrokerReplicaInfo to avoid NPE
* test(controller): polish some test logic
1. polish some test logic
* fix(controller): Revise back the ControllerConfig#controllerStorePath to avoid the Incompatibility problems
1. Revise back the ControllerConfig#controllerStorePath to avoid the
Incompatibility problems