diff --git a/fe/fe-core/src/main/java/org/apache/doris/load/GroupCommitManager.java b/fe/fe-core/src/main/java/org/apache/doris/load/GroupCommitManager.java index 3177f96cb86905..3b108ed638aff9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/load/GroupCommitManager.java +++ b/fe/fe-core/src/main/java/org/apache/doris/load/GroupCommitManager.java @@ -328,13 +328,11 @@ private Long getCachedBackend(String cluster, long tableId) { // Another thread gets the same tableId but can not find this tableId. // So another thread needs to get the random backend. Long backendId = tableToBeMap.get(encode(cluster, tableId)); - Backend backend; - if (backendId != null) { - backend = Env.getCurrentSystemInfo().getBackend(backendId); - } else { + if (backendId == null) { return null; } - if (backend.isActive() && !backend.isDecommissioned()) { + Backend backend = Env.getCurrentSystemInfo().getBackend(backendId); + if (backend != null && backend.isActive() && !backend.isDecommissioned()) { return backend.getId(); } else { tableToBeMap.remove(encode(cluster, tableId));