Skip to content

Commit

Permalink
add
Browse files Browse the repository at this point in the history
  • Loading branch information
deardeng committed Dec 31, 2024
1 parent 0f9266b commit 1b06073
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -321,9 +323,11 @@ private void checkDiffNode(Map<String, ClusterPB> remoteClusterIdToPB,

@Override
protected void runAfterCatalogReady() {
checkCloudBackends();
updateCloudMetrics();
checkCloudFes();
synchronized (checkLock) {
checkCloudBackends();
updateCloudMetrics();
checkCloudFes();
}
}

private void checkFeNodesMapValid() {
Expand Down Expand Up @@ -545,4 +549,12 @@ private void updateCloudMetrics() {
MetricRepo.updateClusterBackendAliveTotal(entry.getKey(), entry.getValue(), aliveNum);
}
}

public void checkNow() {
if (Env.getCurrentEnv().isMaster()) {
synchronized (checkLock) {
runAfterCatalogReady();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ public CloudUpgradeMgr getCloudUpgradeMgr() {
return this.upgradeMgr;
}

public CloudClusterChecker getCloudClusterChecker() {
return this.cloudClusterCheck;
}

public String getCloudInstanceId() {
return cloudInstanceId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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());
}
Expand Down

0 comments on commit 1b06073

Please sign in to comment.