This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 8ef32a790b4 branch-4.0: [fix](cloud) query fails when smooth upgrade
primary BE not alive yet #60317 (#60470)
8ef32a790b4 is described below
commit 8ef32a790b4cd62b14a738a307181d2ea062044c
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Feb 4 17:05:39 2026 +0800
branch-4.0: [fix](cloud) query fails when smooth upgrade primary BE not
alive yet #60317 (#60470)
Cherry-picked from #60317
Co-authored-by: deardeng <[email protected]>
---
.../src/main/java/org/apache/doris/cloud/catalog/CloudReplica.java | 7 ++++++-
.../java/org/apache/doris/cloud/catalog/CloudTabletRebalancer.java | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudReplica.java
b/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudReplica.java
index ea656647c8b..1030f3ef889 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudReplica.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudReplica.java
@@ -571,7 +571,12 @@ public class CloudReplica extends Replica implements
GsonPostProcessable {
secondaryClusterToBackends.remove(cluster);
}
- private void updateClusterToSecondaryBe(String cluster, long beId) {
+ /**
+ * Set secondary BE for the cluster. Used as query fallback when primary
is unavailable.
+ * Also used during smooth upgrade: after migrating primary from old BE to
new BE,
+ * set old BE as secondary so queries can still use old BE until new BE is
alive.
+ */
+ public void updateClusterToSecondaryBe(String cluster, long beId) {
long changeTimestamp = System.currentTimeMillis();
if (LOG.isDebugEnabled()) {
LOG.debug("add to secondary clusterId {}, beId {}, changeTimestamp
{}, replica info {}",
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudTabletRebalancer.java
b/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudTabletRebalancer.java
index 056561b198e..939fd37ad48 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudTabletRebalancer.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudTabletRebalancer.java
@@ -1641,8 +1641,13 @@ public class CloudTabletRebalancer extends MasterDaemon {
if (db.getTableNullable(cloudReplica.getTableId()) == null) {
continue;
}
- // update replica location info
+ // update replica location info: primary -> new BE (dstBe)
cloudReplica.updateClusterToPrimaryBe(clusterId, dstBe);
+ // Set old BE (srcBe) as secondary so queries can fall back to
it when new BE
+ // is not alive yet (e.g. new BE heartbeat not registered).
Otherwise
+ // hashReplicaToBe would exclude both: old BE
(isSmoothUpgradeSrc) and new BE
+ // (not alive), causing COMPUTE_GROUPS_NO_ALIVE_BE.
+ cloudReplica.updateClusterToSecondaryBe(clusterId, srcBe);
UpdateCloudReplicaInfo info = new
UpdateCloudReplicaInfo(cloudReplica.getDbId(),
cloudReplica.getTableId(),
cloudReplica.getPartitionId(), cloudReplica.getIndexId(),
tablet.getId(), cloudReplica.getId(), clusterId,
dstBe);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]