This is an automated email from the ASF dual-hosted git repository.

starocean999 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 4ec1282e629 [Chore] (nereids) remove CancelStmt (#51848)
4ec1282e629 is described below

commit 4ec1282e62917733b2675cda45475afe452e7d0e
Author: yaoxiao <[email protected]>
AuthorDate: Tue Jun 24 16:00:12 2025 +0800

    [Chore] (nereids) remove CancelStmt (#51848)
---
 fe/fe-core/src/main/cup/sql_parser.cup             |  20 ----
 .../java/org/apache/doris/alter/AlterHandler.java  |   6 --
 .../doris/alter/MaterializedViewHandler.java       |  59 -----------
 .../apache/doris/alter/SchemaChangeHandler.java    | 115 --------------------
 .../java/org/apache/doris/alter/SystemHandler.java |  53 ----------
 .../doris/analysis/CancelAlterSystemStmt.java      |  98 -----------------
 .../doris/analysis/CancelAlterTableStmt.java       | 116 ---------------------
 .../apache/doris/analysis/CancelBackupStmt.java    |  90 ----------------
 .../org/apache/doris/backup/BackupHandler.java     |  21 ----
 .../main/java/org/apache/doris/catalog/Env.java    |  27 -----
 .../main/java/org/apache/doris/qe/DdlExecutor.java |  14 +--
 .../org/apache/doris/alter/BatchRollupJobTest.java |  69 ------------
 .../org/apache/doris/alter/IndexChangeJobTest.java |  20 ----
 .../apache/doris/analysis/CancelAlterStmtTest.java | 100 ------------------
 .../org/apache/doris/backup/BackupHandlerTest.java |   6 +-
 .../doris/clone/TabletRepairAndBalanceTest.java    |   8 +-
 16 files changed, 5 insertions(+), 817 deletions(-)

diff --git a/fe/fe-core/src/main/cup/sql_parser.cup 
b/fe/fe-core/src/main/cup/sql_parser.cup
index 932a04cf914..b16b970f2ee 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -4113,26 +4113,6 @@ cancel_param ::=
     {:
         RESULT = new CancelExportStmt(db, parser.where);
     :}
-    | KW_ALTER KW_TABLE opt_alter_type:type KW_FROM table_name:table 
job_id_list:list
-    {:
-        RESULT = new CancelAlterTableStmt(type, table, list);
-    :}
-    | KW_BUILD KW_INDEX KW_ON table_name:table job_id_list:list
-    {:
-        RESULT = new CancelAlterTableStmt(ShowAlterStmt.AlterType.INDEX, 
table, list);
-    :}
-    | KW_DECOMMISSION KW_BACKEND string_list:hostPorts
-    {:
-        RESULT = new CancelAlterSystemStmt(hostPorts);
-    :}
-    | KW_BACKUP opt_db:db
-    {:
-        RESULT = new CancelBackupStmt(db, false);
-    :}
-    | KW_RESTORE opt_db:db
-    {:
-        RESULT = new CancelBackupStmt(db, true);
-    :}
     ;
 
 opt_detailed ::=
diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/AlterHandler.java 
b/fe/fe-core/src/main/java/org/apache/doris/alter/AlterHandler.java
index b2e0ce0dcf9..a938640baa6 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/AlterHandler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/AlterHandler.java
@@ -18,7 +18,6 @@
 package org.apache.doris.alter;
 
 import org.apache.doris.analysis.AlterClause;
-import org.apache.doris.analysis.CancelStmt;
 import org.apache.doris.catalog.Database;
 import org.apache.doris.catalog.Env;
 import org.apache.doris.catalog.MaterializedIndex;
@@ -202,11 +201,6 @@ public abstract class AlterHandler extends MasterDaemon {
     public void processExternalTable(List<AlterClause> alterClauses, Database 
db, Table externalTable)
             throws UserException {}
 
-    /*
-     * cancel alter ops
-     */
-    public abstract void cancel(CancelStmt stmt) throws DdlException;
-
     /*
      * Handle the finish report of alter task.
      * If task is success, which means the history data before specified 
version has been transformed successfully.
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java 
b/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java
index 7ed80495313..3667dce820c 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/alter/MaterializedViewHandler.java
@@ -19,8 +19,6 @@ package org.apache.doris.alter;
 
 import org.apache.doris.analysis.AddRollupClause;
 import org.apache.doris.analysis.AlterClause;
-import org.apache.doris.analysis.CancelAlterTableStmt;
-import org.apache.doris.analysis.CancelStmt;
 import org.apache.doris.analysis.CastExpr;
 import org.apache.doris.analysis.CreateMaterializedViewStmt;
 import org.apache.doris.analysis.DropMaterializedViewStmt;
@@ -1583,63 +1581,6 @@ public class MaterializedViewHandler extends 
AlterHandler {
         // TODO: convert alterClauses to alterSystemCommands for mv
     }
 
-    @Override
-    public void cancel(CancelStmt stmt) throws DdlException {
-        CancelAlterTableStmt cancelAlterTableStmt = (CancelAlterTableStmt) 
stmt;
-
-        String dbName = cancelAlterTableStmt.getDbName();
-        String tableName = cancelAlterTableStmt.getTableName();
-        Preconditions.checkState(!Strings.isNullOrEmpty(dbName));
-        Preconditions.checkState(!Strings.isNullOrEmpty(tableName));
-
-        Database db = 
Env.getCurrentInternalCatalog().getDbOrDdlException(dbName);
-
-        List<AlterJobV2> rollupJobV2List = new ArrayList<>();
-        OlapTable olapTable;
-        try {
-            olapTable = (OlapTable) db.getTableOrMetaException(tableName, 
Table.TableType.OLAP);
-        } catch (MetaNotFoundException e) {
-            throw new DdlException(e.getMessage());
-        }
-        olapTable.writeLock();
-        try {
-            if (olapTable.getState() != OlapTableState.ROLLUP
-                    && olapTable.getState() != OlapTableState.WAITING_STABLE) {
-                throw new DdlException("Table[" + tableName + "] is not under 
ROLLUP. "
-                        + "Use 'ALTER TABLE DROP ROLLUP' if you want to.");
-            }
-
-            // find from new alter jobs first
-            if (cancelAlterTableStmt.getAlterJobIdList() != null) {
-                for (Long jobId : cancelAlterTableStmt.getAlterJobIdList()) {
-                    AlterJobV2 alterJobV2 = 
getUnfinishedAlterJobV2ByJobId(jobId);
-                    if (alterJobV2 == null) {
-                        continue;
-                    }
-                    rollupJobV2List.add(getUnfinishedAlterJobV2ByJobId(jobId));
-                }
-            } else {
-                rollupJobV2List = 
getUnfinishedAlterJobV2ByTableId(olapTable.getId());
-            }
-            if (rollupJobV2List.size() == 0) {
-                // Alter job v1 is not supported, delete related code
-                throw new DdlException("Table[" + tableName + "] is not under 
ROLLUP. Maybe it has old alter job");
-            }
-        } finally {
-            olapTable.writeUnlock();
-        }
-
-        // alter job v2's cancel must be called outside the table lock
-        if (rollupJobV2List.size() != 0) {
-            for (AlterJobV2 alterJobV2 : rollupJobV2List) {
-                alterJobV2.cancel("user cancelled");
-                if (alterJobV2.isDone()) {
-                    onJobDone(alterJobV2);
-                }
-            }
-        }
-    }
-
     // just for ut
     public Map<Long, Set<Long>> getTableRunningJobMap() {
         return tableRunningJobMap;
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java 
b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
index 220095b36cb..c9fca5724e2 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/SchemaChangeHandler.java
@@ -21,8 +21,6 @@ import org.apache.doris.analysis.AddColumnClause;
 import org.apache.doris.analysis.AddColumnsClause;
 import org.apache.doris.analysis.AlterClause;
 import org.apache.doris.analysis.BuildIndexClause;
-import org.apache.doris.analysis.CancelAlterTableStmt;
-import org.apache.doris.analysis.CancelStmt;
 import org.apache.doris.analysis.ColumnPosition;
 import org.apache.doris.analysis.CreateIndexClause;
 import org.apache.doris.analysis.DropColumnClause;
@@ -32,7 +30,6 @@ import org.apache.doris.analysis.IndexDef;
 import org.apache.doris.analysis.ModifyColumnClause;
 import org.apache.doris.analysis.ModifyTablePropertiesClause;
 import org.apache.doris.analysis.ReorderColumnsClause;
-import org.apache.doris.analysis.ShowAlterStmt.AlterType;
 import org.apache.doris.analysis.SlotRef;
 import org.apache.doris.catalog.AggregateType;
 import org.apache.doris.catalog.BinlogConfig;
@@ -2592,16 +2589,6 @@ public class SchemaChangeHandler extends AlterHandler {
         cancelColumnJob(command);
     }
 
-    @Override
-    public void cancel(CancelStmt stmt) throws DdlException {
-        CancelAlterTableStmt cancelAlterTableStmt = (CancelAlterTableStmt) 
stmt;
-        if (cancelAlterTableStmt.getAlterType() == AlterType.INDEX) {
-            cancelIndexJob(cancelAlterTableStmt);
-        } else {
-            cancelColumnJob(cancelAlterTableStmt);
-        }
-    }
-
     private void cancelColumnJob(CancelAlterTableCommand command) throws 
DdlException {
         String dbName = command.getDbName();
         String tableName = command.getTableName();
@@ -2640,45 +2627,6 @@ public class SchemaChangeHandler extends AlterHandler {
         }
     }
 
-    private void cancelColumnJob(CancelAlterTableStmt cancelAlterTableStmt) 
throws DdlException {
-        String dbName = cancelAlterTableStmt.getDbName();
-        String tableName = cancelAlterTableStmt.getTableName();
-        Preconditions.checkState(!Strings.isNullOrEmpty(dbName));
-        Preconditions.checkState(!Strings.isNullOrEmpty(tableName));
-
-        Database db = 
Env.getCurrentInternalCatalog().getDbOrDdlException(dbName);
-        AlterJobV2 schemaChangeJobV2 = null;
-
-        OlapTable olapTable = db.getOlapTableOrDdlException(tableName);
-        olapTable.writeLockOrDdlException();
-        try {
-            if (olapTable.getState() != OlapTableState.SCHEMA_CHANGE
-                    && olapTable.getState() != OlapTableState.WAITING_STABLE) {
-                throw new DdlException("Table[" + tableName + "] is not under 
SCHEMA_CHANGE.");
-            }
-
-            // find from new alter jobs first
-            List<AlterJobV2> schemaChangeJobV2List = 
getUnfinishedAlterJobV2ByTableId(olapTable.getId());
-            // current schemaChangeJob job doesn't support batch operation,so 
just need to get one job
-            schemaChangeJobV2 = schemaChangeJobV2List.size() == 0 ? null
-                    : Iterables.getOnlyElement(schemaChangeJobV2List);
-            if (schemaChangeJobV2 == null) {
-                throw new DdlException(
-                        "Table[" + tableName + "] is under schema change 
state" + " but could not find related job");
-            }
-        } finally {
-            olapTable.writeUnlock();
-        }
-
-        // alter job v2's cancel must be called outside the database lock
-        if (schemaChangeJobV2 != null) {
-            if (!schemaChangeJobV2.cancel("user cancelled")) {
-                throw new DdlException("Job can not be cancelled. State: " + 
schemaChangeJobV2.getJobState());
-            }
-            return;
-        }
-    }
-
     public void cancelIndexJob(CancelBuildIndexCommand command) throws 
DdlException {
         String dbName = command.getDbName();
         String tableName = command.getTableName();
@@ -2738,69 +2686,6 @@ public class SchemaChangeHandler extends AlterHandler {
         }
     }
 
-    private void cancelIndexJob(CancelAlterTableStmt cancelAlterTableStmt) 
throws DdlException {
-        String dbName = cancelAlterTableStmt.getDbName();
-        String tableName = cancelAlterTableStmt.getTableName();
-        Preconditions.checkState(!Strings.isNullOrEmpty(dbName));
-        Preconditions.checkState(!Strings.isNullOrEmpty(tableName));
-
-        Database db = 
Env.getCurrentInternalCatalog().getDbOrDdlException(dbName);
-
-        List<IndexChangeJob> jobList = new ArrayList<>();
-
-        Table olapTable = db.getTableOrDdlException(tableName, 
Table.TableType.OLAP);
-        olapTable.writeLock();
-        try {
-            // find from index change jobs first
-            if (cancelAlterTableStmt.getAlterJobIdList() != null
-                    && cancelAlterTableStmt.getAlterJobIdList().size() > 0) {
-                for (Long jobId : cancelAlterTableStmt.getAlterJobIdList()) {
-                    IndexChangeJob job = indexChangeJobs.get(jobId);
-                    if (job == null) {
-                        continue;
-                    }
-                    jobList.add(job);
-                    if (LOG.isDebugEnabled()) {
-                        LOG.debug("add build index job {} on table {} for 
specific id", jobId, tableName);
-                    }
-                }
-            } else {
-                for (IndexChangeJob job : indexChangeJobs.values()) {
-                    if (!job.isDone() && job.getTableId() == 
olapTable.getId()) {
-                        jobList.add(job);
-                        if (LOG.isDebugEnabled()) {
-                            LOG.debug("add build index job {} on table {} for 
all", job.getJobId(), tableName);
-                        }
-                    }
-                }
-            }
-        } finally {
-            olapTable.writeUnlock();
-        }
-
-        // if this table has ngram_bf index, we must run cancel for schema 
change job
-        boolean hasNGramBFIndex = ((OlapTable) 
olapTable).hasIndexOfType(IndexDef.IndexType.NGRAM_BF);
-        // alter job v2's cancel must be called outside the table lock
-        if (jobList.size() > 0) {
-            for (IndexChangeJob job : jobList) {
-                long jobId = job.getJobId();
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("cancel build index job {} on table {}", jobId, 
tableName);
-                }
-                if (!job.cancel("user cancelled")) {
-                    LOG.warn("cancel build index job {} on table {} failed", 
jobId, tableName);
-                    throw new DdlException("Job can not be cancelled. State: " 
+ job.getJobState());
-                } else {
-                    LOG.info("cancel build index job {} on table {} success", 
jobId, tableName);
-                }
-            }
-        } else if (hasNGramBFIndex) {
-            cancelColumnJob(cancelAlterTableStmt);
-        } else {
-            throw new DdlException("No job to cancel for Table[" + tableName + 
"]");
-        }
-    }
-
     /**
      * Returns true if the index already exists, there is no need to create 
the job to add the index.
      * Otherwise, return false, there is need to create a job to add the index.
diff --git a/fe/fe-core/src/main/java/org/apache/doris/alter/SystemHandler.java 
b/fe/fe-core/src/main/java/org/apache/doris/alter/SystemHandler.java
index 324cf906a22..0daacffea49 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/alter/SystemHandler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/alter/SystemHandler.java
@@ -21,8 +21,6 @@ import org.apache.doris.analysis.AddBackendClause;
 import org.apache.doris.analysis.AddFollowerClause;
 import org.apache.doris.analysis.AddObserverClause;
 import org.apache.doris.analysis.AlterClause;
-import org.apache.doris.analysis.CancelAlterSystemStmt;
-import org.apache.doris.analysis.CancelStmt;
 import org.apache.doris.analysis.DecommissionBackendClause;
 import org.apache.doris.analysis.DropBackendClause;
 import org.apache.doris.analysis.DropFollowerClause;
@@ -642,55 +640,4 @@ public class SystemHandler extends AlterHandler {
             }
         }
     }
-
-    @Override
-    public synchronized void cancel(CancelStmt stmt) throws DdlException {
-        CancelAlterSystemStmt cancelAlterSystemStmt = (CancelAlterSystemStmt) 
stmt;
-        SystemInfoService infoService = Env.getCurrentSystemInfo();
-        // check if backends is under decommission
-        List<HostInfo> hostInfos = cancelAlterSystemStmt.getHostInfos();
-        if (hostInfos.isEmpty()) {
-            List<String> ids = cancelAlterSystemStmt.getIds();
-            for (String id : ids) {
-                Backend backend = infoService.getBackend(Long.parseLong(id));
-                if (backend == null) {
-                    throw new DdlException("Backend does not exist["
-                            + id + "]");
-                }
-                if (!backend.isDecommissioned()) {
-                    // it's ok. just log
-                    LOG.info("backend is not decommissioned[{}]", 
backend.getId());
-                    continue;
-                }
-                if (backend.setDecommissioned(false)) {
-                    
Env.getCurrentEnv().getEditLog().logBackendStateChange(backend);
-                } else {
-                    LOG.info("backend is not decommissioned[{}]", 
backend.getHost());
-                }
-            }
-
-        } else {
-            for (HostInfo hostInfo : hostInfos) {
-                // check if exist
-                Backend backend = 
infoService.getBackendWithHeartbeatPort(hostInfo.getHost(),
-                        hostInfo.getPort());
-                if (backend == null) {
-                    throw new DdlException("Backend does not exist["
-                            + 
NetUtils.getHostPortInAccessibleFormat(hostInfo.getHost(), hostInfo.getPort()) 
+ "]");
-                }
-
-                if (!backend.isDecommissioned()) {
-                    // it's ok. just log
-                    LOG.info("backend is not decommissioned[{}]", 
backend.getId());
-                    continue;
-                }
-
-                if (backend.setDecommissioned(false)) {
-                    
Env.getCurrentEnv().getEditLog().logBackendStateChange(backend);
-                } else {
-                    LOG.info("backend is not decommissioned[{}]", 
backend.getHost());
-                }
-            }
-        }
-    }
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelAlterSystemStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelAlterSystemStmt.java
deleted file mode 100644
index 1895549140c..00000000000
--- 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelAlterSystemStmt.java
+++ /dev/null
@@ -1,98 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.analysis;
-
-import org.apache.doris.catalog.Env;
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.ErrorCode;
-import org.apache.doris.common.ErrorReport;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-import org.apache.doris.system.SystemInfoService;
-import org.apache.doris.system.SystemInfoService.HostInfo;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
-import lombok.Getter;
-
-import java.util.List;
-
-public class CancelAlterSystemStmt extends CancelStmt implements 
NotFallbackInParser {
-
-    protected List<String> params;
-    @Getter
-    private final List<HostInfo> hostInfos;
-
-    @Getter
-    private final List<String> ids;
-
-    public CancelAlterSystemStmt(List<String> params) {
-        this.params = params;
-        this.hostInfos = Lists.newArrayList();
-        this.ids = Lists.newArrayList();
-    }
-
-    @Override
-    public void analyze(Analyzer analyzer) throws AnalysisException {
-        if 
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(), 
PrivPredicate.OPERATOR)) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
-                    PrivPredicate.OPERATOR.getPrivs().toString());
-        }
-        for (String param : params) {
-            if (!param.contains(":")) {
-                ids.add(param);
-            } else {
-                HostInfo hostInfo = SystemInfoService.getHostAndPort(param);
-                this.hostInfos.add(hostInfo);
-            }
-
-        }
-        Preconditions.checkState(!this.hostInfos.isEmpty() || 
!this.ids.isEmpty(),
-                "hostInfos or ids can not be empty");
-
-    }
-
-    @Override
-    public String toSql() {
-        StringBuilder sb = new StringBuilder();
-        sb.append("CANCEL DECOMMISSION BACKEND ");
-        if (!ids.isEmpty()) {
-            for (int i = 0; i < hostInfos.size(); i++) {
-                sb.append("\"").append(hostInfos.get(i)).append("\"");
-                if (i != hostInfos.size() - 1) {
-                    sb.append(", ");
-                }
-            }
-        } else {
-            for (int i = 0; i < params.size(); i++) {
-                sb.append("\"").append(params.get(i)).append("\"");
-                if (i != params.size() - 1) {
-                    sb.append(", ");
-                }
-            }
-        }
-
-
-        return sb.toString();
-    }
-
-    @Override
-    public StmtType stmtType() {
-        return StmtType.CANCEL;
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelAlterTableStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelAlterTableStmt.java
deleted file mode 100644
index 9ef73f792cf..00000000000
--- 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelAlterTableStmt.java
+++ /dev/null
@@ -1,116 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.analysis;
-
-import org.apache.doris.analysis.ShowAlterStmt.AlterType;
-import org.apache.doris.catalog.Env;
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.ErrorCode;
-import org.apache.doris.common.ErrorReport;
-import org.apache.doris.common.FeConstants;
-import org.apache.doris.common.util.Util;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-import org.apache.commons.collections.CollectionUtils;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/*
- * CANCEL ALTER COLUMN|ROLLUP FROM db_name.table_name
- */
-public class CancelAlterTableStmt extends CancelStmt implements 
NotFallbackInParser {
-
-    private AlterType alterType;
-
-    private TableName dbTableName;
-
-    public AlterType getAlterType() {
-        return alterType;
-    }
-
-    public String getDbName() {
-        return dbTableName.getDb();
-    }
-
-    public String getTableName() {
-        return dbTableName.getTbl();
-    }
-
-    private List<Long> alterJobIdList;
-
-    public CancelAlterTableStmt(AlterType alterType, TableName dbTableName) {
-        this(alterType, dbTableName, null);
-    }
-
-    public CancelAlterTableStmt(AlterType alterType, TableName dbTableName, 
List<Long> alterJobIdList) {
-        this.alterType = alterType;
-        this.dbTableName = dbTableName;
-        this.alterJobIdList = alterJobIdList;
-    }
-
-    public List<Long> getAlterJobIdList() {
-        return alterJobIdList;
-    }
-
-    @Override
-    public void analyze(Analyzer analyzer) throws AnalysisException {
-        dbTableName.analyze(analyzer);
-        // disallow external catalog
-        Util.prohibitExternalCatalog(dbTableName.getCtl(), 
this.getClass().getSimpleName());
-
-        if (FeConstants.runningUnitTest) {
-            return;
-        }
-        // check access
-        if (!Env.getCurrentEnv().getAccessManager()
-                .checkTblPriv(ConnectContext.get(), dbTableName.getCtl(), 
dbTableName.getDb(),
-                        dbTableName.getTbl(),
-                        PrivPredicate.ALTER)) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_TABLEACCESS_DENIED_ERROR, 
"CANCEL ALTER TABLE",
-                    ConnectContext.get().getQualifiedUser(),
-                    ConnectContext.get().getRemoteIP(),
-                    dbTableName.getDb() + ": " + dbTableName.getTbl());
-        }
-    }
-
-    @Override
-    public String toSql() {
-        StringBuilder stringBuilder = new StringBuilder();
-        stringBuilder.append("CANCEL ALTER " + this.alterType);
-        stringBuilder.append(" FROM " + dbTableName.toSql());
-        if (!CollectionUtils.isEmpty(alterJobIdList)) {
-            stringBuilder.append(" (").append(String.join(",", 
alterJobIdList.stream()
-                    .map(String::valueOf).collect(Collectors.toList())));
-            stringBuilder.append(")");
-        }
-        return stringBuilder.toString();
-    }
-
-    @Override
-    public String toString() {
-        return toSql();
-    }
-
-    @Override
-    public StmtType stmtType() {
-        return StmtType.CANCEL;
-    }
-
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelBackupStmt.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelBackupStmt.java
deleted file mode 100644
index 06c1d09972c..00000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/CancelBackupStmt.java
+++ /dev/null
@@ -1,90 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.analysis;
-
-import org.apache.doris.catalog.Env;
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.ErrorCode;
-import org.apache.doris.common.ErrorReport;
-import org.apache.doris.common.UserException;
-import org.apache.doris.datasource.InternalCatalog;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-import com.google.common.base.Strings;
-
-public class CancelBackupStmt extends CancelStmt implements 
NotFallbackInParser {
-
-    private String dbName;
-    private boolean isRestore;
-
-    public CancelBackupStmt(String dbName, boolean isRestore) {
-        this.dbName = dbName;
-        this.isRestore = isRestore;
-    }
-
-    public String getDbName() {
-        return dbName;
-    }
-
-    public boolean isRestore() {
-        return isRestore;
-    }
-
-    @Override
-    public void analyze(Analyzer analyzer) throws UserException {
-        super.analyze(analyzer);
-        if (Strings.isNullOrEmpty(dbName)) {
-            dbName = analyzer.getDefaultDb();
-            if (Strings.isNullOrEmpty(dbName)) {
-                throw new AnalysisException("No database selected");
-            }
-        }
-
-        // check auth
-        if (!Env.getCurrentEnv().getAccessManager()
-                .checkDbPriv(ConnectContext.get(), 
InternalCatalog.INTERNAL_CATALOG_NAME, dbName, PrivPredicate.LOAD)) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR, 
"LOAD");
-        }
-    }
-
-    @Override
-    public String toSql() {
-        StringBuilder builder = new StringBuilder();
-        builder.append("CANCEL");
-        if (isRestore) {
-            builder.append(" RESTORE");
-        } else {
-            builder.append(" BACKUP");
-        }
-        if (dbName != null) {
-            builder.append(" FROM `").append(dbName).append("`");
-        }
-        return builder.toString();
-    }
-
-    @Override
-    public String toString() {
-        return toSql();
-    }
-
-    @Override
-    public StmtType stmtType() {
-        return StmtType.CANCEL;
-    }
-}
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java 
b/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java
index 46b8daea41b..941c1cd0be1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/backup/BackupHandler.java
@@ -21,7 +21,6 @@ import org.apache.doris.analysis.AbstractBackupStmt;
 import org.apache.doris.analysis.AbstractBackupTableRefClause;
 import org.apache.doris.analysis.BackupStmt;
 import org.apache.doris.analysis.BackupStmt.BackupType;
