[minor](Nereids): remove useless method isMysqlCompatibleDatabase (#30064)
This commit is contained in:
@ -17,9 +17,9 @@
|
||||
|
||||
package org.apache.doris.analysis;
|
||||
|
||||
import org.apache.doris.catalog.Database;
|
||||
import org.apache.doris.catalog.DatabaseIf;
|
||||
import org.apache.doris.catalog.Env;
|
||||
import org.apache.doris.catalog.MysqlCompatibleDatabase;
|
||||
import org.apache.doris.common.ErrorCode;
|
||||
import org.apache.doris.common.ErrorReport;
|
||||
import org.apache.doris.common.UserException;
|
||||
@ -62,7 +62,7 @@ public class DropDbStmt extends DdlStmt {
|
||||
InternalDatabaseUtil.checkDatabase(dbName, ConnectContext.get());
|
||||
// Don't allow to drop mysql compatible databases
|
||||
DatabaseIf db = Env.getCurrentInternalCatalog().getDbNullable(dbName);
|
||||
if (db != null && (db instanceof Database) && ((Database) db).isMysqlCompatibleDatabase()) {
|
||||
if (db != null && db instanceof MysqlCompatibleDatabase) {
|
||||
ErrorReport.reportAnalysisException(ErrorCode.ERR_DBACCESS_DENIED_ERROR,
|
||||
analyzer.getQualifiedUser(), dbName);
|
||||
}
|
||||
|
||||
@ -84,14 +84,14 @@ public class Database extends MetaObject implements Writable, DatabaseIf<Table>
|
||||
private long id;
|
||||
@SerializedName(value = "fullQualifiedName")
|
||||
private volatile String fullQualifiedName;
|
||||
private ReentrantReadWriteLock rwLock;
|
||||
private final ReentrantReadWriteLock rwLock;
|
||||
|
||||
// table family group map
|
||||
private Map<Long, Table> idToTable;
|
||||
private final Map<Long, Table> idToTable;
|
||||
@SerializedName(value = "nameToTable")
|
||||
private Map<String, Table> nameToTable;
|
||||
// table name lower cast -> table name
|
||||
private Map<String, String> lowerCaseToTableName;
|
||||
private final Map<String, String> lowerCaseToTableName;
|
||||
|
||||
// user define function
|
||||
@SerializedName(value = "name2Function")
|
||||
@ -893,11 +893,4 @@ public class Database extends MetaObject implements Writable, DatabaseIf<Table>
|
||||
public String toString() {
|
||||
return toJson();
|
||||
}
|
||||
|
||||
// Return ture if database is created for mysql compatibility.
|
||||
// Currently, we have two dbs that are created for this purpose, InformationSchemaDb and MysqlDb,
|
||||
public boolean isMysqlCompatibleDatabase() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -273,5 +273,5 @@ public interface DatabaseIf<T extends TableIf> {
|
||||
return -1L;
|
||||
}
|
||||
|
||||
public Map<Long, TableIf> getIdToTable();
|
||||
Map<Long, TableIf> getIdToTable();
|
||||
}
|
||||
|
||||
@ -77,11 +77,6 @@ public abstract class MysqlCompatibleDatabase extends Database {
|
||||
throw new IOException("Not support.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMysqlCompatibleDatabase() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method must be re-implemented since {@link Env#createView(CreateViewStmt)}
|
||||
* will call this method. And create view should not succeed under this database.
|
||||
|
||||
@ -23,6 +23,7 @@ import org.apache.doris.catalog.Database;
|
||||
import org.apache.doris.catalog.Env;
|
||||
import org.apache.doris.catalog.MaterializedIndex;
|
||||
import org.apache.doris.catalog.MaterializedIndex.IndexExtState;
|
||||
import org.apache.doris.catalog.MysqlCompatibleDatabase;
|
||||
import org.apache.doris.catalog.OlapTable;
|
||||
import org.apache.doris.catalog.Partition;
|
||||
import org.apache.doris.catalog.Partition.PartitionState;
|
||||
@ -280,7 +281,7 @@ public class TabletChecker extends MasterDaemon {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (db.isMysqlCompatibleDatabase()) {
|
||||
if (db instanceof MysqlCompatibleDatabase) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -172,9 +172,9 @@ public interface CatalogIf<T extends DatabaseIf> {
|
||||
}
|
||||
|
||||
// Return a copy of all db collection.
|
||||
public Collection<DatabaseIf<? extends TableIf>> getAllDbs();
|
||||
Collection<DatabaseIf<? extends TableIf>> getAllDbs();
|
||||
|
||||
public boolean enableAutoAnalyze();
|
||||
boolean enableAutoAnalyze();
|
||||
|
||||
public ConcurrentHashMap<Long, DatabaseIf> getIdToDb();
|
||||
ConcurrentHashMap<Long, DatabaseIf> getIdToDb();
|
||||
}
|
||||
|
||||
@ -839,8 +839,8 @@ public class InternalCatalog implements CatalogIf<Database> {
|
||||
LOG.info("begin to drop table: {} from db: {}, is force: {}", tableName, dbName, stmt.isForceDrop());
|
||||
|
||||
// check database
|
||||
Database db = (Database) getDbOrDdlException(dbName);
|
||||
if (db.isMysqlCompatibleDatabase()) {
|
||||
Database db = getDbOrDdlException(dbName);
|
||||
if (db instanceof MysqlCompatibleDatabase) {
|
||||
throw new DdlException("Drop table from this database is not allowed.");
|
||||
}
|
||||
|
||||
@ -1066,7 +1066,7 @@ public class InternalCatalog implements CatalogIf<Database> {
|
||||
// check if db exists
|
||||
Database db = getDbOrDdlException(dbName);
|
||||
// InfoSchemaDb and MysqlDb can not create table manually
|
||||
if (db.isMysqlCompatibleDatabase()) {
|
||||
if (db instanceof MysqlCompatibleDatabase) {
|
||||
ErrorReport.reportDdlException(ErrorCode.ERR_CANT_CREATE_TABLE, tableName,
|
||||
ErrorCode.ERR_CANT_CREATE_TABLE.getCode(), "not supported create table in this database");
|
||||
}
|
||||
@ -3227,7 +3227,7 @@ public class InternalCatalog implements CatalogIf<Database> {
|
||||
for (Map.Entry<Long, Database> entry : idToDb.entrySet()) {
|
||||
Database db = entry.getValue();
|
||||
// Don't write internal database meta.
|
||||
if (!db.isMysqlCompatibleDatabase()) {
|
||||
if (!(db instanceof MysqlCompatibleDatabase)) {
|
||||
checksum ^= entry.getKey();
|
||||
db.write(dos);
|
||||
}
|
||||
@ -3246,7 +3246,7 @@ public class InternalCatalog implements CatalogIf<Database> {
|
||||
Database dbPrev = fullNameToDb.get(db.getFullName());
|
||||
if (dbPrev != null) {
|
||||
String errMsg;
|
||||
if (dbPrev.isMysqlCompatibleDatabase() || db.isMysqlCompatibleDatabase()) {
|
||||
if (dbPrev instanceof MysqlCompatibleDatabase || db instanceof MysqlCompatibleDatabase) {
|
||||
errMsg = String.format(
|
||||
"Mysql compatibility problem, previous checkpoint already has a database with full name "
|
||||
+ "%s. If its name is mysql, try to add mysqldb_replace_name=\"mysql_comp\" in fe.conf.",
|
||||
|
||||
@ -20,6 +20,7 @@ package org.apache.doris.httpv2.rest;
|
||||
import org.apache.doris.catalog.Database;
|
||||
import org.apache.doris.catalog.DatabaseIf;
|
||||
import org.apache.doris.catalog.Env;
|
||||
import org.apache.doris.catalog.MysqlCompatibleDatabase;
|
||||
import org.apache.doris.catalog.OlapTable;
|
||||
import org.apache.doris.catalog.Table;
|
||||
import org.apache.doris.catalog.TableIf.TableType;
|
||||
@ -199,7 +200,7 @@ public class ShowAction extends RestBaseController {
|
||||
} else {
|
||||
for (long dbId : Env.getCurrentInternalCatalog().getDbIds()) {
|
||||
DatabaseIf db = Env.getCurrentInternalCatalog().getDbNullable(dbId);
|
||||
if (db == null || !(db instanceof Database) || ((Database) db).isMysqlCompatibleDatabase()) {
|
||||
if (db == null || !(db instanceof Database) || db instanceof MysqlCompatibleDatabase) {
|
||||
continue;
|
||||
}
|
||||
totalSize += getDataSizeOfDatabase(db);
|
||||
@ -232,7 +233,7 @@ public class ShowAction extends RestBaseController {
|
||||
} else {
|
||||
for (long dbId : Env.getCurrentInternalCatalog().getDbIds()) {
|
||||
DatabaseIf db = Env.getCurrentInternalCatalog().getDbNullable(dbId);
|
||||
if (db == null || !(db instanceof Database) || ((Database) db).isMysqlCompatibleDatabase()) {
|
||||
if (db == null || !(db instanceof Database) || ((Database) db) instanceof MysqlCompatibleDatabase) {
|
||||
continue;
|
||||
}
|
||||
Map<String, Long> tablesEntry = getDataSizeOfTables(db, tableName, singleReplicaBool);
|
||||
|
||||
@ -19,6 +19,7 @@ package org.apache.doris.master;
|
||||
|
||||
import org.apache.doris.catalog.Database;
|
||||
import org.apache.doris.catalog.Env;
|
||||
import org.apache.doris.catalog.MysqlCompatibleDatabase;
|
||||
import org.apache.doris.catalog.OlapTable;
|
||||
import org.apache.doris.catalog.Partition;
|
||||
import org.apache.doris.catalog.Table;
|
||||
@ -56,7 +57,7 @@ public class PartitionInMemoryInfoCollector extends MasterDaemon {
|
||||
LOG.warn("Database [" + dbId + "] does not exist, skip to update database used data quota");
|
||||
continue;
|
||||
}
|
||||
if (db.isMysqlCompatibleDatabase()) {
|
||||
if (db instanceof MysqlCompatibleDatabase) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
|
||||
@ -19,6 +19,7 @@ package org.apache.doris.transaction;
|
||||
|
||||
import org.apache.doris.catalog.Database;
|
||||
import org.apache.doris.catalog.Env;
|
||||
import org.apache.doris.catalog.MysqlCompatibleDatabase;
|
||||
import org.apache.doris.common.AnalysisException;
|
||||
import org.apache.doris.common.Config;
|
||||
import org.apache.doris.common.util.MasterDaemon;
|
||||
@ -50,7 +51,7 @@ public class DbUsedDataQuotaInfoCollector extends MasterDaemon {
|
||||
LOG.warn("Database [" + dbId + "] does not exist, skip to update database used data quota");
|
||||
continue;
|
||||
}
|
||||
if (db.isMysqlCompatibleDatabase()) {
|
||||
if (db instanceof MysqlCompatibleDatabase) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user