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 717d1f1d211 [Chore](nereids) Remove AdminStmt (#51908)
717d1f1d211 is described below
commit 717d1f1d21178d3d744190081d6525e62394dcb2
Author: yaoxiao <[email protected]>
AuthorDate: Mon Jun 23 22:03:47 2025 +0800
[Chore](nereids) Remove AdminStmt (#51908)
---
fe/fe-core/src/main/cup/sql_parser.cup | 58 +-------
.../analysis/AdminCancelRebalanceDiskStmt.java | 76 -----------
.../doris/analysis/AdminCancelRepairTableStmt.java | 73 ----------
.../doris/analysis/AdminCheckTabletsStmt.java | 95 -------------
.../apache/doris/analysis/AdminCleanTrashStmt.java | 77 -----------
.../doris/analysis/AdminCompactTableStmt.java | 145 --------------------
.../apache/doris/analysis/AdminCopyTabletStmt.java | 124 -----------------
.../doris/analysis/AdminRebalanceDiskStmt.java | 89 ------------
.../doris/analysis/AdminRepairTableStmt.java | 82 -----------
.../doris/analysis/AdminSetReplicaStatusStmt.java | 113 ---------------
.../doris/analysis/AdminSetReplicaVersionStmt.java | 151 ---------------------
.../doris/analysis/AdminSetTableStatusStmt.java | 91 -------------
.../main/java/org/apache/doris/catalog/Env.java | 65 ---------
.../java/org/apache/doris/clone/TabletChecker.java | 18 ---
.../org/apache/doris/clone/TabletScheduler.java | 10 --
.../main/java/org/apache/doris/qe/DdlExecutor.java | 38 ------
.../java/org/apache/doris/qe/ShowExecutor.java | 117 +---------------
.../analysis/AdminCancelRebalanceDiskStmtTest.java | 78 -----------
.../doris/analysis/AdminRebalanceDiskStmtTest.java | 77 -----------
.../org/apache/doris/catalog/AdminStmtTest.java | 138 -------------------
20 files changed, 2 insertions(+), 1713 deletions(-)
diff --git a/fe/fe-core/src/main/cup/sql_parser.cup
b/fe/fe-core/src/main/cup/sql_parser.cup
index 711592ccc49..04baa86ad4d 100644
--- a/fe/fe-core/src/main/cup/sql_parser.cup
+++ b/fe/fe-core/src/main/cup/sql_parser.cup
@@ -6936,27 +6936,7 @@ integer_list ::=
;
admin_stmt ::=
- KW_ADMIN KW_SET KW_REPLICA KW_STATUS KW_PROPERTIES LPAREN
key_value_map:prop RPAREN
- {:
- RESULT = new AdminSetReplicaStatusStmt(prop);
- :}
- | KW_ADMIN KW_SET KW_REPLICA KW_VERSION KW_PROPERTIES LPAREN
key_value_map:prop RPAREN
- {:
- RESULT = new AdminSetReplicaVersionStmt(prop);
- :}
- | KW_ADMIN KW_REPAIR KW_TABLE base_table_ref:table_ref
- {:
- RESULT = new AdminRepairTableStmt(table_ref);
- :}
- | KW_ADMIN KW_CANCEL KW_REPAIR KW_TABLE base_table_ref:table_ref
- {:
- RESULT = new AdminCancelRepairTableStmt(table_ref);
- :}
- | KW_ADMIN KW_COMPACT KW_TABLE base_table_ref:table_ref opt_wild_where
- {:
- RESULT = new AdminCompactTableStmt(table_ref, parser.where);
- :}
- | KW_ADMIN KW_SET KW_FRONTEND KW_CONFIG opt_key_value_map:configs
+ KW_ADMIN KW_SET KW_FRONTEND KW_CONFIG opt_key_value_map:configs
{:
RESULT = new AdminSetConfigStmt(NodeType.FRONTEND, configs, false);
:}
@@ -6968,34 +6948,6 @@ admin_stmt ::=
{:
RESULT = new AdminSetConfigStmt(NodeType.FRONTEND, configs, true);
:}
- | KW_ADMIN KW_CHECK KW_TABLET LPAREN integer_list:tabletIds RPAREN
opt_properties:properties
- {:
- RESULT = new AdminCheckTabletsStmt(tabletIds, properties);
- :}
- | KW_ADMIN KW_REBALANCE KW_DISK KW_ON LPAREN string_list:backends RPAREN
- {:
- RESULT = new AdminRebalanceDiskStmt(backends);
- :}
- | KW_ADMIN KW_REBALANCE KW_DISK
- {:
- RESULT = new AdminRebalanceDiskStmt(null);
- :}
- | KW_ADMIN KW_CANCEL KW_REBALANCE KW_DISK KW_ON LPAREN
string_list:backends RPAREN
- {:
- RESULT = new AdminCancelRebalanceDiskStmt(backends);
- :}
- | KW_ADMIN KW_CANCEL KW_REBALANCE KW_DISK
- {:
- RESULT = new AdminCancelRebalanceDiskStmt(null);
- :}
- | KW_ADMIN KW_CLEAN KW_TRASH KW_ON LPAREN string_list:backends RPAREN
- {:
- RESULT = new AdminCleanTrashStmt(backends);
- :}
- | KW_ADMIN KW_CLEAN KW_TRASH
- {:
- RESULT = new AdminCleanTrashStmt(null);
- :}
| KW_ADMIN KW_SET KW_TABLE table_name:name KW_PARTITION KW_VERSION
opt_properties:properties
{:
RESULT = new AdminSetPartitionVersionStmt(name, properties);
@@ -7005,14 +6957,6 @@ admin_stmt ::=
{:
RESULT = new DiagnoseTabletStmt(tabletId);
:}
- | KW_ADMIN KW_COPY KW_TABLET INTEGER_LITERAL:tabletId
opt_properties:properties
- {:
- RESULT = new AdminCopyTabletStmt(tabletId, properties);
- :}
- | KW_ADMIN KW_SET KW_TABLE table_name:name KW_STATUS
opt_properties:properties
- {:
- RESULT = new AdminSetTableStatusStmt(name, properties);
- :}
;
truncate_stmt ::=
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCancelRebalanceDiskStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCancelRebalanceDiskStmt.java
deleted file mode 100644
index 59180d158e0..00000000000
---
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCancelRebalanceDiskStmt.java
+++ /dev/null
@@ -1,76 +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.common.util.NetUtils;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-import org.apache.doris.system.Backend;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class AdminCancelRebalanceDiskStmt extends DdlStmt implements
NotFallbackInParser {
- private List<Backend> backends = Lists.newArrayList();
-
- public AdminCancelRebalanceDiskStmt(List<String> backends) throws
UserException {
- ImmutableMap<Long, Backend> backendsInfo =
Env.getCurrentSystemInfo().getAllBackendsByAllCluster();
- Map<String, Long> backendsID = new HashMap<String, Long>();
- for (Backend backend : backendsInfo.values()) {
-
backendsID.put(NetUtils.getHostPortInAccessibleFormat(backend.getHost(),
backend.getHeartbeatPort()),
- backend.getId());
- }
- if (backends == null) {
- for (Backend backend : backendsInfo.values()) {
- this.backends.add(backend);
- }
- } else {
- for (String backend : backends) {
- if (backendsID.get(backend) != null) {
-
this.backends.add(backendsInfo.get(backendsID.get(backend)));
- backendsID.remove(backend); // avoid repetition
- }
- }
- }
- }
-
- public List<Backend> getBackends() {
- return backends;
- }
-
- @Override
- public void analyze(Analyzer analyzer) throws AnalysisException {
- if
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(),
PrivPredicate.ADMIN)) {
-
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
"ADMIN");
- }
- }
-
- @Override
- public RedirectStatus getRedirectStatus() {
- return RedirectStatus.NO_FORWARD;
- }
-}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCancelRepairTableStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCancelRepairTableStmt.java
deleted file mode 100644
index e4efa1b58d5..00000000000
---
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCancelRepairTableStmt.java
+++ /dev/null
@@ -1,73 +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.common.util.Util;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-import com.google.common.collect.Lists;
-
-import java.util.List;
-
-public class AdminCancelRepairTableStmt extends DdlStmt implements
NotFallbackInParser {
-
- private TableRef tblRef;
- private List<String> partitions = Lists.newArrayList();
-
- public AdminCancelRepairTableStmt(TableRef tblRef) {
- this.tblRef = tblRef;
- }
-
- @Override
- public void analyze(Analyzer analyzer) throws UserException {
- super.analyze(analyzer);
- // check auth
- if
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(),
PrivPredicate.ADMIN)) {
-
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
"ADMIN");
- }
-
- tblRef.getName().analyze(analyzer);
- Util.prohibitExternalCatalog(tblRef.getName().getCtl(),
this.getClass().getSimpleName());
-
- PartitionNames partitionNames = tblRef.getPartitionNames();
- if (partitionNames != null) {
- if (partitionNames.isTemp()) {
- throw new AnalysisException("Do not support (cancel)repair
temporary partitions");
- }
- partitions.addAll(partitionNames.getPartitionNames());
- }
- }
-
- public String getDbName() {
- return tblRef.getName().getDb();
- }
-
- public String getTblName() {
- return tblRef.getName().getTbl();
- }
-
- public List<String> getPartitions() {
- return partitions;
- }
-}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCheckTabletsStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCheckTabletsStmt.java
deleted file mode 100644
index 56efbdc8a63..00000000000
---
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCheckTabletsStmt.java
+++ /dev/null
@@ -1,95 +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.common.util.PropertyAnalyzer;
-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.Map;
-
-// ADMIN CHECK TABLET (id1, id2, ...) PROPERTIES ("type" =
"check_consistency");
-public class AdminCheckTabletsStmt extends DdlStmt implements
NotFallbackInParser {
-
- private List<Long> tabletIds;
- private Map<String, String> properties;
-
- public enum CheckType {
- CONSISTENCY; // check the consistency of replicas of tablet
-
- public static CheckType getTypeFromString(String str) throws
AnalysisException {
- try {
- return CheckType.valueOf(str.toUpperCase());
- } catch (Exception e) {
- throw new AnalysisException("Unknown check type: " + str);
- }
- }
- }
-
- private CheckType type;
-
- public AdminCheckTabletsStmt(List<Long> tabletIds, Map<String, String>
properties) {
- this.tabletIds = tabletIds;
- this.properties = properties;
- }
-
- public List<Long> getTabletIds() {
- return tabletIds;
- }
-
- public CheckType getType() {
- return type;
- }
-
- @Override
- public void analyze(Analyzer analyzer) throws AnalysisException,
UserException {
- super.analyze(analyzer);
-
- // check auth
- if
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(),
PrivPredicate.ADMIN)) {
-
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
"ADMIN");
- }
-
- if (CollectionUtils.isEmpty(tabletIds)) {
- throw new AnalysisException("Tablet id list is empty");
- }
-
- String typeStr = PropertyAnalyzer.analyzeType(properties);
- if (typeStr == null) {
- throw new AnalysisException("Should specify 'type' property");
- }
- type = CheckType.getTypeFromString(typeStr);
-
- if (properties != null && !properties.isEmpty()) {
- throw new AnalysisException("Unknown properties: " +
properties.keySet());
- }
- }
-
- @Override
- public RedirectStatus getRedirectStatus() {
- return RedirectStatus.FORWARD_NO_SYNC;
- }
-}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCleanTrashStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCleanTrashStmt.java
deleted file mode 100644
index 5dd9419376d..00000000000
---
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCleanTrashStmt.java
+++ /dev/null
@@ -1,77 +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.common.util.NetUtils;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-import org.apache.doris.system.Backend;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class AdminCleanTrashStmt extends DdlStmt implements
NotFallbackInParser {
- private List<Backend> backends = Lists.newArrayList();
-
- public AdminCleanTrashStmt(List<String> backends) throws UserException {
- ImmutableMap<Long, Backend> backendsInfo =
Env.getCurrentSystemInfo().getAllBackendsByAllCluster();
- Map<String, Long> backendsID = new HashMap<String, Long>();
- for (Backend backend : backendsInfo.values()) {
- backendsID.put(
- NetUtils.getHostPortInAccessibleFormat(backend.getHost(),
backend.getHeartbeatPort()),
- backend.getId());
- }
- if (backends == null) {
- for (Backend backend : backendsInfo.values()) {
- this.backends.add(backend);
- }
- } else {
- for (String backend : backends) {
- if (backendsID.get(backend) != null) {
-
this.backends.add(backendsInfo.get(backendsID.get(backend)));
- backendsID.remove(backend); // avoid repetition
- }
- }
- }
- }
-
- public List<Backend> getBackends() {
- return backends;
- }
-
- @Override
- public void analyze(Analyzer analyzer) throws AnalysisException {
- if
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(),
PrivPredicate.ADMIN)) {
-
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
"ADMIN");
- }
- }
-
- @Override
- public RedirectStatus getRedirectStatus() {
- return RedirectStatus.NO_FORWARD;
- }
-}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCompactTableStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCompactTableStmt.java
deleted file mode 100644
index 5d82a735353..00000000000
---
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCompactTableStmt.java
+++ /dev/null
@@ -1,145 +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.common.util.Util;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-import com.google.common.collect.Lists;
-
-import java.util.List;
-
-public class AdminCompactTableStmt extends DdlStmt implements
NotFallbackInParser {
-
- private TableRef tblRef;
- private Expr where;
- private List<String> partitions = Lists.newArrayList();
-
- public enum CompactionType {
- CUMULATIVE,
- BASE
- }
-
- private CompactionType typeFilter;
- private BinaryPredicate.Operator op;
-
- public AdminCompactTableStmt(TableRef tblRef, Expr where) {
- this.tblRef = tblRef;
- this.where = where;
- }
-
- @Override
- public void analyze(Analyzer analyzer) throws UserException {
- super.analyze(analyzer);
-
- // check auth
- if
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(),
PrivPredicate.ADMIN)) {
-
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
"ADMIN");
- }
-
- tblRef.getName().analyze(analyzer);
- Util.prohibitExternalCatalog(tblRef.getName().getCtl(),
this.getClass().getSimpleName());
-
- PartitionNames partitionNames = tblRef.getPartitionNames();
- if (partitionNames != null) {
- if (partitionNames.getPartitionNames().size() != 1) {
- throw new AnalysisException("Only support single partition for
compaction");
- }
- partitions.addAll(partitionNames.getPartitionNames());
- } else {
- throw new AnalysisException("No partition selected for
compaction");
- }
-
- // analyze where clause if not null
- if (where == null) {
- throw new AnalysisException("Compaction type must be specified in"
- + " Where clause like: type = 'BASE/CUMULATIVE'");
- }
-
- if (!analyzeWhere()) {
- throw new AnalysisException(
- "Where clause should looks like: type =
'BASE/CUMULATIVE'");
- }
- }
-
- private boolean analyzeWhere() throws AnalysisException {
-
- if (!(where instanceof BinaryPredicate)) {
- return false;
- }
-
- BinaryPredicate binaryPredicate = (BinaryPredicate) where;
- op = binaryPredicate.getOp();
- if (op != BinaryPredicate.Operator.EQ) {
- return false;
- }
-
- Expr leftChild = binaryPredicate.getChild(0);
- if (!(leftChild instanceof SlotRef)) {
- return false;
- }
-
- String leftKey = ((SlotRef) leftChild).getColumnName();
- if (!leftKey.equalsIgnoreCase("type")) {
- return false;
- }
-
- Expr rightChild = binaryPredicate.getChild(1);
- if (!(rightChild instanceof StringLiteral)) {
- return false;
- }
-
- try {
- typeFilter = CompactionType.valueOf(((StringLiteral)
rightChild).getStringValue().toUpperCase());
- } catch (Exception e) {
- return false;
- }
-
- if (typeFilter == null || (typeFilter != CompactionType.CUMULATIVE &&
typeFilter != CompactionType.BASE)) {
- return false;
- }
-
- return true;
- }
-
- public String getDbName() {
- return tblRef.getName().getDb();
- }
-
- public String getTblName() {
- return tblRef.getName().getTbl();
- }
-
- public List<String> getPartitions() {
- return partitions;
- }
-
- public String getCompactionType() {
- if (typeFilter == CompactionType.CUMULATIVE) {
- return "cumulative";
- } else {
- return "base";
- }
- }
-}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCopyTabletStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCopyTabletStmt.java
deleted file mode 100644
index 072ee4bb12d..00000000000
---
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminCopyTabletStmt.java
+++ /dev/null
@@ -1,124 +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.Column;
-import org.apache.doris.catalog.Env;
-import org.apache.doris.catalog.ScalarType;
-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.qe.ShowResultSetMetaData;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Maps;
-
-import java.util.Iterator;
-import java.util.Map;
-
-// ADMIN COPY TABLET 10110 PROPERTIES('version' = '1000', backend_id =
'10001');
-public class AdminCopyTabletStmt extends ShowStmt implements
NotFallbackInParser {
- public static final String PROP_VERSION = "version";
- public static final String PROP_BACKEND_ID = "backend_id";
- public static final String PROP_EXPIRATION = "expiration_minutes";
- private static final long DEFAULT_EXPIRATION_MINUTES = 60;
- public static final ImmutableList<String> TITLE_NAMES = new
ImmutableList.Builder<String>().add("TabletId")
-
.add("BackendId").add("Ip").add("Path").add("ExpirationMinutes").add("CreateTableStmt").build();
-
- private long tabletId;
- private Map<String, String> properties = Maps.newHashMap();
- private long version = -1;
- private long backendId = -1;
- private long expirationMinutes = DEFAULT_EXPIRATION_MINUTES; // default
60min
-
- public AdminCopyTabletStmt(long tabletId, Map<String, String> properties) {
- this.tabletId = tabletId;
- this.properties = properties;
- }
-
- public long getTabletId() {
- return tabletId;
- }
-
- public long getVersion() {
- return version;
- }
-
- public long getBackendId() {
- return backendId;
- }
-
- public long getExpirationMinutes() {
- return expirationMinutes;
- }
-
- @Override
- public void analyze(Analyzer analyzer) throws AnalysisException {
- if
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(),
PrivPredicate.ADMIN)) {
-
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
- PrivPredicate.ADMIN.getPrivs().toString());
- }
-
- if (properties == null) {
- return;
- }
- try {
- Iterator<Map.Entry<String, String>> iter =
properties.entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry<String, String> entry = iter.next();
- if (entry.getKey().equalsIgnoreCase(PROP_VERSION)) {
- version = Long.valueOf(entry.getValue());
- iter.remove();
- continue;
- } else if (entry.getKey().equalsIgnoreCase(PROP_BACKEND_ID)) {
- backendId = Long.valueOf(entry.getValue());
- iter.remove();
- continue;
- } else if (entry.getKey().equalsIgnoreCase(PROP_EXPIRATION)) {
- expirationMinutes = Long.valueOf(entry.getValue());
- expirationMinutes = Math.min(DEFAULT_EXPIRATION_MINUTES,
expirationMinutes);
- iter.remove();
- continue;
- }
- }
- } catch (NumberFormatException e) {
- throw new AnalysisException("Invalid property: " + e.getMessage());
- }
-
- if (!properties.isEmpty()) {
- throw new AnalysisException("Unknown property: " + properties);
- }
- }
-
- @Override
- public ShowResultSetMetaData getMetaData() {
- ShowResultSetMetaData.Builder builder =
ShowResultSetMetaData.builder();
- for (String title : TITLE_NAMES) {
- builder.addColumn(new Column(title,
ScalarType.createStringType()));
- }
- return builder.build();
- }
-
- @Override
- public RedirectStatus getRedirectStatus() {
- return RedirectStatus.NO_FORWARD;
- }
-}
-
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminRebalanceDiskStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminRebalanceDiskStmt.java
deleted file mode 100644
index 7185826343f..00000000000
---
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminRebalanceDiskStmt.java
+++ /dev/null
@@ -1,89 +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.util.NetUtils;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-import org.apache.doris.system.Backend;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class AdminRebalanceDiskStmt extends DdlStmt implements
NotFallbackInParser {
- private static final Logger LOG =
LogManager.getLogger(AdminRebalanceDiskStmt.class);
- private List<Backend> backends = Lists.newArrayList();
- private long timeoutS = 0;
-
- public AdminRebalanceDiskStmt(List<String> backends) {
- ImmutableMap<Long, Backend> backendsInfo;
- try {
- backendsInfo =
Env.getCurrentSystemInfo().getAllBackendsByAllCluster();
- } catch (AnalysisException e) {
- LOG.warn("failed to get backends,", e);
- return;
- }
- Map<String, Long> backendsID = new HashMap<String, Long>();
- for (Backend backend : backendsInfo.values()) {
- backendsID.put(
- NetUtils.getHostPortInAccessibleFormat(backend.getHost(),
backend.getHeartbeatPort()),
- backend.getId());
- }
- if (backends == null) {
- this.backends.addAll(backendsInfo.values());
- } else {
- for (String backend : backends) {
- if (backendsID.get(backend) != null) {
-
this.backends.add(backendsInfo.get(backendsID.get(backend)));
- backendsID.remove(backend); // avoid repetition
- }
- }
- }
- timeoutS = 24 * 3600; // default 24 hours
- }
-
- public List<Backend> getBackends() {
- return backends;
- }
-
- public long getTimeoutS() {
- return timeoutS;
- }
-
- @Override
- public void analyze(Analyzer analyzer) throws AnalysisException {
- if
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(),
PrivPredicate.ADMIN)) {
-
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
"ADMIN");
- }
- }
-
- @Override
- public RedirectStatus getRedirectStatus() {
- return RedirectStatus.NO_FORWARD;
- }
-}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminRepairTableStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminRepairTableStmt.java
deleted file mode 100644
index a87c6e02b65..00000000000
---
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminRepairTableStmt.java
+++ /dev/null
@@ -1,82 +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.common.util.Util;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-import com.google.common.collect.Lists;
-
-import java.util.List;
-
-public class AdminRepairTableStmt extends DdlStmt implements
NotFallbackInParser {
-
- private TableRef tblRef;
- private List<String> partitions = Lists.newArrayList();
-
- private long timeoutS = 0;
-
- public AdminRepairTableStmt(TableRef tblRef) {
- this.tblRef = tblRef;
- }
-
- @Override
- public void analyze(Analyzer analyzer) throws UserException {
- super.analyze(analyzer);
-
- // check auth
- if
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(),
PrivPredicate.ADMIN)) {
-
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
"ADMIN");
- }
-
- tblRef.getName().analyze(analyzer);
- Util.prohibitExternalCatalog(tblRef.getName().getCtl(),
this.getClass().getSimpleName());
-
- PartitionNames partitionNames = tblRef.getPartitionNames();
- if (partitionNames != null) {
- if (partitionNames.isTemp()) {
- throw new AnalysisException("Do not support (cancel)repair
temporary partitions");
- }
- partitions.addAll(partitionNames.getPartitionNames());
- }
-
- timeoutS = 4 * 3600; // default 4 hours
- }
-
- public String getDbName() {
- return tblRef.getName().getDb();
- }
-
- public String getTblName() {
- return tblRef.getName().getTbl();
- }
-
- public List<String> getPartitions() {
- return partitions;
- }
-
- public long getTimeoutS() {
- return timeoutS;
- }
-}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminSetReplicaStatusStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminSetReplicaStatusStmt.java
deleted file mode 100644
index dcc2f29fca5..00000000000
---
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminSetReplicaStatusStmt.java
+++ /dev/null
@@ -1,113 +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.catalog.Replica.ReplicaStatus;
-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.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-import java.util.Map;
-
-/*
- * admin set replicas status properties ("key" = "val", ..);
- * Required:
- * "tablet_id" = "10010",
- * "backend_id" = "10001"
- * "status" = "drop"/"bad"/"ok"
- */
-public class AdminSetReplicaStatusStmt extends DdlStmt implements
NotFallbackInParser {
-
- public static final String TABLET_ID = "tablet_id";
- public static final String BACKEND_ID = "backend_id";
- public static final String STATUS = "status";
-
- private Map<String, String> properties;
- private long tabletId = -1;
- private long backendId = -1;
- private ReplicaStatus status;
-
- public AdminSetReplicaStatusStmt(Map<String, String> properties) {
- this.properties = properties;
- }
-
- @Override
- public void analyze(Analyzer analyzer) throws AnalysisException,
UserException {
- super.analyze(analyzer);
-
- // check auth
- if
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(),
PrivPredicate.ADMIN)) {
-
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
"ADMIN");
- }
-
- checkProperties();
- }
-
- private void checkProperties() throws AnalysisException {
- for (Map.Entry<String, String> entry : properties.entrySet()) {
- String key = entry.getKey();
- String val = entry.getValue();
-
- if (key.equalsIgnoreCase(TABLET_ID)) {
- try {
- tabletId = Long.valueOf(val);
- } catch (NumberFormatException e) {
- throw new AnalysisException("Invalid tablet id format: " +
val);
- }
- } else if (key.equalsIgnoreCase(BACKEND_ID)) {
- try {
- backendId = Long.valueOf(val);
- } catch (NumberFormatException e) {
- throw new AnalysisException("Invalid backend id format: "
+ val);
- }
- } else if (key.equalsIgnoreCase(STATUS)) {
- status = ReplicaStatus.valueOf(val.toUpperCase());
- if (status != ReplicaStatus.BAD && status != ReplicaStatus.OK
&& status != ReplicaStatus.DROP) {
- throw new AnalysisException("Do not support setting
replica status as " + val);
- }
- } else {
- throw new AnalysisException("Unknown property: " + key);
- }
- }
-
- if (tabletId == -1 || backendId == -1 || status == null) {
- throw new AnalysisException("Should add following properties:
TABLET_ID, BACKEND_ID and STATUS");
- }
- }
-
- public long getTabletId() {
- return tabletId;
- }
-
- public long getBackendId() {
- return backendId;
- }
-
- public ReplicaStatus getStatus() {
- return status;
- }
-
- @Override
- public RedirectStatus getRedirectStatus() {
- return RedirectStatus.FORWARD_WITH_SYNC;
- }
-}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminSetReplicaVersionStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminSetReplicaVersionStmt.java
deleted file mode 100644
index 23b16638477..00000000000
---
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminSetReplicaVersionStmt.java
+++ /dev/null
@@ -1,151 +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.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-import java.util.Map;
-
-/*
- * admin set replicas status properties ("key" = "val", ..);
- * Required:
- * "tablet_id" = "10010",
- * "backend_id" = "10001",
- * Optional:
- * "version" = "100",
- * "last_success_version" = "100",
- * "last_failed_version" = "-1",
- */
-public class AdminSetReplicaVersionStmt extends DdlStmt implements
NotFallbackInParser {
-
- public static final String TABLET_ID = "tablet_id";
- public static final String BACKEND_ID = "backend_id";
- public static final String VERSION = "version";
- public static final String LAST_SUCCESS_VERSION = "last_success_version";
- public static final String LAST_FAILED_VERSION = "last_failed_version";
-
- private Map<String, String> properties;
- private long tabletId = -1;
- private long backendId = -1;
- private Long version = null;
- private Long lastSuccessVersion = null;
- private Long lastFailedVersion = null;
-
- public AdminSetReplicaVersionStmt(Map<String, String> properties) {
- this.properties = properties;
- }
-
- @Override
- public void analyze(Analyzer analyzer) throws AnalysisException,
UserException {
- super.analyze(analyzer);
-
- // check auth
- if
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(),
PrivPredicate.ADMIN)) {
-
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
"ADMIN");
- }
-
- checkProperties();
- }
-
- private void checkProperties() throws AnalysisException {
- for (Map.Entry<String, String> entry : properties.entrySet()) {
- String key = entry.getKey();
- String val = entry.getValue();
-
- if (key.equalsIgnoreCase(TABLET_ID)) {
- try {
- tabletId = Long.valueOf(val);
- } catch (NumberFormatException e) {
- throw new AnalysisException("Invalid tablet id format: " +
val);
- }
- } else if (key.equalsIgnoreCase(BACKEND_ID)) {
- try {
- backendId = Long.valueOf(val);
- } catch (NumberFormatException e) {
- throw new AnalysisException("Invalid backend id format: "
+ val);
- }
- } else if (key.equalsIgnoreCase(VERSION)) {
- try {
- version = Long.valueOf(val);
- } catch (NumberFormatException e) {
- throw new AnalysisException("Invalid version format: " +
val);
- }
- if (version <= 0) {
- throw new AnalysisException("Required version > 0");
- }
- } else if (key.equalsIgnoreCase(LAST_SUCCESS_VERSION)) {
- try {
- lastSuccessVersion = Long.valueOf(val);
- } catch (NumberFormatException e) {
- throw new AnalysisException("Invalid last success version
format: " + val);
- }
- if (lastSuccessVersion <= 0) {
- throw new AnalysisException("Required last success version
> 0");
- }
- } else if (key.equalsIgnoreCase(LAST_FAILED_VERSION)) {
- try {
- lastFailedVersion = Long.valueOf(val);
- } catch (NumberFormatException e) {
- throw new AnalysisException("Invalid last failed version
format: " + val);
- }
- if (lastFailedVersion <= 0 && lastFailedVersion != -1) {
- throw new AnalysisException("Required last failed version
> 0 or == -1");
- }
- } else {
- throw new AnalysisException("Unknown property: " + key);
- }
- }
-
- if (tabletId == -1 || backendId == -1
- || (version == null && lastSuccessVersion == null &&
lastFailedVersion == null)) {
- throw new AnalysisException("Should add following properties:
TABLET_ID, BACKEND_ID, "
- + "VERSION, LAST_SUCCESS_VERSION, LAST_FAILED_VERSION");
- }
- }
-
- public long getTabletId() {
- return tabletId;
- }
-
- public long getBackendId() {
- return backendId;
- }
-
- public Long getVersion() {
- return version;
- }
-
- public Long getLastSuccessVersion() {
- return lastSuccessVersion;
- }
-
- public Long getLastFailedVersion() {
- return lastFailedVersion;
- }
-
- @Override
- public RedirectStatus getRedirectStatus() {
- return RedirectStatus.FORWARD_WITH_SYNC;
- }
-}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminSetTableStatusStmt.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminSetTableStatusStmt.java
deleted file mode 100644
index 8e857f75070..00000000000
---
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AdminSetTableStatusStmt.java
+++ /dev/null
@@ -1,91 +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.catalog.OlapTable.OlapTableState;
-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.common.util.Util;
-import org.apache.doris.mysql.privilege.PrivPredicate;
-import org.apache.doris.qe.ConnectContext;
-
-import lombok.Getter;
-
-import java.util.Map;
-
-public class AdminSetTableStatusStmt extends DdlStmt implements
NotFallbackInParser {
-
- public static final String TABLE_STATE = "state";
-
- private final TableName tableName;
- private final Map<String, String> properties;
- @Getter
- private OlapTableState tableState;
-
- public AdminSetTableStatusStmt(TableName tableName, Map<String, String>
properties) {
- this.tableName = tableName;
- this.properties = properties;
- }
-
- @Override
- public void analyze(Analyzer analyzer) throws AnalysisException,
UserException {
- super.analyze(analyzer);
-
- // check auth
- if
(!Env.getCurrentEnv().getAccessManager().checkGlobalPriv(ConnectContext.get(),
PrivPredicate.ADMIN)) {
-
ErrorReport.reportAnalysisException(ErrorCode.ERR_SPECIFIC_ACCESS_DENIED_ERROR,
"ADMIN");
- }
-
- tableName.analyze(analyzer);
- Util.prohibitExternalCatalog(tableName.getCtl(),
this.getClass().getSimpleName());
-
- checkProperties();
- }
-
- private void checkProperties() throws AnalysisException {
- for (Map.Entry<String, String> entry : properties.entrySet()) {
- String key = entry.getKey();
- String val = entry.getValue();
-
- if (key.equalsIgnoreCase(TABLE_STATE)) {
- try {
- tableState = OlapTableState.valueOf(val.toUpperCase());
- } catch (IllegalArgumentException e) {
- throw new AnalysisException("Invalid table state: " + val);
- }
- } else {
- throw new AnalysisException("Unsupported property: " + key);
- }
- }
-
- if (tableState == null) {
- throw new AnalysisException("Should add properties: STATE.");
- }
- }
-
- public String getDbName() {
- return tableName.getDb();
- }
-
- public String getTblName() {
- return tableName.getTbl();
- }
-}
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 110a38de279..605ed7ddd2d 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
@@ -26,15 +26,8 @@ import org.apache.doris.alter.SchemaChangeHandler;
import org.apache.doris.alter.SystemHandler;
import org.apache.doris.analysis.AddPartitionClause;
import org.apache.doris.analysis.AddPartitionLikeClause;
-import org.apache.doris.analysis.AdminCheckTabletsStmt;
-import org.apache.doris.analysis.AdminCheckTabletsStmt.CheckType;
-import org.apache.doris.analysis.AdminCleanTrashStmt;
-import org.apache.doris.analysis.AdminCompactTableStmt;
import org.apache.doris.analysis.AdminSetConfigStmt;
import org.apache.doris.analysis.AdminSetPartitionVersionStmt;
-import org.apache.doris.analysis.AdminSetReplicaStatusStmt;
-import org.apache.doris.analysis.AdminSetReplicaVersionStmt;
-import org.apache.doris.analysis.AdminSetTableStatusStmt;
import org.apache.doris.analysis.AlterDatabasePropertyStmt;
import org.apache.doris.analysis.AlterDatabaseQuotaStmt;
import org.apache.doris.analysis.AlterDatabaseRename;
@@ -289,7 +282,6 @@ import org.apache.doris.system.SystemInfoService;
import org.apache.doris.system.SystemInfoService.HostInfo;
import org.apache.doris.task.AgentBatchTask;
import org.apache.doris.task.AgentTaskExecutor;
-import org.apache.doris.task.CleanTrashTask;
import org.apache.doris.task.CleanUDFCacheTask;
import org.apache.doris.task.CompactionTask;
import org.apache.doris.task.MasterTaskExecutor;
@@ -6512,24 +6504,6 @@ public class Env {
}
}
- // entry of checking tablets operation
- public void checkTablets(AdminCheckTabletsStmt stmt) {
- CheckType type = stmt.getType();
- switch (type) {
- case CONSISTENCY:
- consistencyChecker.addTabletsToCheck(stmt.getTabletIds());
- break;
- default:
- break;
- }
- }
-
- public void setTableStatus(AdminSetTableStatusStmt stmt) throws
MetaNotFoundException {
- String dbName = stmt.getDbName();
- String tableName = stmt.getTblName();
- setTableStatusInternal(dbName, tableName, stmt.getTableState(), false);
- }
-
public void replaySetTableStatus(SetTableStatusOperationLog log) throws
MetaNotFoundException {
setTableStatusInternal(log.getDbName(), log.getTblName(),
log.getState(), true);
}
@@ -6567,14 +6541,6 @@ public class Env {
setReplicaStatusInternal(tabletId, backendId, status, userDropTime,
false);
}
- public void setReplicaStatus(AdminSetReplicaStatusStmt stmt) throws
MetaNotFoundException {
- long tabletId = stmt.getTabletId();
- long backendId = stmt.getBackendId();
- ReplicaStatus status = stmt.getStatus();
- long userDropTime = status == ReplicaStatus.DROP ?
System.currentTimeMillis() : -1L;
- setReplicaStatusInternal(tabletId, backendId, status, userDropTime,
false);
- }
-
public void replaySetReplicaStatus(SetReplicaStatusOperationLog log)
throws MetaNotFoundException {
setReplicaStatusInternal(log.getTabletId(), log.getBackendId(),
log.getReplicaStatus(),
log.getUserDropTime(), true);
@@ -6623,18 +6589,6 @@ public class Env {
}
}
- // Set specified replica's version. If replica does not exist, just ignore
it.
- public void setReplicaVersion(AdminSetReplicaVersionStmt stmt) throws
MetaNotFoundException {
- long tabletId = stmt.getTabletId();
- long backendId = stmt.getBackendId();
- Long version = stmt.getVersion();
- Long lastSuccessVersion = stmt.getLastSuccessVersion();
- Long lastFailedVersion = stmt.getLastFailedVersion();
- long updateTime = System.currentTimeMillis();
- setReplicaVersionInternal(tabletId, backendId, version,
lastSuccessVersion, lastFailedVersion,
- updateTime, false);
- }
-
// Set specified replica's version. If replica does not exist, just ignore
it.
public void setReplicaVersion(AdminSetReplicaVersionCommand command)
throws MetaNotFoundException {
long tabletId = command.getTabletId();
@@ -6728,17 +6682,6 @@ public class Env {
getInternalCatalog().erasePartitionDropBackendReplicas(Lists.newArrayList(partition));
}
- public void cleanTrash(AdminCleanTrashStmt stmt) {
- List<Backend> backends = stmt.getBackends();
- AgentBatchTask batchTask = new AgentBatchTask();
- for (Backend backend : backends) {
- CleanTrashTask cleanTrashTask = new
CleanTrashTask(backend.getId());
- batchTask.addTask(cleanTrashTask);
- LOG.info("clean trash in be {}, beId {}", backend.getHost(),
backend.getId());
- }
- AgentTaskExecutor.submit(batchTask);
- }
-
public void cleanUDFCacheTask(DropFunctionStmt stmt) throws UserException {
ImmutableMap<Long, Backend> backendsInfo =
Env.getCurrentSystemInfo().getAllBackendsByAllCluster();
String functionSignature = stmt.signatureString();
@@ -6918,14 +6861,6 @@ public class Env {
return result;
}
- public void compactTable(AdminCompactTableStmt stmt) throws DdlException {
- String dbName = stmt.getDbName();
- String tableName = stmt.getTblName();
- String type = stmt.getCompactionType();
- List<String> partitionNames = stmt.getPartitions();
- compactTable(dbName, tableName, type, partitionNames);
- }
-
public void compactTable(String dbName, String tableName, String type,
List<String> partitionNames)
throws DdlException {
Database db = getInternalCatalog().getDbOrDdlException(dbName);
diff --git a/fe/fe-core/src/main/java/org/apache/doris/clone/TabletChecker.java
b/fe/fe-core/src/main/java/org/apache/doris/clone/TabletChecker.java
index 9da3b11d44b..e652fc68d46 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/clone/TabletChecker.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/clone/TabletChecker.java
@@ -17,8 +17,6 @@
package org.apache.doris.clone;
-import org.apache.doris.analysis.AdminCancelRepairTableStmt;
-import org.apache.doris.analysis.AdminRepairTableStmt;
import org.apache.doris.catalog.ColocateTableIndex;
import org.apache.doris.catalog.Database;
import org.apache.doris.catalog.Env;
@@ -505,14 +503,6 @@ public class TabletChecker extends MasterDaemon {
repairTabletInfo.dbId, repairTabletInfo.tblId,
repairTabletInfo.partIds);
}
- public void repairTable(AdminRepairTableStmt stmt) throws DdlException {
- RepairTabletInfo repairTabletInfo = getRepairTabletInfo(
- stmt.getDbName(), stmt.getTblName(), stmt.getPartitions());
- addPrios(repairTabletInfo, stmt.getTimeoutS() * 1000);
- LOG.info("repair database: {}, table: {}, partition: {}",
- repairTabletInfo.dbId, repairTabletInfo.tblId,
repairTabletInfo.partIds);
- }
-
/*
* handle ADMIN CANCEL REPAIR TABLE command send by user.
* This operation will remove the specified partitions from 'prios'
@@ -525,14 +515,6 @@ public class TabletChecker extends MasterDaemon {
repairTabletInfo.dbId, repairTabletInfo.tblId,
repairTabletInfo.partIds);
}
- public void cancelRepairTable(AdminCancelRepairTableStmt stmt) throws
DdlException {
- RepairTabletInfo repairTabletInfo
- = getRepairTabletInfo(stmt.getDbName(), stmt.getTblName(),
stmt.getPartitions());
- removePrios(repairTabletInfo);
- LOG.info("cancel repair database: {}, table: {}, partition: {}",
- repairTabletInfo.dbId, repairTabletInfo.tblId,
repairTabletInfo.partIds);
- }
-
public int getPrioPartitionNum() {
int count = 0;
synchronized (prios) {
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java
b/fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java
index d2413552b8d..c9cbfc7cf72 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/clone/TabletScheduler.java
@@ -17,8 +17,6 @@
package org.apache.doris.clone;
-import org.apache.doris.analysis.AdminCancelRebalanceDiskStmt;
-import org.apache.doris.analysis.AdminRebalanceDiskStmt;
import org.apache.doris.catalog.ColocateGroupSchema;
import org.apache.doris.catalog.ColocateTableIndex;
import org.apache.doris.catalog.ColocateTableIndex.GroupId;
@@ -310,10 +308,6 @@ public class TabletScheduler extends MasterDaemon {
return allTabletTypes.containsKey(tabletId);
}
- public synchronized void rebalanceDisk(AdminRebalanceDiskStmt stmt) {
- diskRebalancer.addPrioBackends(stmt.getBackends(), stmt.getTimeoutS());
- }
-
public synchronized void rebalanceDisk(List<Backend> backends, long
timeoutS) {
diskRebalancer.addPrioBackends(backends, timeoutS);
}
@@ -322,10 +316,6 @@ public class TabletScheduler extends MasterDaemon {
diskRebalancer.removePrioBackends(backends);
}
- public synchronized void cancelRebalanceDisk(AdminCancelRebalanceDiskStmt
stmt) {
- diskRebalancer.removePrioBackends(stmt.getBackends());
- }
-
/**
* Iterate current tablets, change their priority to VERY_HIGH if
necessary.
*/
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 57458a72206..5f06bb3ca4d 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
@@ -17,18 +17,8 @@
package org.apache.doris.qe;
-import org.apache.doris.analysis.AdminCancelRebalanceDiskStmt;
-import org.apache.doris.analysis.AdminCancelRepairTableStmt;
-import org.apache.doris.analysis.AdminCheckTabletsStmt;
-import org.apache.doris.analysis.AdminCleanTrashStmt;
-import org.apache.doris.analysis.AdminCompactTableStmt;
-import org.apache.doris.analysis.AdminRebalanceDiskStmt;
-import org.apache.doris.analysis.AdminRepairTableStmt;
import org.apache.doris.analysis.AdminSetConfigStmt;
import org.apache.doris.analysis.AdminSetPartitionVersionStmt;
-import org.apache.doris.analysis.AdminSetReplicaStatusStmt;
-import org.apache.doris.analysis.AdminSetReplicaVersionStmt;
-import org.apache.doris.analysis.AdminSetTableStatusStmt;
import org.apache.doris.analysis.AlterCatalogCommentStmt;
import org.apache.doris.analysis.AlterCatalogNameStmt;
import org.apache.doris.analysis.AlterCatalogPropertyStmt;
@@ -250,28 +240,14 @@ public class DdlExecutor {
return;
} else if (ddlStmt instanceof TruncateTableStmt) {
env.truncateTable((TruncateTableStmt) ddlStmt);
- } else if (ddlStmt instanceof AdminRepairTableStmt) {
- env.getTabletChecker().repairTable((AdminRepairTableStmt) ddlStmt);
- } else if (ddlStmt instanceof AdminCancelRepairTableStmt) {
-
env.getTabletChecker().cancelRepairTable((AdminCancelRepairTableStmt) ddlStmt);
- } else if (ddlStmt instanceof AdminCompactTableStmt) {
- env.compactTable((AdminCompactTableStmt) ddlStmt);
} else if (ddlStmt instanceof AdminSetConfigStmt) {
env.setConfig((AdminSetConfigStmt) ddlStmt);
- } else if (ddlStmt instanceof AdminSetTableStatusStmt) {
- env.setTableStatus((AdminSetTableStatusStmt) ddlStmt);
} else if (ddlStmt instanceof DropFileStmt) {
env.getSmallFileMgr().dropFile((DropFileStmt) ddlStmt);
} else if (ddlStmt instanceof InstallPluginStmt) {
env.installPlugin((InstallPluginStmt) ddlStmt);
} else if (ddlStmt instanceof UninstallPluginStmt) {
env.uninstallPlugin((UninstallPluginStmt) ddlStmt);
- } else if (ddlStmt instanceof AdminCheckTabletsStmt) {
- env.checkTablets((AdminCheckTabletsStmt) ddlStmt);
- } else if (ddlStmt instanceof AdminSetReplicaStatusStmt) {
- env.setReplicaStatus((AdminSetReplicaStatusStmt) ddlStmt);
- } else if (ddlStmt instanceof AdminSetReplicaVersionStmt) {
- env.setReplicaVersion((AdminSetReplicaVersionStmt) ddlStmt);
} else if (ddlStmt instanceof AdminSetPartitionVersionStmt) {
env.setPartitionVersion((AdminSetPartitionVersionStmt) ddlStmt);
} else if (ddlStmt instanceof CreateResourceStmt) {
@@ -284,12 +260,6 @@ public class DdlExecutor {
env.getWorkloadSchedPolicyMgr().alterWorkloadSchedPolicy((AlterWorkloadSchedPolicyStmt)
ddlStmt);
} else if (ddlStmt instanceof DropWorkloadSchedPolicyStmt) {
env.getWorkloadSchedPolicyMgr().dropWorkloadSchedPolicy((DropWorkloadSchedPolicyStmt)
ddlStmt);
- } else if (ddlStmt instanceof AdminCleanTrashStmt) {
- env.cleanTrash((AdminCleanTrashStmt) ddlStmt);
- } else if (ddlStmt instanceof AdminRebalanceDiskStmt) {
- env.getTabletScheduler().rebalanceDisk((AdminRebalanceDiskStmt)
ddlStmt);
- } else if (ddlStmt instanceof AdminCancelRebalanceDiskStmt) {
-
env.getTabletScheduler().cancelRebalanceDisk((AdminCancelRebalanceDiskStmt)
ddlStmt);
} else if (ddlStmt instanceof CreateSqlBlockRuleStmt) {
env.getSqlBlockRuleMgr().createSqlBlockRule((CreateSqlBlockRuleStmt) ddlStmt);
} else if (ddlStmt instanceof AlterSqlBlockRuleStmt) {
@@ -453,14 +423,6 @@ public class DdlExecutor {
|| ddlStmt instanceof CancelBackupStmt
|| ddlStmt instanceof CreateRepositoryStmt
|| ddlStmt instanceof DropRepositoryStmt
- || ddlStmt instanceof AdminRepairTableStmt
- || ddlStmt instanceof AdminCancelRepairTableStmt
- || ddlStmt instanceof AdminCompactTableStmt
- || ddlStmt instanceof AdminCheckTabletsStmt
- || ddlStmt instanceof AdminSetReplicaStatusStmt
- || ddlStmt instanceof AdminCleanTrashStmt
- || ddlStmt instanceof AdminRebalanceDiskStmt
- || ddlStmt instanceof AdminCancelRebalanceDiskStmt
|| ddlStmt instanceof AlterResourceStmt
|| ddlStmt instanceof AlterPolicyStmt
|| ddlStmt instanceof CancelAlterSystemStmt) {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
b/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
index f153c5305a4..a273f59aaa1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
@@ -17,7 +17,6 @@
package org.apache.doris.qe;
-import org.apache.doris.analysis.AdminCopyTabletStmt;
import org.apache.doris.analysis.DiagnoseTabletStmt;
import org.apache.doris.analysis.HelpStmt;
import org.apache.doris.analysis.PartitionNames;
@@ -30,22 +29,17 @@ import org.apache.doris.analysis.ShowCreateLoadStmt;
import org.apache.doris.analysis.ShowCreateMTMVStmt;
import org.apache.doris.analysis.ShowEnginesStmt;
import org.apache.doris.analysis.ShowStmt;
-import org.apache.doris.catalog.Database;
import org.apache.doris.catalog.DatabaseIf;
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.Function;
import org.apache.doris.catalog.MTMV;
import org.apache.doris.catalog.OlapTable;
-import org.apache.doris.catalog.Replica;
import org.apache.doris.catalog.TableIf;
-import org.apache.doris.catalog.TabletInvertedIndex;
-import org.apache.doris.catalog.TabletMeta;
import org.apache.doris.cloud.catalog.CloudEnv;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.CaseSensibility;
import org.apache.doris.common.Config;
import org.apache.doris.common.DdlException;
-import org.apache.doris.common.MarkedCountDownLatch;
import org.apache.doris.common.Pair;
import org.apache.doris.common.proc.ProcNodeInterface;
import org.apache.doris.common.proc.RollupProcDir;
@@ -62,13 +56,7 @@ import
org.apache.doris.statistics.PartitionColumnStatisticCacheKey;
import org.apache.doris.statistics.ResultRow;
import org.apache.doris.statistics.StatisticsRepository;
import org.apache.doris.statistics.util.StatisticsUtil;
-import org.apache.doris.system.Backend;
import org.apache.doris.system.Diagnoser;
-import org.apache.doris.task.AgentBatchTask;
-import org.apache.doris.task.AgentTaskExecutor;
-import org.apache.doris.task.AgentTaskQueue;
-import org.apache.doris.task.SnapshotTask;
-import org.apache.doris.thrift.TTaskType;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
@@ -87,7 +75,6 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
-import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
// Execute one show statement.
@@ -123,8 +110,6 @@ public class ShowExecutor {
handleAdminDiagnoseTablet();
} else if (stmt instanceof ShowAnalyzeStmt) {
handleShowAnalyze();
- } else if (stmt instanceof AdminCopyTabletStmt) {
- handleCopyTablet();
} else if (stmt instanceof ShowAnalyzeTaskStatus) {
handleShowAnalyzeTaskStatus();
} else if (stmt instanceof ShowCloudWarmUpStmt) {
@@ -501,105 +486,6 @@ public class ShowExecutor {
resultSet = new ShowResultSet(showStmt.getMetaData(), resultRows);
}
- private void handleCopyTablet() throws AnalysisException {
- AdminCopyTabletStmt copyStmt = (AdminCopyTabletStmt) stmt;
- long tabletId = copyStmt.getTabletId();
- long version = copyStmt.getVersion();
- long backendId = copyStmt.getBackendId();
-
- TabletInvertedIndex invertedIndex = Env.getCurrentInvertedIndex();
- TabletMeta tabletMeta = invertedIndex.getTabletMeta(tabletId);
- if (tabletMeta == null) {
- throw new AnalysisException("Unknown tablet: " + tabletId);
- }
-
- // 1. find replica
- Replica replica = null;
- if (backendId != -1) {
- replica = invertedIndex.getReplica(tabletId, backendId);
- } else {
- List<Replica> replicas =
invertedIndex.getReplicasByTabletId(tabletId);
- if (!replicas.isEmpty()) {
- replica = replicas.get(0);
- }
- }
- if (replica == null) {
- throw new AnalysisException("Replica not found on backend: " +
backendId);
- }
- backendId = replica.getBackendIdWithoutException();
- Backend be = Env.getCurrentSystemInfo().getBackend(backendId);
- if (be == null || !be.isAlive()) {
- throw new AnalysisException("Unavailable backend: " + backendId);
- }
-
- // 2. find version
- if (version != -1 && replica.getVersion() < version) {
- throw new AnalysisException("Version is larger than replica max
version: " + replica.getVersion());
- }
- version = version == -1 ? replica.getVersion() : version;
-
- // 3. get create table stmt
- Database db =
Env.getCurrentInternalCatalog().getDbOrAnalysisException(tabletMeta.getDbId());
- OlapTable tbl = (OlapTable)
db.getTableNullable(tabletMeta.getTableId());
- if (tbl == null) {
- throw new AnalysisException("Failed to find table: " +
tabletMeta.getTableId());
- }
-
- List<String> createTableStmt = Lists.newArrayList();
- tbl.readLock();
- try {
- Env.getDdlStmt(tbl, createTableStmt, null, null, false, true /*
hide password */, version);
- } finally {
- tbl.readUnlock();
- }
-
- // 4. create snapshot task
- SnapshotTask task = new SnapshotTask(null, backendId, tabletId, -1,
tabletMeta.getDbId(),
- tabletMeta.getTableId(), tabletMeta.getPartitionId(),
tabletMeta.getIndexId(), tabletId, version, 0,
- copyStmt.getExpirationMinutes() * 60 * 1000, false);
- task.setIsCopyTabletTask(true);
- MarkedCountDownLatch<Long, Long> countDownLatch = new
MarkedCountDownLatch<Long, Long>(1);
- countDownLatch.addMark(backendId, tabletId);
- task.setCountDownLatch(countDownLatch);
-
- // 5. send task and wait
- AgentBatchTask batchTask = new AgentBatchTask();
- batchTask.addTask(task);
- try {
- AgentTaskQueue.addBatchTask(batchTask);
- AgentTaskExecutor.submit(batchTask);
-
- boolean ok = false;
- try {
- ok = countDownLatch.await(10, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- LOG.warn("InterruptedException: ", e);
- ok = false;
- }
-
- if (!ok) {
- throw new AnalysisException(
- "Failed to make snapshot for tablet " + tabletId + "
on backend: " + backendId);
- }
-
- // send result
- List<List<String>> resultRowSet = Lists.newArrayList();
- List<String> row = Lists.newArrayList();
- row.add(String.valueOf(tabletId));
- row.add(String.valueOf(backendId));
- row.add(be.getHost());
- row.add(task.getResultSnapshotPath());
- row.add(String.valueOf(copyStmt.getExpirationMinutes()));
- row.add(createTableStmt.get(0));
- resultRowSet.add(row);
-
- ShowResultSetMetaData showMetaData = copyStmt.getMetaData();
- resultSet = new ShowResultSet(showMetaData, resultRowSet);
- } finally {
- AgentTaskQueue.removeBatchTask(batchTask, TTaskType.MAKE_SNAPSHOT);
- }
- }
-
private void handleShowAnalyzeTaskStatus() {
ShowAnalyzeTaskStatus showStmt = (ShowAnalyzeTaskStatus) stmt;
AnalysisInfo jobInfo =
Env.getCurrentEnv().getAnalysisManager().findJobInfo(showStmt.getJobId());
@@ -632,8 +518,7 @@ public class ShowExecutor {
return;
}
- if (stmt instanceof DiagnoseTabletStmt
- || stmt instanceof AdminCopyTabletStmt) {
+ if (stmt instanceof DiagnoseTabletStmt) {
LOG.info("stmt={}, not supported in cloud mode", stmt.toString());
throw new AnalysisException("Unsupported operation");
}
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/analysis/AdminCancelRebalanceDiskStmtTest.java
b/fe/fe-core/src/test/java/org/apache/doris/analysis/AdminCancelRebalanceDiskStmtTest.java
deleted file mode 100644
index dfc0ed04269..00000000000
---
a/fe/fe-core/src/test/java/org/apache/doris/analysis/AdminCancelRebalanceDiskStmtTest.java
+++ /dev/null
@@ -1,78 +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.clone.RebalancerTestUtil;
-import org.apache.doris.common.UserException;
-import org.apache.doris.mysql.privilege.AccessControllerManager;
-import org.apache.doris.mysql.privilege.MockedAuth;
-import org.apache.doris.qe.ConnectContext;
-
-import com.google.common.collect.Lists;
-import mockit.Mocked;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.List;
-
-public class AdminCancelRebalanceDiskStmtTest {
-
- private static Analyzer analyzer;
-
- @Mocked
- private AccessControllerManager accessManager;
- @Mocked
- private ConnectContext ctx;
-
- @Before()
- public void setUp() {
- MockedAuth.mockedAccess(accessManager);
- MockedAuth.mockedConnectContext(ctx, "root", "192.168.1.1");
- analyzer = AccessTestUtil.fetchAdminAnalyzer(true);
-
- List<Long> beIds = Lists.newArrayList(10001L, 10002L, 10003L, 10004L);
- beIds.forEach(id ->
Env.getCurrentSystemInfo().addBackend(RebalancerTestUtil.createBackend(id,
2048, 0)));
- }
-
- @Test
- public void testParticularBackends() throws UserException {
- List<String> backends = Lists.newArrayList(
- "192.168.0.10003:9051", "192.168.0.10004:9051",
"192.168.0.10005:9051", "192.168.0.10006:9051");
- final AdminCancelRebalanceDiskStmt stmt = new
AdminCancelRebalanceDiskStmt(backends);
- stmt.analyze(analyzer);
- Assert.assertEquals(2, stmt.getBackends().size());
- }
-
- @Test
- public void testEmpty() throws UserException {
- List<String> backends = Lists.newArrayList();
- final AdminCancelRebalanceDiskStmt stmt = new
AdminCancelRebalanceDiskStmt(backends);
- stmt.analyze(analyzer);
- Assert.assertEquals(0, stmt.getBackends().size());
- }
-
- @Test
- public void testNull() throws UserException {
- final AdminCancelRebalanceDiskStmt stmt = new
AdminCancelRebalanceDiskStmt(null);
- stmt.analyze(analyzer);
- Assert.assertEquals(4, stmt.getBackends().size());
- }
-
-}
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/analysis/AdminRebalanceDiskStmtTest.java
b/fe/fe-core/src/test/java/org/apache/doris/analysis/AdminRebalanceDiskStmtTest.java
deleted file mode 100644
index 86f2e97890d..00000000000
---
a/fe/fe-core/src/test/java/org/apache/doris/analysis/AdminRebalanceDiskStmtTest.java
+++ /dev/null
@@ -1,77 +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.clone.RebalancerTestUtil;
-import org.apache.doris.common.AnalysisException;
-import org.apache.doris.mysql.privilege.AccessControllerManager;
-import org.apache.doris.mysql.privilege.MockedAuth;
-import org.apache.doris.qe.ConnectContext;
-
-import com.google.common.collect.Lists;
-import mockit.Mocked;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.List;
-
-public class AdminRebalanceDiskStmtTest {
-
- private static Analyzer analyzer;
-
- @Mocked
- private AccessControllerManager accessManager;
- @Mocked
- private ConnectContext ctx;
-
- @Before
- public void setUp() {
- MockedAuth.mockedAccess(accessManager);
- MockedAuth.mockedConnectContext(ctx, "root", "192.168.1.1");
- analyzer = AccessTestUtil.fetchAdminAnalyzer(true);
-
- List<Long> beIds = Lists.newArrayList(10001L, 10002L, 10003L, 10004L);
- beIds.forEach(id ->
Env.getCurrentSystemInfo().addBackend(RebalancerTestUtil.createBackend(id,
2048, 0)));
- }
-
- @Test
- public void testParticularBackends() throws AnalysisException {
- List<String> backends = Lists.newArrayList(
- "192.168.0.10003:9051", "192.168.0.10004:9051",
"192.168.0.10005:9051", "192.168.0.10006:9051");
- final AdminRebalanceDiskStmt stmt = new
AdminRebalanceDiskStmt(backends);
- stmt.analyze(analyzer);
- Assert.assertEquals(2, stmt.getBackends().size());
- }
-
- @Test
- public void testEmpty() throws AnalysisException {
- List<String> backends = Lists.newArrayList();
- final AdminRebalanceDiskStmt stmt = new
AdminRebalanceDiskStmt(backends);
- stmt.analyze(analyzer);
- Assert.assertEquals(0, stmt.getBackends().size());
- }
-
- @Test
- public void testNull() throws AnalysisException {
- final AdminRebalanceDiskStmt stmt = new AdminRebalanceDiskStmt(null);
- stmt.analyze(analyzer);
- Assert.assertEquals(4, stmt.getBackends().size());
- }
-}
diff --git
a/fe/fe-core/src/test/java/org/apache/doris/catalog/AdminStmtTest.java
b/fe/fe-core/src/test/java/org/apache/doris/catalog/AdminStmtTest.java
index 4da136f6eb9..09fc0f3e9e2 100644
--- a/fe/fe-core/src/test/java/org/apache/doris/catalog/AdminStmtTest.java
+++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/AdminStmtTest.java
@@ -17,12 +17,8 @@
package org.apache.doris.catalog;
-import org.apache.doris.analysis.AdminSetReplicaStatusStmt;
-import org.apache.doris.analysis.AdminSetReplicaVersionStmt;
-import org.apache.doris.catalog.MaterializedIndex.IndexExtState;
import org.apache.doris.catalog.Replica.ReplicaStatus;
import org.apache.doris.common.AnalysisException;
-import org.apache.doris.common.Pair;
import org.apache.doris.persist.SetPartitionVersionOperationLog;
import org.apache.doris.persist.SetReplicaStatusOperationLog;
import org.apache.doris.persist.SetReplicaVersionOperationLog;
@@ -74,105 +70,6 @@ public class AdminStmtTest extends TestWithFeService {
+ ");");
}
- @Test
- public void testAdminSetReplicaStatus() throws Exception {
- Database db = Env.getCurrentInternalCatalog().getDbNullable("test");
- Assertions.assertNotNull(db);
- OlapTable tbl = (OlapTable) db.getTableNullable("tbl1");
- Assertions.assertNotNull(tbl);
- // tablet id, backend id
- List<Pair<Long, Long>> tabletToBackendList = Lists.newArrayList();
- for (Partition partition : tbl.getPartitions()) {
- for (MaterializedIndex index :
partition.getMaterializedIndices(IndexExtState.VISIBLE)) {
- for (Tablet tablet : index.getTablets()) {
- for (Replica replica : tablet.getReplicas()) {
- tabletToBackendList.add(Pair.of(tablet.getId(),
replica.getBackendId()));
- }
- }
- }
- }
- Assertions.assertEquals(3, tabletToBackendList.size());
- long tabletId = tabletToBackendList.get(0).first;
- long backendId = tabletToBackendList.get(0).second;
- Replica replica = Env.getCurrentInvertedIndex().getReplica(tabletId,
backendId);
- Assertions.assertFalse(replica.isBad());
-
- // set replica to bad
- String adminStmt = "admin set replica status properties ('tablet_id' =
'" + tabletId + "', 'backend_id' = '"
- + backendId + "', 'status' = 'bad');";
- AdminSetReplicaStatusStmt stmt = (AdminSetReplicaStatusStmt)
parseAndAnalyzeStmt(adminStmt);
- Env.getCurrentEnv().setReplicaStatus(stmt);
- replica = Env.getCurrentInvertedIndex().getReplica(tabletId,
backendId);
- Assertions.assertTrue(replica.isBad());
-
- // set replica to ok
- adminStmt = "admin set replica status properties ('tablet_id' = '" +
tabletId + "', 'backend_id' = '"
- + backendId + "', 'status' = 'ok');";
- stmt = (AdminSetReplicaStatusStmt) parseAndAnalyzeStmt(adminStmt);
- Env.getCurrentEnv().setReplicaStatus(stmt);
- replica = Env.getCurrentInvertedIndex().getReplica(tabletId,
backendId);
- Assertions.assertFalse(replica.isBad());
- }
-
- @Test
- public void testAdminSetReplicaVersion() throws Exception {
- Database db = Env.getCurrentInternalCatalog().getDbNullable("test");
- Assertions.assertNotNull(db);
- OlapTable tbl = (OlapTable) db.getTableNullable("tbl3");
- Assertions.assertNotNull(tbl);
- // tablet id, backend id
- List<Pair<Long, Long>> tabletToBackendList = Lists.newArrayList();
- for (Partition partition : tbl.getPartitions()) {
- for (MaterializedIndex index :
partition.getMaterializedIndices(IndexExtState.VISIBLE)) {
- for (Tablet tablet : index.getTablets()) {
- for (Replica replica : tablet.getReplicas()) {
- tabletToBackendList.add(Pair.of(tablet.getId(),
replica.getBackendId()));
- }
- }
- }
- }
- Assertions.assertEquals(3, tabletToBackendList.size());
- long tabletId = tabletToBackendList.get(0).first;
- long backendId = tabletToBackendList.get(0).second;
- Replica replica = Env.getCurrentInvertedIndex().getReplica(tabletId,
backendId);
-
- String adminStmt = "admin set replica version properties ('tablet_id'
= '" + tabletId + "', 'backend_id' = '"
- + backendId + "', 'version' = '10', 'last_failed_version' =
'100');";
- AdminSetReplicaVersionStmt stmt = (AdminSetReplicaVersionStmt)
parseAndAnalyzeStmt(adminStmt);
- Env.getCurrentEnv().setReplicaVersion(stmt);
- Assertions.assertEquals(10L, replica.getVersion());
- Assertions.assertEquals(10L, replica.getLastSuccessVersion());
- Assertions.assertEquals(100L, replica.getLastFailedVersion());
-
- adminStmt = "admin set replica version properties ('tablet_id' = '" +
tabletId + "', 'backend_id' = '"
- + backendId + "', 'version' = '50');";
- stmt = (AdminSetReplicaVersionStmt) parseAndAnalyzeStmt(adminStmt);
- Env.getCurrentEnv().setReplicaVersion(stmt);
- Assertions.assertEquals(50L, replica.getVersion());
- Assertions.assertEquals(50L, replica.getLastSuccessVersion());
- Assertions.assertEquals(100L, replica.getLastFailedVersion());
-
- adminStmt = "admin set replica version properties ('tablet_id' = '" +
tabletId + "', 'backend_id' = '"
- + backendId + "', 'version' = '200');";
- stmt = (AdminSetReplicaVersionStmt) parseAndAnalyzeStmt(adminStmt);
- Env.getCurrentEnv().setReplicaVersion(stmt);
- Assertions.assertEquals(200L, replica.getVersion());
- Assertions.assertEquals(200L, replica.getLastSuccessVersion());
- Assertions.assertEquals(-1L, replica.getLastFailedVersion());
-
- adminStmt = "admin set replica version properties ('tablet_id' = '" +
tabletId + "', 'backend_id' = '"
- + backendId + "', 'last_failed_version' = '300');";
- stmt = (AdminSetReplicaVersionStmt) parseAndAnalyzeStmt(adminStmt);
- Env.getCurrentEnv().setReplicaVersion(stmt);
- Assertions.assertEquals(300L, replica.getLastFailedVersion());
-
- adminStmt = "admin set replica version properties ('tablet_id' = '" +
tabletId + "', 'backend_id' = '"
- + backendId + "', 'last_failed_version' = '-1');";
- stmt = (AdminSetReplicaVersionStmt) parseAndAnalyzeStmt(adminStmt);
- Env.getCurrentEnv().setReplicaVersion(stmt);
- Assertions.assertEquals(-1L, replica.getLastFailedVersion());
- }
-
@Test
public void testSetReplicaVersionOperationLog() throws IOException,
AnalysisException {
String fileName = "./SetReplicaVersionOperationLog";
@@ -300,39 +197,4 @@ public class AdminStmtTest extends TestWithFeService {
Files.deleteIfExists(path);
}
}
-
- @Test
- public void testAdminSetTrimPropertyKey() throws Exception {
- Database db = Env.getCurrentInternalCatalog().getDbNullable("test");
- Assertions.assertNotNull(db);
- OlapTable tbl = (OlapTable) db.getTableNullable("tbl3");
- Assertions.assertNotNull(tbl);
- // tablet id, backend id
- List<Pair<Long, Long>> tabletToBackendList = Lists.newArrayList();
- for (Partition partition : tbl.getPartitions()) {
- for (MaterializedIndex index :
partition.getMaterializedIndices(IndexExtState.VISIBLE)) {
- for (Tablet tablet : index.getTablets()) {
- for (Replica replica : tablet.getReplicas()) {
- tabletToBackendList.add(Pair.of(tablet.getId(),
replica.getBackendId()));
- }
- }
- }
- }
- Assertions.assertEquals(3, tabletToBackendList.size());
- long tabletId = tabletToBackendList.get(0).first;
- long backendId = tabletToBackendList.get(0).second;
- Replica replica = Env.getCurrentInvertedIndex().getReplica(tabletId,
backendId);
-
- String adminStmt = "admin set replica version properties ("
- + "' tablet_id' = '" + tabletId + "', "
- + "'backend_id ' = '" + backendId + "', "
- + "' version ' = '10', "
- + "' last_failed_version ' = '100');";
- AdminSetReplicaVersionStmt stmt = (AdminSetReplicaVersionStmt)
parseAndAnalyzeStmt(adminStmt);
- Env.getCurrentEnv().setReplicaVersion(stmt);
- Assertions.assertEquals(10L, replica.getVersion());
- Assertions.assertEquals(10L, replica.getLastSuccessVersion());
- Assertions.assertEquals(100L, replica.getLastFailedVersion());
- }
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]