diff --git a/be/src/exec/tablet_sink.cpp b/be/src/exec/tablet_sink.cpp index 6be3e2dba1..cf1216fdaf 100644 --- a/be/src/exec/tablet_sink.cpp +++ b/be/src/exec/tablet_sink.cpp @@ -421,6 +421,11 @@ Status NodeChannel::close_wait(RuntimeState* state) { } void NodeChannel::cancel(const std::string& cancel_msg) { + // set _is_closed to true finally + Defer set_closed {[&]() { + std::lock_guard l(_closed_lock); + _is_closed = true; + }}; // we don't need to wait last rpc finished, cause closure's release/reset will join. // But do we need brpc::StartCancel(call_id)? _cancel_with_msg(cancel_msg); diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java index 2273d89f39..57a066680f 100755 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Catalog.java @@ -3926,7 +3926,7 @@ public class Catalog { Pair result = db.createTableWithLock(olapTable, false, stmt.isSetIfNotExists()); if (!result.first) { - ErrorReport.reportDdlException(ErrorCode.ERR_CANT_CREATE_TABLE, tableName, "table already exists"); + ErrorReport.reportDdlException(ErrorCode.ERR_TABLE_EXISTS_ERROR, tableName); } if (result.second) { @@ -3975,7 +3975,7 @@ public class Catalog { MysqlTable mysqlTable = new MysqlTable(tableId, tableName, columns, stmt.getProperties()); mysqlTable.setComment(stmt.getComment()); if (!db.createTableWithLock(mysqlTable, false, stmt.isSetIfNotExists()).first) { - ErrorReport.reportDdlException(ErrorCode.ERR_CANT_CREATE_TABLE, tableName, "table already exist"); + ErrorReport.reportDdlException(ErrorCode.ERR_TABLE_EXISTS_ERROR, tableName); } LOG.info("successfully create table[{}-{}]", tableName, tableId); return; @@ -3989,7 +3989,7 @@ public class Catalog { OdbcTable odbcTable = new OdbcTable(tableId, tableName, columns, stmt.getProperties()); odbcTable.setComment(stmt.getComment()); if (!db.createTableWithLock(odbcTable, false, stmt.isSetIfNotExists()).first) { - ErrorReport.reportDdlException(ErrorCode.ERR_CANT_CREATE_TABLE, tableName, "table already exist"); + ErrorReport.reportDdlException(ErrorCode.ERR_TABLE_EXISTS_ERROR, tableName); } LOG.info("successfully create table[{}-{}]", tableName, tableId); return; @@ -4020,7 +4020,7 @@ public class Catalog { esTable.setComment(stmt.getComment()); if (!db.createTableWithLock(esTable, false, stmt.isSetIfNotExists()).first) { - ErrorReport.reportDdlException(ErrorCode.ERR_CANT_CREATE_TABLE, tableName, "table already exist"); + ErrorReport.reportDdlException(ErrorCode.ERR_TABLE_EXISTS_ERROR, tableName); } LOG.info("successfully create table{} with id {}", tableName, tableId); return esTable; @@ -4037,7 +4037,7 @@ public class Catalog { brokerTable.setBrokerProperties(stmt.getExtProperties()); if (!db.createTableWithLock(brokerTable, false, stmt.isSetIfNotExists()).first) { - ErrorReport.reportDdlException(ErrorCode.ERR_CANT_CREATE_TABLE, tableName, "table already exist"); + ErrorReport.reportDdlException(ErrorCode.ERR_TABLE_EXISTS_ERROR, tableName); } LOG.info("successfully create table[{}-{}]", tableName, tableId); @@ -4058,7 +4058,7 @@ public class Catalog { } // check hive table if exists in doris database if (!db.createTableWithLock(hiveTable, false, stmt.isSetIfNotExists()).first) { - ErrorReport.reportDdlException(ErrorCode.ERR_CANT_CREATE_TABLE, tableName, "table already exist"); + ErrorReport.reportDdlException(ErrorCode.ERR_TABLE_EXISTS_ERROR, tableName); } LOG.info("successfully create table[{}-{}]", tableName, tableId); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java b/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java index 8950fca519..bd9d58e985 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java @@ -26,9 +26,9 @@ public enum ErrorCode { ERR_NISAMCHK(1001, new byte[]{'H', 'Y', '0', '0', '0'}, "isamchk"), ERR_NO(1002, new byte[]{'H', 'Y', '0', '0', '0'}, "NO"), ERR_YES(1003, new byte[]{'H', 'Y', '0', '0', '0'}, "YES"), - ERR_CANT_CREATE_FILE(1004, new byte[]{'H', 'Y', '0', '0', '0'}, "Can't create file '%s' (errno: %d)"), - ERR_CANT_CREATE_TABLE(1005, new byte[]{'H', 'Y', '0', '0', '0'}, "Can't create table '%s' (errno: %d)"), - ERR_CANT_CREATE_DB(1006, new byte[]{'H', 'Y', '0', '0', '0'}, "Can't create database '%s' (errno: %d"), + ERR_CANT_CREATE_FILE(1004, new byte[]{'H', 'Y', '0', '0', '0'}, "Can't create file '%s' (errno: %d - %s)"), + ERR_CANT_CREATE_TABLE(1005, new byte[]{'H', 'Y', '0', '0', '0'}, "Can't create table '%s' (errno: %d - %s)"), + ERR_CANT_CREATE_DB(1006, new byte[]{'H', 'Y', '0', '0', '0'}, "Can't create database '%s' (errno: %d - %s"), ERR_DB_CREATE_EXISTS(1007, new byte[]{'H', 'Y', '0', '0', '0'}, "Can't create database '%s'; database exists"), ERR_DB_DROP_EXISTS(1008, new byte[]{'H', 'Y', '0', '0', '0'}, "Can't drop database '%s'; database doesn't exist"), ERR_DB_DROP_DELETE(1009, new byte[]{'H', 'Y', '0', '0', '0'}, diff --git a/fe/fe-core/src/main/java/org/apache/doris/external/iceberg/IcebergCatalogMgr.java b/fe/fe-core/src/main/java/org/apache/doris/external/iceberg/IcebergCatalogMgr.java index 88d64f02d6..bbc6b26922 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/external/iceberg/IcebergCatalogMgr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/external/iceberg/IcebergCatalogMgr.java @@ -23,14 +23,14 @@ import org.apache.doris.catalog.Database; import org.apache.doris.catalog.IcebergProperty; import org.apache.doris.catalog.IcebergTable; import org.apache.doris.common.DdlException; +import org.apache.doris.common.ErrorCode; +import org.apache.doris.common.ErrorReport; +import org.apache.doris.external.iceberg.util.IcebergUtils; import com.google.common.base.Enums; import com.google.common.base.Strings; import com.google.common.collect.Maps; -import org.apache.doris.common.ErrorCode; -import org.apache.doris.common.ErrorReport; -import org.apache.doris.external.iceberg.util.IcebergUtils; import org.apache.iceberg.catalog.TableIdentifier; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -204,7 +204,7 @@ public class IcebergCatalogMgr { // check iceberg table if exists in doris database if (!db.createTableWithLock(table, false, stmt.isSetIfNotExists()).first) { - ErrorReport.reportDdlException(ErrorCode.ERR_CANT_CREATE_TABLE, tableName, "table already exist"); + ErrorReport.reportDdlException(ErrorCode.ERR_TABLE_EXISTS_ERROR, tableName); } LOG.info("successfully create table[{}-{}]", tableName, table.getId()); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/external/iceberg/IcebergTableCreationRecordMgr.java b/fe/fe-core/src/main/java/org/apache/doris/external/iceberg/IcebergTableCreationRecordMgr.java index 24c850d42b..16da4456b1 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/external/iceberg/IcebergTableCreationRecordMgr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/external/iceberg/IcebergTableCreationRecordMgr.java @@ -178,8 +178,7 @@ public class IcebergTableCreationRecordMgr extends MasterDaemon { icebergProperty, identifier, false); // check iceberg table if exists in doris database if (!db.createTableWithLock(table, false, false).first) { - ErrorReport.reportDdlException(ErrorCode.ERR_CANT_CREATE_TABLE, - table.getName(), ErrorCode.ERR_TABLE_EXISTS_ERROR.getCode()); + ErrorReport.reportDdlException(ErrorCode.ERR_TABLE_EXISTS_ERROR, table.getName()); } addTableCreationRecord(db.getId(), tableId, db.getFullName(), table.getName(), SUCCESS, prop.writeTimeFormat(new Date(System.currentTimeMillis())), "");