w41ter commented on code in PR #43408: URL: https://github.com/apache/doris/pull/43408#discussion_r1842046135
########## fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java: ########## @@ -2054,29 +2054,24 @@ private Status allTabletCommitted(boolean isReplay) { } private Status dropAllNonRestoredTableAndPartitions(Database db) { - Set<String> restoredViews = jobInfo.newBackupObjects.views.stream() - .map(view -> view.name).collect(Collectors.toSet()); - try { for (Table table : db.getTables()) { long tableId = table.getId(); String tableName = table.getName(); TableType tableType = table.getType(); - if (tableType == TableType.OLAP) { - BackupOlapTableInfo backupTableInfo = jobInfo.backupOlapTableObjects.get(tableName); - if (tableType == TableType.OLAP && backupTableInfo != null) { - // drop the non restored partitions. - dropNonRestoredPartitions(db, (OlapTable) table, backupTableInfo); - } else if (isCleanTables) { - // otherwise drop the entire table. - LOG.info("drop non restored table {}, table id: {}. {}", tableName, tableId, this); - boolean isForceDrop = false; // move this table into recyclebin. - env.getInternalCatalog().dropTableWithoutCheck(db, table, isForceDrop); - } - } else if (tableType == TableType.VIEW && isCleanTables && !restoredViews.contains(tableName)) { - LOG.info("drop non restored view {}, table id: {}. {}", tableName, tableId, this); - boolean isForceDrop = false; // move this view into recyclebin. - env.getInternalCatalog().dropTableWithoutCheck(db, table, isForceDrop); + BackupOlapTableInfo backupTableInfo = jobInfo.backupOlapTableObjects.get(tableName); + if (tableType != TableType.OLAP && tableType != TableType.ODBC && tableType != TableType.VIEW) { + continue; + } + if (tableType == TableType.OLAP && backupTableInfo != null) { + // drop the non restored partitions. + dropNonRestoredPartitions(db, (OlapTable) table, backupTableInfo); + } else if (isCleanTables) { + // otherwise drop the entire table. + LOG.info("drop non restored table {}({}). {}", tableName, tableId, this); + boolean isView = false; + boolean isForceDrop = false; // move this table into recyclebin. + env.getInternalCatalog().dropTableWithoutCheck(db, table, isView, isForceDrop); Review Comment: @wyxxxcat This patch is staled, please update. ########## fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java: ########## @@ -916,23 +916,26 @@ public void dropTable(DropTableStmt stmt) throws DdlException { } } - dropTableInternal(db, table, stmt.isForceDrop()); + dropTableInternal(db, table, stmt.isView(), stmt.isForceDrop(), watch, costTimes); Review Comment: only pick the necessary parameters. ########## fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java: ########## @@ -942,7 +945,8 @@ public void dropTableWithoutCheck(Database db, Table table, boolean forceDrop) t } // Drop a table, the db lock must hold. - private void dropTableInternal(Database db, Table table, boolean forceDrop) throws DdlException { + private void dropTableInternal(Database db, Table table, boolean isView, boolean forceDrop, + StopWatch watch, Map<String, Long> costTimes) throws DdlException { Review Comment: remove `StopWatch watch, Map<String, Long> costTimes` ########## fe/fe-core/src/main/java/org/apache/doris/datasource/InternalCatalog.java: ########## @@ -916,23 +916,26 @@ public void dropTable(DropTableStmt stmt) throws DdlException { } } - dropTableInternal(db, table, stmt.isForceDrop()); + dropTableInternal(db, table, stmt.isView(), stmt.isForceDrop(), watch, costTimes); } catch (UserException e) { throw new DdlException(e.getMessage(), e.getMysqlErrorCode()); } finally { db.writeUnlock(); } - LOG.info("finished dropping table: {} from db: {}, is force: {}", tableName, dbName, stmt.isForceDrop()); + watch.stop(); + costTimes.put("6:total", watch.getTime()); + LOG.info("finished dropping table: {} from db: {}, is view: {}, is force: {}, cost: {}", + tableName, dbName, stmt.isView(), stmt.isForceDrop(), costTimes); Review Comment: should merge this conflict manually, eg: ``` LOG.info("finished dropping table: {} from db: {}, is force: {}, is view: {}", tableName, dbName, stmt.isForceDrop(), stmt.isView()); ``` -- 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. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org 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