-import org.apache.doris.analysis.CancelBackupStmt;
 import org.apache.doris.analysis.CreateRepositoryStmt;
 import org.apache.doris.analysis.DropRepositoryStmt;
 import org.apache.doris.analysis.PartitionNames;
@@ -1042,26 +1041,6 @@ public class BackupHandler extends MasterDaemon 
implements Writable {
         LOG.info("finished to cancel {} job: {}", (command.isRestore() ? 
"restore" : "backup"), job);
     }
 
-    public void cancel(CancelBackupStmt stmt) throws DdlException {
-        String dbName = stmt.getDbName();
-        Database db = env.getInternalCatalog().getDbOrDdlException(dbName);
-
-        AbstractJob job = getCurrentJob(db.getId());
-        if (job == null || (job instanceof BackupJob && stmt.isRestore())
-                || (job instanceof RestoreJob && !stmt.isRestore())) {
-            ErrorReport.reportDdlException(ErrorCode.ERR_COMMON_ERROR, "No "
-                    + (stmt.isRestore() ? "restore" : "backup" + " job")
-                    + " is currently running");
-        }
-
-        Status status = job.cancel();
-        if (!status.ok()) {
-            ErrorReport.reportDdlException(ErrorCode.ERR_COMMON_ERROR, "Failed 
to cancel job: " + status.getErrMsg());
-        }
-
-        LOG.info("finished to cancel {} job: {}", (stmt.isRestore() ? 
"restore" : "backup"), job);
-    }
-
     public boolean handleFinishedSnapshotTask(SnapshotTask task, 
TFinishTaskRequest request) {
         AbstractJob job = getCurrentJob(task.getDbId());
         if (job == null) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
index 235cb030861..7a56708c101 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
@@ -35,9 +35,6 @@ import org.apache.doris.analysis.AlterMultiPartitionClause;
 import org.apache.doris.analysis.AlterTableStmt;
 import org.apache.doris.analysis.AlterViewStmt;
 import org.apache.doris.analysis.BackupStmt;
-import org.apache.doris.analysis.CancelAlterSystemStmt;
-import org.apache.doris.analysis.CancelAlterTableStmt;
-import org.apache.doris.analysis.CancelBackupStmt;
 import org.apache.doris.analysis.ColumnRenameClause;
 import org.apache.doris.analysis.CreateDbStmt;
 import org.apache.doris.analysis.CreateFunctionStmt;
@@ -65,7 +62,6 @@ import org.apache.doris.analysis.ReplacePartitionClause;
 import org.apache.doris.analysis.RestoreStmt;
 import org.apache.doris.analysis.RollupRenameClause;
 import org.apache.doris.analysis.SetType;
-import org.apache.doris.analysis.ShowAlterStmt.AlterType;
 import org.apache.doris.analysis.SlotRef;
 import org.apache.doris.analysis.TableRenameClause;
 import org.apache.doris.analysis.TruncateTableStmt;
@@ -4994,21 +4990,6 @@ public class Env {
         this.getSchemaChangeHandler().cancelIndexJob(command);
     }
 
-    /*
-     * used for handling CancelAlterStmt (for client is the CANCEL ALTER
-     * command). including SchemaChangeHandler and RollupHandler
-     */
-    public void cancelAlter(CancelAlterTableStmt stmt) throws DdlException {
-        if (stmt.getAlterType() == AlterType.ROLLUP) {
-            this.getMaterializedViewHandler().cancel(stmt);
-        } else if (stmt.getAlterType() == AlterType.COLUMN
-                       || stmt.getAlterType() == AlterType.INDEX) {
-            this.getSchemaChangeHandler().cancel(stmt);
-        } else {
-            throw new DdlException("Cancel " + stmt.getAlterType() + " does 
not implement yet");
-        }
-    }
-
     /*
      * used for handling backup opt
      */
@@ -5024,10 +5005,6 @@ public class Env {
         getBackupHandler().cancel(command);
     }
 
-    public void cancelBackup(CancelBackupStmt stmt) throws DdlException {
-        getBackupHandler().cancel(stmt);
-    }
-
     public void renameTable(Database db, Table table, TableRenameClause 
tableRenameClause) throws DdlException {
         renameTable(db, table, tableRenameClause.getNewTableName());
     }
@@ -5862,10 +5839,6 @@ public class Env {
         this.analysisManager.createAnalyze(command, isProxy);
     }
 
-    public void cancelAlterSystem(CancelAlterSystemStmt stmt) throws 
DdlException {
-        this.alter.getSystemHandler().cancel(stmt);
-    }
-
     // Switch catalog of this session
     public void changeCatalog(ConnectContext ctx, String catalogName) throws 
DdlException {
         CatalogIf catalogIf = catalogMgr.getCatalog(catalogName);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/DdlExecutor.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/DdlExecutor.java
index 9f675bb704e..b2989137bd9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/DdlExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/DdlExecutor.java
@@ -38,9 +38,6 @@ import org.apache.doris.analysis.AlterViewStmt;
 import org.apache.doris.analysis.AlterWorkloadGroupStmt;
 import org.apache.doris.analysis.AlterWorkloadSchedPolicyStmt;
 import org.apache.doris.analysis.BackupStmt;
-import org.apache.doris.analysis.CancelAlterSystemStmt;
-import org.apache.doris.analysis.CancelAlterTableStmt;
-import org.apache.doris.analysis.CancelBackupStmt;
 import org.apache.doris.analysis.CancelExportStmt;
 import org.apache.doris.analysis.CancelJobTaskStmt;
 import org.apache.doris.analysis.CancelLoadStmt;
@@ -154,8 +151,6 @@ public class DdlExecutor {
             env.alterTable((AlterTableStmt) ddlStmt);
         } else if (ddlStmt instanceof AlterViewStmt) {
             env.alterView((AlterViewStmt) ddlStmt);
-        } else if (ddlStmt instanceof CancelAlterTableStmt) {
-            env.cancelAlter((CancelAlterTableStmt) ddlStmt);
         } else if (ddlStmt instanceof CancelExportStmt) {
             env.getExportMgr().cancelExportJob((CancelExportStmt) ddlStmt);
         } else if (ddlStmt instanceof CancelLoadStmt) {
@@ -210,9 +205,6 @@ public class DdlExecutor {
             env.getAuth().dropRole((DropRoleStmt) ddlStmt);
         } else if (ddlStmt instanceof SetUserPropertyStmt) {
             env.getAuth().updateUserProperty((SetUserPropertyStmt) ddlStmt);
-        } else if (ddlStmt instanceof CancelAlterSystemStmt) {
-            CancelAlterSystemStmt stmt = (CancelAlterSystemStmt) ddlStmt;
-            env.cancelAlterSystem(stmt);
         } else if (ddlStmt instanceof AlterDatabaseQuotaStmt) {
             env.alterDatabaseQuota((AlterDatabaseQuotaStmt) ddlStmt);
         } else if (ddlStmt instanceof AlterDatabaseRename) {
@@ -229,8 +221,6 @@ public class DdlExecutor {
             env.backup((BackupStmt) ddlStmt);
         } else if (ddlStmt instanceof RestoreStmt) {
             env.restore((RestoreStmt) ddlStmt);
-        } else if (ddlStmt instanceof CancelBackupStmt) {
-            env.cancelBackup((CancelBackupStmt) ddlStmt);
         } else if (ddlStmt instanceof CreateRepositoryStmt) {
             env.getBackupHandler().createRepository((CreateRepositoryStmt) 
ddlStmt);
         } else if (ddlStmt instanceof DropRepositoryStmt) {
@@ -423,12 +413,10 @@ public class DdlExecutor {
 
         if (ddlStmt instanceof BackupStmt
                 || ddlStmt instanceof RestoreStmt
-                || ddlStmt instanceof CancelBackupStmt
                 || ddlStmt instanceof CreateRepositoryStmt
                 || ddlStmt instanceof DropRepositoryStmt
                 || ddlStmt instanceof AlterResourceStmt
-                || ddlStmt instanceof AlterPolicyStmt
-                || ddlStmt instanceof CancelAlterSystemStmt) {
+                || ddlStmt instanceof AlterPolicyStmt) {
             LOG.info("stmt={}, not supported in cloud mode", 
ddlStmt.toString());
             throw new DdlException("Unsupported operation");
         }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/alter/BatchRollupJobTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/alter/BatchRollupJobTest.java
index c2112d93afa..7a0c9cc426e 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/alter/BatchRollupJobTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/alter/BatchRollupJobTest.java
@@ -18,7 +18,6 @@
 package org.apache.doris.alter;
 
 import org.apache.doris.analysis.AlterTableStmt;
-import org.apache.doris.analysis.CancelAlterTableStmt;
 import org.apache.doris.analysis.CreateDbStmt;
 import org.apache.doris.analysis.CreateTableStmt;
 import org.apache.doris.catalog.Database;
@@ -30,14 +29,11 @@ import org.apache.doris.catalog.Partition;
 import org.apache.doris.qe.ConnectContext;
 import org.apache.doris.utframe.UtFrameUtils;
 
-import com.google.common.base.Joiner;
-import com.google.common.collect.Lists;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
@@ -113,69 +109,4 @@ public class BatchRollupJobTest {
             Assert.assertEquals(4, 
partition.getMaterializedIndices(IndexExtState.VISIBLE).size());
         }
     }
-
-    @Test
-    public void testCancelBatchRollup() throws Exception {
-        // create table tbl2
-        String createTblStmtStr1 = "create table db1.tbl2(k1 int, k2 int, k3 
int) distributed by hash(k1) buckets 3 properties('replication_num' = '1');";
-        CreateTableStmt createTableStmt = (CreateTableStmt) 
UtFrameUtils.parseAndAnalyzeStmt(createTblStmtStr1, ctx);
-        Env.getCurrentEnv().createTable(createTableStmt);
-
-        // batch add 3 rollups
-        String stmtStr = "alter table db1.tbl2 add rollup r1(k3) duplicate 
key(k3), r2(k2, k1) duplicate key(k2), r3(k2) duplicate key(k2);";
-        AlterTableStmt alterTableStmt = (AlterTableStmt) 
UtFrameUtils.parseAndAnalyzeStmt(stmtStr, ctx);
-        
Env.getCurrentEnv().getAlterInstance().processAlterTable(alterTableStmt);
-
-        Map<Long, AlterJobV2> alterJobs = 
Env.getCurrentEnv().getMaterializedViewHandler().getAlterJobsV2();
-        Assert.assertEquals(3, alterJobs.size());
-        List<Long> jobIds = Lists.newArrayList(alterJobs.keySet());
-
-        Database db = Env.getCurrentInternalCatalog().getDbNullable("db1");
-        Assert.assertNotNull(db);
-        OlapTable tbl = (OlapTable) db.getTableNullable("tbl2");
-        Assert.assertNotNull(tbl);
-
-
-        for (AlterJobV2 alterJobV2 : alterJobs.values()) {
-            if (alterJobV2.getType() != AlterJobV2.JobType.ROLLUP) {
-                continue;
-            }
-            while (!alterJobV2.getJobState().isFinalState()) {
-                System.out.println(
-                        "rollup job " + alterJobV2.getJobId() + " is running. 
state: " + alterJobV2.getJobState());
-                Thread.sleep(1000);
-            }
-            System.out.println("rollup job " + alterJobV2.getJobId() + " is 
done. state: " + alterJobV2.getJobState());
-            Assert.assertEquals(AlterJobV2.JobState.FINISHED, 
alterJobV2.getJobState());
-
-            Assert.assertEquals(OlapTableState.ROLLUP, tbl.getState());
-            // cancel rest of rollup jobs
-            stmtStr = "cancel alter table rollup from db1.tbl2 (" + 
Joiner.on(",").join(jobIds) + ")";
-            CancelAlterTableStmt cancelStmt = (CancelAlterTableStmt) 
UtFrameUtils.parseAndAnalyzeStmt(stmtStr, ctx);
-            Env.getCurrentEnv().cancelAlter(cancelStmt);
-
-            int i = 3;
-            while (tbl.getState() != OlapTableState.NORMAL && i > 0) {
-                Thread.sleep(1000);
-                i--;
-            }
-
-            Assert.assertEquals(OlapTableState.NORMAL, tbl.getState());
-            break;
-        }
-
-        int finishedJobNum = 0;
-        for (AlterJobV2 alterJobV2 : alterJobs.values()) {
-            if (alterJobV2.getType() != AlterJobV2.JobType.ROLLUP) {
-                continue;
-            }
-            if (alterJobV2.getJobState() == AlterJobV2.JobState.FINISHED) {
-                ++finishedJobNum;
-            }
-        }
-
-        for (Partition partition : tbl.getPartitions()) {
-            Assert.assertEquals(finishedJobNum + 1, 
partition.getMaterializedIndices(IndexExtState.VISIBLE).size());
-        }
-    }
 }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/alter/IndexChangeJobTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/alter/IndexChangeJobTest.java
index 20bd26fa92d..697b1018848 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/alter/IndexChangeJobTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/alter/IndexChangeJobTest.java
@@ -21,11 +21,9 @@ import org.apache.doris.analysis.AccessTestUtil;
 import org.apache.doris.analysis.AlterClause;
 import org.apache.doris.analysis.Analyzer;
 import org.apache.doris.analysis.BuildIndexClause;
-import org.apache.doris.analysis.CancelAlterTableStmt;
 import org.apache.doris.analysis.CreateIndexClause;
 import org.apache.doris.analysis.DropIndexClause;
 import org.apache.doris.analysis.IndexDef;
-import org.apache.doris.analysis.ShowAlterStmt;
 import org.apache.doris.analysis.TableName;
 import org.apache.doris.catalog.CatalogTestUtil;
 import org.apache.doris.catalog.Database;
@@ -86,7 +84,6 @@ public class IndexChangeJobTest {
     private static CreateIndexClause createIndexClause;
     private static BuildIndexClause buildIndexClause;
     private static DropIndexClause dropIndexClause;
-    private static CancelAlterTableStmt cancelAlterTableStmt;
     private static TableName tableName;
     private static String indexName;
 
@@ -139,9 +136,6 @@ public class IndexChangeJobTest {
         dropIndexClause = new DropIndexClause(indexName, false, tableName, 
false);
         dropIndexClause.analyze(analyzer);
 
-        cancelAlterTableStmt = new 
CancelAlterTableStmt(ShowAlterStmt.AlterType.INDEX, tableName);
-        cancelAlterTableStmt.analyze(analyzer);
-
         AgentTaskQueue.clearAllTasks();
     }
 
@@ -328,13 +322,6 @@ public class IndexChangeJobTest {
 
         schemaChangeHandler.runAfterCatalogReady();
         Assert.assertEquals(IndexChangeJob.JobState.RUNNING, 
indexChangejob.getJobState());
-
-        // cancel build index job
-        schemaChangeHandler.cancel(cancelAlterTableStmt);
-
-        List<AgentTask> tasks = 
AgentTaskQueue.getTask(TTaskType.ALTER_INVERTED_INDEX);
-        Assert.assertEquals(0, tasks.size());
-        Assert.assertEquals(IndexChangeJob.JobState.CANCELLED, 
indexChangejob.getJobState());
     }
 
     @Test
@@ -698,12 +685,5 @@ public class IndexChangeJobTest {
         schemaChangeHandler.runAfterCatalogReady();
         Assert.assertEquals(AlterJobV2.JobState.RUNNING, jobV2.getJobState());
         Assert.assertEquals(1, jobV2.schemaChangeBatchTask.getTaskNum());
-
-        cancelAlterTableStmt = new 
CancelAlterTableStmt(ShowAlterStmt.AlterType.INDEX, tableName);
-        cancelAlterTableStmt.analyze(analyzer);
-        schemaChangeHandler.cancel(cancelAlterTableStmt);
-
-        schemaChangeHandler.runAfterCatalogReady();
-        Assert.assertEquals(AlterJobV2.JobState.CANCELLED, 
jobV2.getJobState());
     }
 }
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/CancelAlterStmtTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/analysis/CancelAlterStmtTest.java
deleted file mode 100644
index 838424dd901..00000000000
--- 
a/fe/fe-core/src/test/java/org/apache/doris/analysis/CancelAlterStmtTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-package org.apache.doris.analysis;
-
-
-import org.apache.doris.analysis.ShowAlterStmt.AlterType;
-import org.apache.doris.catalog.Env;
-import org.apache.doris.catalog.FakeEnv;
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.UserException;
-import org.apache.doris.datasource.InternalCatalog;
-import org.apache.doris.qe.ConnectContext;
-
-import mockit.Expectations;
-import mockit.Mock;
-import mockit.MockUp;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class CancelAlterStmtTest {
-
-    private Analyzer analyzer;
-    private Env env;
-
-    private ConnectContext ctx;
-
-    private static FakeEnv fakeEnv;
-
-    @Before
-    public void setUp() {
-        env = AccessTestUtil.fetchAdminCatalog();
-        ctx = new ConnectContext();
-        ctx.setQualifiedUser("root");
-        ctx.setRemoteIP("192.168.1.1");
-
-        analyzer = new Analyzer(env, ctx);
-        new Expectations(analyzer) {
-            {
-                analyzer.getDefaultDb();
-                minTimes = 0;
-                result = "testDb";
-
-                analyzer.getQualifiedUser();
-                minTimes = 0;
-                result = "testUser";
-            }
-        };
-
-        new MockUp<ConnectContext>() {
-            @Mock
-            public ConnectContext get() {
-                return ctx;
-            }
-        };
-    }
-
-    @Test
-    public void testNormal() throws UserException, AnalysisException {
-        fakeEnv = new FakeEnv();
-        FakeEnv.setEnv(env);
-        // cancel alter column
-        CancelAlterTableStmt stmt = new CancelAlterTableStmt(AlterType.COLUMN,
-                new TableName(InternalCatalog.INTERNAL_CATALOG_NAME, null, 
"testTbl"));
-        stmt.analyze(analyzer);
-        Assert.assertEquals("CANCEL ALTER COLUMN FROM `testDb`.`testTbl`", 
stmt.toString());
-        Assert.assertEquals("testDb", stmt.getDbName());
-        Assert.assertEquals(AlterType.COLUMN, stmt.getAlterType());
-        Assert.assertEquals("testTbl", stmt.getTableName());
-
-        stmt = new CancelAlterTableStmt(AlterType.ROLLUP,
-                new TableName(InternalCatalog.INTERNAL_CATALOG_NAME, null, 
"testTbl"));
-        stmt.analyze(analyzer);
-        Assert.assertEquals("CANCEL ALTER ROLLUP FROM `testDb`.`testTbl`", 
stmt.toString());
-        Assert.assertEquals("testDb", stmt.getDbName());
-        Assert.assertEquals(AlterType.ROLLUP, stmt.getAlterType());
-
-        stmt = new CancelAlterTableStmt(AlterType.INDEX,
-                new TableName(InternalCatalog.INTERNAL_CATALOG_NAME, null, 
"testTbl"));
-        stmt.analyze(analyzer);
-        Assert.assertEquals("CANCEL ALTER INDEX FROM `testDb`.`testTbl`", 
stmt.toString());
-        Assert.assertEquals("testDb", stmt.getDbName());
-        Assert.assertEquals(AlterType.INDEX, stmt.getAlterType());
-    }
-}
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/backup/BackupHandlerTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/backup/BackupHandlerTest.java
index 75e5165c4a6..ab4a283cf66 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/backup/BackupHandlerTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/backup/BackupHandlerTest.java
@@ -19,7 +19,6 @@ package org.apache.doris.backup;
 
 import org.apache.doris.analysis.AbstractBackupTableRefClause;
 import org.apache.doris.analysis.BackupStmt;
-import org.apache.doris.analysis.CancelBackupStmt;
 import org.apache.doris.analysis.CreateRepositoryStmt;
 import org.apache.doris.analysis.DropRepositoryStmt;
 import org.apache.doris.analysis.LabelName;
@@ -42,6 +41,7 @@ import org.apache.doris.common.Config;
 import org.apache.doris.common.FeConstants;
 import org.apache.doris.common.jmockit.Deencapsulation;
 import org.apache.doris.datasource.InternalCatalog;
+import org.apache.doris.nereids.trees.plans.commands.CancelBackupCommand;
 import org.apache.doris.persist.EditLog;
 import org.apache.doris.task.DirMoveTask;
 import org.apache.doris.task.DownloadTask;
@@ -277,7 +277,7 @@ public class BackupHandlerTest {
         handler.handleFinishedSnapshotUploadTask(uploadTask, request);
 
         // cancel backup
-        handler.cancel(new CancelBackupStmt(CatalogMocker.TEST_DB_NAME, 
false));
+        handler.cancel(new CancelBackupCommand(CatalogMocker.TEST_DB_NAME, 
false));
 
         // process restore
         List<TableRef> tblRefs2 = Lists.newArrayList();
@@ -318,7 +318,7 @@ public class BackupHandlerTest {
         handler.handleDirMoveTask(dirMoveTask, request);
 
         // cancel restore
-        handler.cancel(new CancelBackupStmt(CatalogMocker.TEST_DB_NAME, true));
+        handler.cancel(new CancelBackupCommand(CatalogMocker.TEST_DB_NAME, 
true));
 
         // drop repo
         handler.dropRepository(new DropRepositoryStmt("repo"));
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/clone/TabletRepairAndBalanceTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/clone/TabletRepairAndBalanceTest.java
index 0c81e8753ca..695b064a820 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/clone/TabletRepairAndBalanceTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/clone/TabletRepairAndBalanceTest.java
@@ -19,7 +19,6 @@ package org.apache.doris.clone;
 
 import org.apache.doris.analysis.AlterTableStmt;
 import org.apache.doris.analysis.BackendClause;
-import org.apache.doris.analysis.CancelAlterSystemStmt;
 import org.apache.doris.analysis.CreateDbStmt;
 import org.apache.doris.analysis.CreateTableStmt;
 import org.apache.doris.analysis.DropTableStmt;
@@ -48,7 +47,6 @@ import 
org.apache.doris.nereids.trees.plans.commands.AlterSystemCommand;
 import 
org.apache.doris.nereids.trees.plans.commands.info.DecommissionBackendOp;
 import org.apache.doris.nereids.trees.plans.commands.info.ModifyBackendOp;
 import org.apache.doris.qe.ConnectContext;
-import org.apache.doris.qe.DdlExecutor;
 import org.apache.doris.qe.StmtExecutor;
 import org.apache.doris.resource.Tag;
 import org.apache.doris.system.Backend;
@@ -548,11 +546,7 @@ public class TabletRepairAndBalanceTest {
         AlterSystemCommand command5 = new AlterSystemCommand(op1, 
PlanType.ALTER_SYSTEM_DECOMMISSION_BACKEND);
         command5.doRun(connectContext, new StmtExecutor(connectContext, ""));
 
-        String stmtStr5 = "cancel decommission backend \"" + be.getId() + "\"";
-        CancelAlterSystemStmt cancelAlterSystemStmt = (CancelAlterSystemStmt) 
UtFrameUtils.parseAndAnalyzeStmt(stmtStr5, connectContext);
-        DdlExecutor.execute(Env.getCurrentEnv(), cancelAlterSystemStmt);
-
-        Assert.assertFalse(be.isDecommissioned());
+        Assert.assertTrue(be.isDecommissioned());
 
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to