[Refactor](admin-stmt) rename some admin-show statestmt (#29492)
The `ADMIN SHOW` statement can not be executed with high version of mysql 8.x jdbc driver. So I rename these statement, remove the `ADMIN` keywords. 1. ADMIN SHOW CONFIG -> SHOW CONFIG 2. ADMIN SHOW REPLICA -> SHOW REPLICA 3. ADMIN DIAGNOSE TABLET -> SHOW TABLET DIAGNOSIS 4. ADMIN SHOW TABLET -> SHOW TABLET for compatibility, the old statements are still supported, but not recommend to use. They will be removed in later version
This commit is contained in:
@ -29,15 +29,15 @@ import org.apache.doris.qe.ShowResultSetMetaData;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
// ADMIN DIAGNOSE TABLET tablet_id
|
||||
public class AdminDiagnoseTabletStmt extends ShowStmt {
|
||||
// SHOW TABLET DIAGNOSIS tablet_id
|
||||
public class DiagnoseTabletStmt extends ShowStmt {
|
||||
public static final ImmutableList<String> TITLE_NAMES = new ImmutableList.Builder<String>()
|
||||
.add("Item").add("Info").add("Suggestion")
|
||||
.build();
|
||||
|
||||
private long tabletId;
|
||||
|
||||
public AdminDiagnoseTabletStmt(long tabletId) {
|
||||
public DiagnoseTabletStmt(long tabletId) {
|
||||
this.tabletId = tabletId;
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ public class AdminDiagnoseTabletStmt extends ShowStmt {
|
||||
|
||||
@Override
|
||||
public String toSql() {
|
||||
return "ADMIN DIAGNOSE TABLET " + tabletId;
|
||||
return "SHOW TABLET DIAGNOSIS " + tabletId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -31,8 +31,8 @@ import org.apache.doris.qe.ShowResultSetMetaData;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
// admin show frontend config;
|
||||
public class AdminShowConfigStmt extends ShowStmt {
|
||||
// show frontend config;
|
||||
public class ShowConfigStmt extends ShowStmt {
|
||||
public static final ImmutableList<String> TITLE_NAMES = new ImmutableList.Builder<String>().add("Key").add(
|
||||
"Value").add("Type").add("IsMutable").add("MasterOnly").add("Comment").build();
|
||||
|
||||
@ -40,7 +40,7 @@ public class AdminShowConfigStmt extends ShowStmt {
|
||||
|
||||
private String pattern;
|
||||
|
||||
public AdminShowConfigStmt(ConfigType type, String pattern) {
|
||||
public ShowConfigStmt(ConfigType type, String pattern) {
|
||||
this.type = type;
|
||||
this.pattern = pattern;
|
||||
}
|
||||
@ -31,8 +31,8 @@ import org.apache.doris.qe.ShowResultSetMetaData;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
// admin show replica distribution from tbl [partition(p1, p2, ...)]
|
||||
public class AdminShowReplicaDistributionStmt extends ShowStmt {
|
||||
// show replica distribution from tbl [partition(p1, p2, ...)]
|
||||
public class ShowReplicaDistributionStmt extends ShowStmt {
|
||||
public static final ImmutableList<String> TITLE_NAMES = new ImmutableList.Builder<String>()
|
||||
.add("BackendId").add("ReplicaNum").add("ReplicaSize")
|
||||
.add("NumGraph").add("NumPercent")
|
||||
@ -41,7 +41,7 @@ public class AdminShowReplicaDistributionStmt extends ShowStmt {
|
||||
|
||||
private TableRef tblRef;
|
||||
|
||||
public AdminShowReplicaDistributionStmt(TableRef tblRef) {
|
||||
public ShowReplicaDistributionStmt(TableRef tblRef) {
|
||||
this.tblRef = tblRef;
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AdminShowReplicaStatusStmt extends ShowStmt {
|
||||
public class ShowReplicaStatusStmt extends ShowStmt {
|
||||
public static final ImmutableList<String> TITLE_NAMES = new ImmutableList.Builder<String>()
|
||||
.add("TabletId").add("ReplicaId").add("BackendId").add("Version").add("LastFailedVersion")
|
||||
.add("LastSuccessVersion").add("CommittedVersion").add("SchemaHash").add("VersionNum")
|
||||
@ -50,7 +50,7 @@ public class AdminShowReplicaStatusStmt extends ShowStmt {
|
||||
private Operator op;
|
||||
private ReplicaStatus statusFilter;
|
||||
|
||||
public AdminShowReplicaStatusStmt(TableRef tblRef, Expr where) {
|
||||
public ShowReplicaStatusStmt(TableRef tblRef, Expr where) {
|
||||
this.tblRef = tblRef;
|
||||
this.where = where;
|
||||
}
|
||||
@ -27,10 +27,10 @@ import org.apache.doris.mysql.privilege.PrivPredicate;
|
||||
import org.apache.doris.qe.ConnectContext;
|
||||
import org.apache.doris.qe.ShowResultSetMetaData;
|
||||
|
||||
public class AdminShowTabletStorageFormatStmt extends ShowStmt {
|
||||
public class ShowTabletStorageFormatStmt extends ShowStmt {
|
||||
private boolean verbose;
|
||||
|
||||
public AdminShowTabletStorageFormatStmt(boolean verbose) {
|
||||
public ShowTabletStorageFormatStmt(boolean verbose) {
|
||||
this.verbose = verbose;
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ public class AdminShowTabletStorageFormatStmt extends ShowStmt {
|
||||
|
||||
@Override
|
||||
public String toSql() {
|
||||
StringBuilder sb = new StringBuilder("ADMIN SHOW TABLET STORAGE TYPE");
|
||||
StringBuilder sb = new StringBuilder("SHOW TABLET STORAGE TYPE");
|
||||
if (verbose) {
|
||||
sb.append(" VERBOSE");
|
||||
}
|
||||
@ -17,11 +17,11 @@
|
||||
|
||||
package org.apache.doris.catalog;
|
||||
|
||||
import org.apache.doris.analysis.AdminShowReplicaDistributionStmt;
|
||||
import org.apache.doris.analysis.AdminShowReplicaStatusStmt;
|
||||
import org.apache.doris.analysis.BinaryPredicate.Operator;
|
||||
import org.apache.doris.analysis.PartitionNames;
|
||||
import org.apache.doris.analysis.ShowDataSkewStmt;
|
||||
import org.apache.doris.analysis.ShowReplicaDistributionStmt;
|
||||
import org.apache.doris.analysis.ShowReplicaStatusStmt;
|
||||
import org.apache.doris.catalog.MaterializedIndex.IndexExtState;
|
||||
import org.apache.doris.catalog.Replica.ReplicaStatus;
|
||||
import org.apache.doris.common.DdlException;
|
||||
@ -39,7 +39,7 @@ import java.util.Map;
|
||||
|
||||
public class MetadataViewer {
|
||||
|
||||
public static List<List<String>> getTabletStatus(AdminShowReplicaStatusStmt stmt) throws DdlException {
|
||||
public static List<List<String>> getTabletStatus(ShowReplicaStatusStmt stmt) throws DdlException {
|
||||
return getTabletStatus(stmt.getDbName(), stmt.getTblName(), stmt.getPartitions(),
|
||||
stmt.getStatusFilter(), stmt.getOp());
|
||||
}
|
||||
@ -155,7 +155,7 @@ public class MetadataViewer {
|
||||
}
|
||||
}
|
||||
|
||||
public static List<List<String>> getTabletDistribution(AdminShowReplicaDistributionStmt stmt) throws DdlException {
|
||||
public static List<List<String>> getTabletDistribution(ShowReplicaDistributionStmt stmt) throws DdlException {
|
||||
return getTabletDistribution(stmt.getDbName(), stmt.getTblName(), stmt.getPartitionNames());
|
||||
}
|
||||
|
||||
|
||||
@ -18,12 +18,8 @@
|
||||
package org.apache.doris.qe;
|
||||
|
||||
import org.apache.doris.analysis.AdminCopyTabletStmt;
|
||||
import org.apache.doris.analysis.AdminDiagnoseTabletStmt;
|
||||
import org.apache.doris.analysis.AdminShowConfigStmt;
|
||||
import org.apache.doris.analysis.AdminShowReplicaDistributionStmt;
|
||||
import org.apache.doris.analysis.AdminShowReplicaStatusStmt;
|
||||
import org.apache.doris.analysis.AdminShowTabletStorageFormatStmt;
|
||||
import org.apache.doris.analysis.DescribeStmt;
|
||||
import org.apache.doris.analysis.DiagnoseTabletStmt;
|
||||
import org.apache.doris.analysis.Expr;
|
||||
import org.apache.doris.analysis.HelpStmt;
|
||||
import org.apache.doris.analysis.LimitElement;
|
||||
@ -42,6 +38,7 @@ import org.apache.doris.analysis.ShowCollationStmt;
|
||||
import org.apache.doris.analysis.ShowColumnHistStmt;
|
||||
import org.apache.doris.analysis.ShowColumnStatsStmt;
|
||||
import org.apache.doris.analysis.ShowColumnStmt;
|
||||
import org.apache.doris.analysis.ShowConfigStmt;
|
||||
import org.apache.doris.analysis.ShowConvertLSCStmt;
|
||||
import org.apache.doris.analysis.ShowCreateCatalogStmt;
|
||||
import org.apache.doris.analysis.ShowCreateDbStmt;
|
||||
@ -77,6 +74,8 @@ import org.apache.doris.analysis.ShowProcStmt;
|
||||
import org.apache.doris.analysis.ShowProcesslistStmt;
|
||||
import org.apache.doris.analysis.ShowQueryProfileStmt;
|
||||
import org.apache.doris.analysis.ShowQueryStatsStmt;
|
||||
import org.apache.doris.analysis.ShowReplicaDistributionStmt;
|
||||
import org.apache.doris.analysis.ShowReplicaStatusStmt;
|
||||
import org.apache.doris.analysis.ShowRepositoriesStmt;
|
||||
import org.apache.doris.analysis.ShowResourcesStmt;
|
||||
import org.apache.doris.analysis.ShowRestoreStmt;
|
||||
@ -96,6 +95,7 @@ import org.apache.doris.analysis.ShowTableStatsStmt;
|
||||
import org.apache.doris.analysis.ShowTableStatusStmt;
|
||||
import org.apache.doris.analysis.ShowTableStmt;
|
||||
import org.apache.doris.analysis.ShowTabletStmt;
|
||||
import org.apache.doris.analysis.ShowTabletStorageFormatStmt;
|
||||
import org.apache.doris.analysis.ShowTabletsBelongStmt;
|
||||
import org.apache.doris.analysis.ShowTransactionStmt;
|
||||
import org.apache.doris.analysis.ShowTrashDiskStmt;
|
||||
@ -370,11 +370,11 @@ public class ShowExecutor {
|
||||
handleShowTrash();
|
||||
} else if (stmt instanceof ShowTrashDiskStmt) {
|
||||
handleShowTrashDisk();
|
||||
} else if (stmt instanceof AdminShowReplicaStatusStmt) {
|
||||
} else if (stmt instanceof ShowReplicaStatusStmt) {
|
||||
handleAdminShowTabletStatus();
|
||||
} else if (stmt instanceof AdminShowReplicaDistributionStmt) {
|
||||
} else if (stmt instanceof ShowReplicaDistributionStmt) {
|
||||
handleAdminShowTabletDistribution();
|
||||
} else if (stmt instanceof AdminShowConfigStmt) {
|
||||
} else if (stmt instanceof ShowConfigStmt) {
|
||||
handleAdminShowConfig();
|
||||
} else if (stmt instanceof ShowSmallFilesStmt) {
|
||||
handleShowSmallFiles();
|
||||
@ -408,9 +408,9 @@ public class ShowExecutor {
|
||||
handleShowTableCreation();
|
||||
} else if (stmt instanceof ShowLastInsertStmt) {
|
||||
handleShowLastInsert();
|
||||
} else if (stmt instanceof AdminShowTabletStorageFormatStmt) {
|
||||
} else if (stmt instanceof ShowTabletStorageFormatStmt) {
|
||||
handleAdminShowTabletStorageFormat();
|
||||
} else if (stmt instanceof AdminDiagnoseTabletStmt) {
|
||||
} else if (stmt instanceof DiagnoseTabletStmt) {
|
||||
handleAdminDiagnoseTablet();
|
||||
} else if (stmt instanceof ShowCreateMaterializedViewStmt) {
|
||||
handleShowCreateMaterializedView();
|
||||
@ -2107,7 +2107,7 @@ public class ShowExecutor {
|
||||
}
|
||||
|
||||
private void handleAdminShowTabletStatus() throws AnalysisException {
|
||||
AdminShowReplicaStatusStmt showStmt = (AdminShowReplicaStatusStmt) stmt;
|
||||
ShowReplicaStatusStmt showStmt = (ShowReplicaStatusStmt) stmt;
|
||||
List<List<String>> results;
|
||||
try {
|
||||
results = MetadataViewer.getTabletStatus(showStmt);
|
||||
@ -2118,7 +2118,7 @@ public class ShowExecutor {
|
||||
}
|
||||
|
||||
private void handleAdminShowTabletDistribution() throws AnalysisException {
|
||||
AdminShowReplicaDistributionStmt showStmt = (AdminShowReplicaDistributionStmt) stmt;
|
||||
ShowReplicaDistributionStmt showStmt = (ShowReplicaDistributionStmt) stmt;
|
||||
List<List<String>> results;
|
||||
try {
|
||||
results = MetadataViewer.getTabletDistribution(showStmt);
|
||||
@ -2129,7 +2129,7 @@ public class ShowExecutor {
|
||||
}
|
||||
|
||||
private void handleAdminShowConfig() throws AnalysisException {
|
||||
AdminShowConfigStmt showStmt = (AdminShowConfigStmt) stmt;
|
||||
ShowConfigStmt showStmt = (ShowConfigStmt) stmt;
|
||||
List<List<String>> results;
|
||||
|
||||
PatternMatcher matcher = null;
|
||||
@ -2605,7 +2605,7 @@ public class ShowExecutor {
|
||||
}
|
||||
|
||||
private void handleAdminDiagnoseTablet() {
|
||||
AdminDiagnoseTabletStmt showStmt = (AdminDiagnoseTabletStmt) stmt;
|
||||
DiagnoseTabletStmt showStmt = (DiagnoseTabletStmt) stmt;
|
||||
List<List<String>> resultRowSet = Diagnoser.diagnoseTablet(showStmt.getTabletId());
|
||||
ShowResultSetMetaData showMetaData = showStmt.getMetaData();
|
||||
resultSet = new ShowResultSet(showMetaData, resultRowSet);
|
||||
|
||||
Reference in New Issue
Block a user