Files
rocketmq/controller
aias00 0e4ccf1b66 [ISSUE #10578] Fix master election maxOffset comparator overflow
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
2026-07-07 19:37:13 +08:00
..