diff --git a/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java b/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java index 6f3a77ba66..1fd3de6352 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java +++ b/fe/fe-core/src/main/java/org/apache/doris/backup/RestoreJob.java @@ -1464,7 +1464,7 @@ public class RestoreJob extends AbstractJob { // set all restored partition version and version hash // set all tables' state to NORMAL - setTableStateToNormal(db, true); + setTableStateToNormal(db, true, isReplay); for (long tblId : restoredVersionInfo.rowKeySet()) { Table tbl = db.getTableNullable(tblId); if (tbl == null) { @@ -1632,7 +1632,7 @@ public class RestoreJob extends AbstractJob { Database db = env.getInternalCatalog().getDbNullable(dbId); if (db != null) { // rollback table's state to NORMAL - setTableStateToNormal(db, false); + setTableStateToNormal(db, false, isReplay); // remove restored tbls for (Table restoreTbl : restoredTbls) { @@ -1709,7 +1709,7 @@ public class RestoreJob extends AbstractJob { LOG.info("finished to cancel restore job. is replay: {}. {}", isReplay, this); } - private void setTableStateToNormal(Database db, boolean committed) { + private void setTableStateToNormal(Database db, boolean committed, boolean isReplay) { for (String tableName : jobInfo.backupOlapTableObjects.keySet()) { Table tbl = db.getTableNullable(jobInfo.getAliasByOriginNameIfSet(tableName)); if (tbl == null) { @@ -1743,7 +1743,7 @@ public class RestoreJob extends AbstractJob { } if (committed && reserveDynamicPartitionEnable) { if (DynamicPartitionUtil.isDynamicPartitionTable(tbl)) { - DynamicPartitionUtil.registerOrRemoveDynamicPartitionTable(db.getId(), olapTbl, false); + DynamicPartitionUtil.registerOrRemoveDynamicPartitionTable(db.getId(), olapTbl, isReplay); Env.getCurrentEnv().getDynamicPartitionScheduler().createOrUpdateRuntimeInfo(tbl.getId(), DynamicPartitionScheduler.LAST_UPDATE_TIME, TimeUtils.getCurrentFormatTime()); }