From 1b060730c7bf8cfd614f3ca72b21abd8e2e1cd9a Mon Sep 17 00:00:00 2001 From: deardeng Date: Tue, 31 Dec 2024 19:29:29 +0800 Subject: [PATCH] add --- .../org/apache/doris/nereids/DorisParser.g4 | 2 +- .../cloud/catalog/CloudClusterChecker.java | 18 +++++++++++++++--- .../apache/doris/cloud/catalog/CloudEnv.java | 4 ++++ .../AlterSystemRenameComputeGroupCommand.java | 5 +++-- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 index b5d853b137e7465..4920dd44e0d72b6 100644 --- a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 +++ b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 @@ -221,7 +221,7 @@ supportedAlterStatement dropRollupClause (COMMA dropRollupClause)* #alterTableDropRollup | ALTER TABLE name=multipartIdentifier SET LEFT_PAREN propertyItemList RIGHT_PAREN #alterTableProperties - | ALTER SYSTEM RENAME COMPUTE GROUP name=identifier RENAME newName=identifier #alterSystemRenameComputeGroup + | ALTER SYSTEM RENAME COMPUTE GROUP name=identifier newName=identifier #alterSystemRenameComputeGroup ; supportedDropStatement diff --git a/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudClusterChecker.java b/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudClusterChecker.java index 9468c8acecd0324..b6756fb5cdf361d 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudClusterChecker.java +++ b/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudClusterChecker.java @@ -52,6 +52,8 @@ public class CloudClusterChecker extends MasterDaemon { private CloudSystemInfoService cloudSystemInfoService; + private final Object checkLock = new Object(); + boolean isUpdateCloudUniqueId = false; public CloudClusterChecker(CloudSystemInfoService cloudSystemInfoService) { @@ -321,9 +323,11 @@ private void checkDiffNode(Map remoteClusterIdToPB, @Override protected void runAfterCatalogReady() { - checkCloudBackends(); - updateCloudMetrics(); - checkCloudFes(); + synchronized (checkLock) { + checkCloudBackends(); + updateCloudMetrics(); + checkCloudFes(); + } } private void checkFeNodesMapValid() { @@ -545,4 +549,12 @@ private void updateCloudMetrics() { MetricRepo.updateClusterBackendAliveTotal(entry.getKey(), entry.getValue(), aliveNum); } } + + public void checkNow() { + if (Env.getCurrentEnv().isMaster()) { + synchronized (checkLock) { + runAfterCatalogReady(); + } + } + } } diff --git a/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudEnv.java b/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudEnv.java index 89338c228fc0b62..e5bd175eca9abf9 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudEnv.java +++ b/fe/fe-core/src/main/java/org/apache/doris/cloud/catalog/CloudEnv.java @@ -94,6 +94,10 @@ public CloudUpgradeMgr getCloudUpgradeMgr() { return this.upgradeMgr; } + public CloudClusterChecker getCloudClusterChecker() { + return this.cloudClusterCheck; + } + public String getCloudInstanceId() { return cloudInstanceId; } diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterSystemRenameComputeGroupCommand.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterSystemRenameComputeGroupCommand.java index f3cf22e493a20d6..eff040bb58d62b6 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterSystemRenameComputeGroupCommand.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/AlterSystemRenameComputeGroupCommand.java @@ -18,6 +18,7 @@ package org.apache.doris.nereids.trees.plans.commands; import org.apache.doris.catalog.Env; +import org.apache.doris.cloud.catalog.CloudEnv; import org.apache.doris.cloud.system.CloudSystemInfoService; import org.apache.doris.common.AnalysisException; import org.apache.doris.common.DdlException; @@ -29,9 +30,8 @@ import com.google.common.base.Strings; /** - * Alter Storage Vault command + * Alter System Rename Compute Group */ -@SuppressWarnings("checkstyle:RegexpSingleline") public class AlterSystemRenameComputeGroupCommand extends Command implements ForwardWithSync { private final String originalName; private final String newName; @@ -68,6 +68,7 @@ private void doRun(ConnectContext ctx) throws Exception { ((CloudSystemInfoService) Env.getCurrentSystemInfo()).renameComputeGroup(this.originalName, this.newName); // 2. if 1 not throw exception, refresh cloud cluster // if not do 2, will wait 10s to get new name + ((CloudEnv) Env.getCurrentEnv()).getCloudClusterChecker().checkNow(); } catch (Exception e) { throw new DdlException(e.getMessage()); }