This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch dev-1.0.0 in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
commit 95e8115f0166a2525d4890b65f8228616eed8bdb Author: Mingyu Chen <[email protected]> AuthorDate: Thu Mar 24 09:13:54 2022 +0800 [fix](load) fix another bug that BE may crash when calling `mark_as_failed` (#8607) Same as #8501 --- be/src/exec/tablet_sink.cpp | 5 +++++ .../src/main/java/org/apache/doris/catalog/Catalog.java | 12 ++++++------ .../src/main/java/org/apache/doris/common/ErrorCode.java | 6 +++--- .../org/apache/doris/external/iceberg/IcebergCatalogMgr.java | 8 ++++---- .../external/iceberg/IcebergTableCreationRecordMgr.java | 3 +-- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/be/src/exec/tablet_sink.cpp b/be/src/exec/tablet_sink.cpp index b690f89..c36b574 100644 --- a/be/src/exec/tablet_sink.cpp +++ b/be/src/exec/tablet_sink.cpp @@ -415,6 +415,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<std::mutex> 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 c92c579..26e2770 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 @@ -3971,7 +3971,7 @@ public class Catalog { Pair<Boolean, Boolean> 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) { @@ -4020,7 +4020,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; @@ -4034,7 +4034,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; @@ -4065,7 +4065,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; @@ -4082,7 +4082,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); @@ -4103,7 +4103,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 8950fca..bd9d58e 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 88d64f0..bbc6b26 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 24c850d..16da445 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())), ""); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
