[fix](load) fix another bug that BE may crash when calling mark_as_failed (#8607)

Same as #8501
This commit is contained in:
Mingyu Chen
2022-03-24 09:13:54 +08:00
committed by GitHub
parent 7fc22c2456
commit a58e56f0b4
5 changed files with 19 additions and 15 deletions

View File

@ -3926,7 +3926,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) {
@ -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);
}

View File

@ -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'},

View File

@ -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());
}

View File

@ -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())), "");