caiconghui commented on a change in pull request #3775: URL: https://github.com/apache/incubator-doris/pull/3775#discussion_r531430030
########## File path: fe/fe-core/src/main/java/org/apache/doris/transaction/PublishVersionDaemon.java ########## @@ -190,16 +190,18 @@ private void publishVersion() throws UserException { LOG.warn("Database [{}] has been dropped.", transactionState.getDbId()); continue; } - db.readLock(); - try { - for (int i = 0; i < transactionState.getTableIdList().size(); i++) { - long tableId = transactionState.getTableIdList().get(i); - Table table = db.getTable(tableId); - if (table == null || table.getType() != Table.TableType.OLAP) { - LOG.warn("Table [{}] in database [{}] has been dropped.", tableId, db.getFullName()); - continue; - } - OlapTable olapTable = (OlapTable) table; + + + for (int i = 0; i < transactionState.getTableIdList().size(); i++) { + long tableId = transactionState.getTableIdList().get(i); + Table table = db.getTable(tableId); + if (table == null || table.getType() != Table.TableType.OLAP) { + LOG.warn("Table [{}] in database [{}] has been dropped.", tableId, db.getFullName()); + continue; + } + OlapTable olapTable = (OlapTable) table; + olapTable.readLock(); Review comment: I think the final result is same if the table is dropped before loop or in loop, we just make sure that it is thread safe, and we has already add committed txn check if user want to drop table during loading data ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org