From 020e6b163e8c2756b9a9cbd5c50d906a3edbb9b4 Mon Sep 17 00:00:00 2001 From: deardeng <565620795@qq.com> Date: Mon, 14 Oct 2024 21:52:33 +0800 Subject: [PATCH] [fix](cloud) Fix the error of Cloud forwarding SQL not finding the cluster --- .../org/apache/doris/catalog/TabletInvertedIndex.java | 8 ++++---- .../org/apache/doris/common/proc/ReplicasProcNode.java | 4 ++-- .../main/java/org/apache/doris/qe/MasterOpExecutor.java | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java index 7ea62f5a56e68c..4a421dc7b2b1ef 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/TabletInvertedIndex.java @@ -630,17 +630,17 @@ public void deleteTablet(long tabletId) { public void addReplica(long tabletId, Replica replica) { long stamp = writeLock(); try { - Preconditions.checkState(tabletMetaMap.containsKey(tabletId), - "tablet " + tabletId + " not exists, replica " + replica.getId() - + ", backend " + replica.getBackendIdWithoutException()); // cloud mode, create table not need backendId, represent with -1. long backendId = Config.isCloudMode() ? -1 : replica.getBackendIdWithoutException(); + Preconditions.checkState(tabletMetaMap.containsKey(tabletId), + "tablet " + tabletId + " not exists, replica " + replica.getId() + + ", backend " + backendId); replicaMetaTable.put(tabletId, backendId, replica); replicaToTabletMap.put(replica.getId(), tabletId); backingReplicaMetaTable.put(backendId, tabletId, replica); if (LOG.isDebugEnabled()) { LOG.debug("add replica {} of tablet {} in backend {}", - replica.getId(), tabletId, replica.getBackendIdWithoutException()); + replica.getId(), tabletId, backendId); } } finally { writeUnlock(stamp); diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/proc/ReplicasProcNode.java b/fe/fe-core/src/main/java/org/apache/doris/common/proc/ReplicasProcNode.java index cba5432cc14c80..d7958f75504ede 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/proc/ReplicasProcNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/proc/ReplicasProcNode.java @@ -33,8 +33,8 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; -import java.util.Arrays; import java.util.List; /* @@ -116,7 +116,7 @@ public ProcResult fetchResult() throws AnalysisException { if (Config.enable_query_hit_stats) { queryHits = QueryStatsUtil.getMergedReplicaStats(replica.getId()); } - List replicaInfo = Arrays.asList(String.valueOf(replica.getId()), + List replicaInfo = Lists.newArrayList(String.valueOf(replica.getId()), String.valueOf(replica.getBackendIdWithoutException()), String.valueOf(replica.getVersion()), String.valueOf(replica.getLastSuccessVersion()), diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/MasterOpExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/MasterOpExecutor.java index 1df8dda4e8f196..b83838cdd07a0f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/MasterOpExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/MasterOpExecutor.java @@ -218,7 +218,6 @@ private TMasterOpRequest buildStmtForwardParams() throws AnalysisException { cluster = ctx.getCloudCluster(false); } catch (Exception e) { LOG.warn("failed to get cloud compute group", e); - throw new AnalysisException("failed to get cloud compute group", e); } if (!Strings.isNullOrEmpty(cluster)) { params.setCloudCluster(cluster);