This is an automated email from the ASF dual-hosted git repository. morningman pushed a commit to branch branch-0.15 in repository https://gitbox.apache.org/repos/asf/incubator-doris.git
commit fe8f299c21947f00a8a2302a80df4620909809db Author: Userwhite <[email protected]> AuthorDate: Fri Nov 12 10:56:33 2021 +0800 [Bug] Fix bug with use tableId to get table in publish version (#7091) If table has been dropped when finishing txn, skip it. --- .../src/main/java/org/apache/doris/catalog/Database.java | 16 ++++++++++++++++ .../apache/doris/transaction/DatabaseTransactionMgr.java | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java index cfc89f7..128e9af 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/Database.java @@ -406,6 +406,22 @@ public class Database extends MetaObject implements Writable { return tableList; } + public List<Table> getTablesOnIdOrderWithIgnoringWrongTableId(List<Long> tableIdList) { + List<Table> tableList = Lists.newArrayList(); + for (Long tableId : tableIdList) { + Table table = idToTable.get(tableId); + if (table == null) { + LOG.warn("unknown table, tableId=" + tableId); + continue; + } + tableList.add(table); + } + if (tableList.size() > 1) { + return tableList.stream().sorted(Comparator.comparing(Table::getId)).collect(Collectors.toList()); + } + return tableList; + } + public Set<String> getTableNamesWithLock() { readLock(); try { diff --git a/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java b/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java index cdb73f4..d09fe31 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java +++ b/fe/fe-core/src/main/java/org/apache/doris/transaction/DatabaseTransactionMgr.java @@ -717,7 +717,7 @@ public class DatabaseTransactionMgr { } } - List<Table> tableList = db.getTablesOnIdOrderOrThrowException(tableIdList); + List<Table> tableList = db.getTablesOnIdOrderWithIgnoringWrongTableId(tableIdList); MetaLockUtils.writeLockTables(tableList); try { boolean hasError = false; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
