zhangrq5 opened a new issue, #63562:
URL: https://github.com/apache/doris/issues/63562

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Version
   
   3.0.4 (Integrated Storage Compute)
   
   ### What's Wrong?
   
   When executing stream load through the FE HTTP entry 
(LoadAction.executeWithClusterToken), FE intermittently throws 
IllegalArgumentException: Comparison method violates its general contract! from 
SystemInfoService#selectBackendIdsByPolicy, and the stream load request fails 
to be redirected to a BE.
   Stack trace:
   `2026-04-09 00:08:03,223 WARN (qtp1996111320-135187|155) 
[LoadAction.executeWithClusterToken():658] Failed to execute stream load with 
cluster token, Comparison method violates its general contract!
   java.lang.IllegalArgumentException: Comparison method violates its general 
contract!
           at java.util.TimSort.mergeHi(TimSort.java:903) ~[?:?]
           at java.util.TimSort.mergeAt(TimSort.java:520) ~[?:?]
           at java.util.TimSort.mergeCollapse(TimSort.java:448) ~[?:?]
           at java.util.TimSort.sort(TimSort.java:245) ~[?:?]
           at java.util.Arrays.sort(Arrays.java:1307) ~[?:?]
           at java.util.ArrayList.sort(ArrayList.java:1721) ~[?:?]
           at java.util.Collections.sort(Collections.java:179) ~[?:?]
           at 
org.apache.doris.system.SystemInfoService.selectBackendIdsByPolicy(SystemInfoService.java:639)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.httpv2.rest.LoadAction.selectLocalRedirectBackend(LoadAction.java:439)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.httpv2.rest.LoadAction.selectRedirectBackend(LoadAction.java:418)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.httpv2.rest.LoadAction.executeWithClusterToken(LoadAction.java:628)
 ~[doris-fe.jar:1.2-SNAPSHOT]
           at 
org.apache.doris.httpv2.rest.LoadAction.streamLoad(LoadAction.java:141) 
~[doris-fe.jar:1.2-SNAPSHOT]
   `
   
   
   ### What You Expected?
   
   BeIdComparator should return a strictly correct ordering of backend ids 
regardless of their magnitude, and selectBackendIdsByPolicy should not throw 
Comparison method violates its general contract!. Stream load should not fail 
due to this code path.
   
   ### How to Reproduce?
   
   This is hit on a long-running production cluster:
   
   Cluster has been running for more than 1 year, scaled from 200 BEs to 400 
BEs.
   10+ hourly-partitioned tables whose bucket count scales with BE count → 
partitions / tablets roll over very fast → FE metadata ids grow quickly.
   Current BE id range:
   smallest BE id: 1758683807578
   largest BE id: 1773829531020
   diff: 15145723442, far greater than Integer.MAX_VALUE (2147483647)
   So in BeIdComparator#compare:
   `a.id - b.id = 15145723442 (long)
   (int) 15145723442         → wrong sign after truncation`
   
   
   
   ### Anything Else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [x] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to