This is an automated email from the ASF dual-hosted git repository.

gavinchou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 5969221a595 [fix](fe) Fix int overflow in BeIdComparator causing 
stream load failure (#63565)
5969221a595 is described below

commit 5969221a595d2817b0277b679f7c1b21c4cbafe6
Author: rich <[email protected]>
AuthorDate: Wed Jun 3 12:20:40 2026 +0800

    [fix](fe) Fix int overflow in BeIdComparator causing stream load failure 
(#63565)
    
    `(int)(a.getId() - b.getId())` overflows when BE ID delta exceeds
    Integer.MAX_VALUE, breaking the Comparator contract and causing stream
    load to fail with "Comparison method violates its general contract!".
    Use `Long.compare` instead. Same fix applied to CloudSystemInfoService.
---
 .../main/java/org/apache/doris/cloud/system/CloudSystemInfoService.java | 2 +-
 fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/cloud/system/CloudSystemInfoService.java
 
b/fe/fe-core/src/main/java/org/apache/doris/cloud/system/CloudSystemInfoService.java
index 1f3efb647ef..41ff4d87fa2 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/cloud/system/CloudSystemInfoService.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/cloud/system/CloudSystemInfoService.java
@@ -1063,7 +1063,7 @@ public class CloudSystemInfoService extends 
SystemInfoService {
                         .filter(i -> 
i.getTagMap().containsKey(Tag.CLOUD_CLUSTER_NAME))
                         .collect(Collectors.toList());
                 // The larger bakendId the later it was added, the order 
matters
-                toAdd.sort((x, y) -> (int) (x.getId() - y.getId()));
+                toAdd.sort((x, y) -> Long.compare(x.getId(), y.getId()));
                 updateCloudClusterMapNoLock(toAdd, new ArrayList<>());
             }
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java 
b/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java
index 2ef193cb158..5b728267e1b 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java
@@ -478,7 +478,7 @@ public class SystemInfoService {
 
     class BeIdComparator implements Comparator<Backend> {
         public int compare(Backend a, Backend b) {
-            return (int) (a.getId() - b.getId());
+            return Long.compare(a.getId(), b.getId());
         }
     }
 


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

Reply via email to