Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions fe/fe-core/src/main/java/org/apache/doris/alter/Alter.java
Original file line number Diff line number Diff line change
Expand Up @@ -390,19 +390,19 @@ private void processAlterTableForExternalTable(
setExternalTableAutoAnalyzePolicy(table, alterClauses);
} else if (alterClause instanceof CreateOrReplaceBranchClause) {
table.getCatalog().createOrReplaceBranch(
table.getDbName(), table.getName(),
table,
((CreateOrReplaceBranchClause) alterClause).getBranchInfo());
} else if (alterClause instanceof CreateOrReplaceTagClause) {
table.getCatalog().createOrReplaceTag(
table.getDbName(), table.getName(),
table,
((CreateOrReplaceTagClause) alterClause).getTagInfo());
} else if (alterClause instanceof DropBranchClause) {
table.getCatalog().dropBranch(
table.getDbName(), table.getName(),
table,
((DropBranchClause) alterClause).getDropBranchInfo());
} else if (alterClause instanceof DropTagClause) {
table.getCatalog().dropTag(
table.getDbName(), table.getName(),
table,
((DropTagClause) alterClause).getDropTagInfo());
} else {
throw new UserException("Invalid alter operations for external table: " + alterClauses);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ public boolean registerTable(TableIf table) {
return result;
}

@Override
public void unregisterTable(String tableName) {
if (Env.isStoredTableNamesLowerCase()) {
tableName = tableName.toLowerCase();
Expand Down
11 changes: 8 additions & 3 deletions fe/fe-core/src/main/java/org/apache/doris/catalog/Env.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
import org.apache.doris.nereids.trees.plans.commands.UninstallPluginCommand;
import org.apache.doris.nereids.trees.plans.commands.info.AlterMTMVPropertyInfo;
import org.apache.doris.nereids.trees.plans.commands.info.AlterMTMVRefreshInfo;
import org.apache.doris.nereids.trees.plans.commands.info.PartitionNamesInfo;
import org.apache.doris.nereids.trees.plans.commands.info.TableNameInfo;
import org.apache.doris.persist.AlterMTMV;
import org.apache.doris.persist.AutoIncrementIdUpdateLog;
Expand Down Expand Up @@ -3334,7 +3335,7 @@ public void createDb(CreateDbStmt stmt) throws DdlException {
} else {
catalogIf = catalogMgr.getCatalog(stmt.getCtlName());
}
catalogIf.createDb(stmt);
catalogIf.createDb(stmt.getFullDbName(), stmt.isSetIfNotExists(), stmt.getProperties());
}

// The interface which DdlExecutor needs.
Expand All @@ -3345,7 +3346,7 @@ public void createDb(CreateDatabaseCommand command) throws DdlException {
} else {
catalogIf = catalogMgr.getCatalog(command.getCtlName());
}
catalogIf.createDb(command);
catalogIf.createDb(command.getDbName(), command.isIfNotExists(), command.getProperties());
}

// For replay edit log, need't lock metadata
Expand Down Expand Up @@ -6068,7 +6069,11 @@ public String dumpImage() {
public void truncateTable(TruncateTableCommand command) throws DdlException {
CatalogIf<?> catalogIf = catalogMgr.getCatalogOrException(command.getTableNameInfo().getCtl(),
catalog -> new DdlException(("Unknown catalog " + catalog)));
catalogIf.truncateTable(command);
TableNameInfo nameInfo = command.getTableNameInfo();
PartitionNamesInfo partitionNamesInfo = command.getPartitionNamesInfo().orElse(null);
catalogIf.truncateTable(nameInfo.getDb(), nameInfo.getTbl(),
partitionNamesInfo == null ? null : partitionNamesInfo.translateToLegacyPartitionNames(),
command.isForceDrop(), command.toSqlWithoutTable());
}

public void replayTruncateTable(TruncateTableInfo info) throws MetaNotFoundException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.doris.analysis.CreateTableStmt;
import org.apache.doris.analysis.DbName;
import org.apache.doris.analysis.DistributionDesc;
import org.apache.doris.analysis.DropTableStmt;
import org.apache.doris.analysis.HashDistributionDesc;
import org.apache.doris.analysis.KeysDesc;
import org.apache.doris.analysis.ModifyColumnClause;
Expand Down Expand Up @@ -370,8 +369,8 @@ private boolean created() {
if (!optionalColumn.isPresent() || !optionalColumn.get().isAllowNull()) {
try {
Env.getCurrentEnv().getInternalCatalog()
.dropTable(new DropTableStmt(true, new TableName(null,
StatisticConstants.DB_NAME, StatisticConstants.TABLE_STATISTIC_TBL_NAME), true));
.dropTable(StatisticConstants.DB_NAME, StatisticConstants.TABLE_STATISTIC_TBL_NAME,
false, false, true, true);
} catch (Exception e) {
LOG.warn("Failed to drop outdated table", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,11 @@ public void refreshExternalTableFromEvent(String catalogName, String dbName, Str
refreshTableInternal(catalog, db, table, updateTime);
}

private void refreshTableInternal(CatalogIf catalog, DatabaseIf db, TableIf table, long updateTime) {
public void refreshTableInternal(CatalogIf catalog, DatabaseIf db, TableIf table, long updateTime) {
if (table instanceof ExternalTable) {
((ExternalTable) table).unsetObjectCreated();
}
Env.getCurrentEnv().getExtMetaCacheMgr()
.invalidateTableCache(catalog.getId(), db.getFullName(), table.getName());
Env.getCurrentEnv().getExtMetaCacheMgr().invalidateTableCache((ExternalTable) table);
if (table instanceof HMSExternalTable && updateTime > 0) {
((HMSExternalTable) table).setEventUpdateTime(updateTime);
}
Expand Down Expand Up @@ -245,8 +244,7 @@ public void refreshPartitions(String catalogName, String dbName, String tableNam
return;
}

Env.getCurrentEnv().getExtMetaCacheMgr().invalidatePartitionsCache(
catalog.getId(), db.getFullName(), table.getName(), partitionNames);
Env.getCurrentEnv().getExtMetaCacheMgr().invalidatePartitionsCache((ExternalTable) table, partitionNames);
((HMSExternalTable) table).setEventUpdateTime(updateTime);
}

Expand Down

This file was deleted.

10 changes: 10 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/common/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,16 @@ public static String getRootCauseStack(Throwable t) {
return sw.toString();
}

public static Throwable getRootCause(Throwable t) {
Throwable p = t;
Throwable r = t;
while (p != null) {
r = p;
p = p.getCause();
}
return r;
}

public static long sha256long(String str) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@

package org.apache.doris.datasource;

import org.apache.doris.analysis.CreateDbStmt;
import org.apache.doris.analysis.CreateTableStmt;
import org.apache.doris.analysis.DropDbStmt;
import org.apache.doris.analysis.DropTableStmt;
import org.apache.doris.analysis.PartitionNames;
import org.apache.doris.analysis.TableName;
import org.apache.doris.catalog.DatabaseIf;
import org.apache.doris.catalog.Env;
Expand All @@ -30,8 +28,6 @@
import org.apache.doris.common.ErrorCode;
import org.apache.doris.common.MetaNotFoundException;
import org.apache.doris.common.UserException;
import org.apache.doris.nereids.trees.plans.commands.CreateDatabaseCommand;
import org.apache.doris.nereids.trees.plans.commands.TruncateTableCommand;
import org.apache.doris.nereids.trees.plans.commands.info.CreateOrReplaceBranchInfo;
import org.apache.doris.nereids.trees.plans.commands.info.CreateOrReplaceTagInfo;
import org.apache.doris.nereids.trees.plans.commands.info.DropBranchInfo;
Expand Down Expand Up @@ -189,13 +185,7 @@ default CatalogLog constructEditLog() {

boolean enableAutoAnalyze();

void createDb(CreateDbStmt stmt) throws DdlException;

void createDb(CreateDatabaseCommand command) throws DdlException;

default void dropDb(DropDbStmt stmt) throws DdlException {
dropDb(stmt.getDbName(), stmt.isSetIfExists(), stmt.isForceDrop());
}
void createDb(String dbName, boolean ifNotExists, Map<String, String> properties) throws DdlException;

void dropDb(String dbName, boolean ifExists, boolean force) throws DdlException;

Expand All @@ -205,12 +195,12 @@ default void dropDb(DropDbStmt stmt) throws DdlException {
*/
boolean createTable(CreateTableStmt stmt) throws UserException;

void dropTable(DropTableStmt stmt) throws DdlException;

void dropTable(String dbName, String tableName, boolean isView, boolean isMtmv, boolean ifExists,
boolean force) throws DdlException;

void truncateTable(TruncateTableCommand truncateTableCommand) throws DdlException;
void truncateTable(String dbName, String tableName, PartitionNames partitionNames, boolean forceDrop,
String rawTruncateSql)
throws DdlException;

// Convert from remote database name to local database name, overridden by subclass if necessary
default String fromRemoteDatabaseName(String remoteDatabaseName) {
Expand All @@ -223,25 +213,25 @@ default String fromRemoteTableName(String remoteDatabaseName, String remoteTable
}

// Create or replace branch operations, overridden by subclass if necessary
default void createOrReplaceBranch(String db, String tbl, CreateOrReplaceBranchInfo branchInfo)
default void createOrReplaceBranch(TableIf dorisTable, CreateOrReplaceBranchInfo branchInfo)
throws UserException {
throw new UserException("Not support create or replace branch operation");
}

// Create or replace tag operation, overridden by subclass if necessary
default void createOrReplaceTag(String db, String tbl, CreateOrReplaceTagInfo tagInfo) throws UserException {
default void createOrReplaceTag(TableIf dorisTable, CreateOrReplaceTagInfo tagInfo) throws UserException {
throw new UserException("Not support create or replace tag operation");
}

default void replayOperateOnBranchOrTag(String dbName, String tblName) {

}

default void dropBranch(String db, String tbl, DropBranchInfo branchInfo) throws UserException {
default void dropBranch(TableIf dorisTable, DropBranchInfo branchInfo) throws UserException {
throw new UserException("Not support drop branch operation");
}

default void dropTag(String db, String tbl, DropTagInfo tagInfo) throws UserException {
default void dropTag(TableIf dorisTable, DropTagInfo tagInfo) throws UserException {
throw new UserException("Not support drop tag operation");
}
}
Loading