This is an automated email from the ASF dual-hosted git repository. w41ter pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new 05f82df1f1e [fix](restore) update is_being_synced properties #40194 (#40556) 05f82df1f1e is described below commit 05f82df1f1ea6747aab465d79c719dd02c7edfb0 Author: walter <w41te...@gmail.com> AuthorDate: Tue Sep 10 11:15:50 2024 +0800 [fix](restore) update is_being_synced properties #40194 (#40556) cherry pick from #40194 --- .../java/org/apache/doris/backup/RestoreJob.java | 9 ++++++--- .../java/org/apache/doris/catalog/OlapTable.java | 21 +++++++++++++++------ 2 files changed, 21 insertions(+), 9 deletions(-) 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 cb091bf0e06..bad61892b95 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 @@ -1786,7 +1786,7 @@ public class RestoreJob extends AbstractJob { // set all restored partition version and version hash // set all tables' state to NORMAL - setTableStateToNormal(db, true, isReplay); + setTableStateToNormalAndUpdateProperties(db, true, isReplay); for (long tblId : restoredVersionInfo.rowKeySet()) { Table tbl = db.getTableNullable(tblId); if (tbl == null) { @@ -2030,7 +2030,7 @@ public class RestoreJob extends AbstractJob { Database db = env.getInternalCatalog().getDbNullable(dbId); if (db != null) { // rollback table's state to NORMAL - setTableStateToNormal(db, false, isReplay); + setTableStateToNormalAndUpdateProperties(db, false, isReplay); // remove restored tbls for (Table restoreTbl : restoredTbls) { @@ -2110,7 +2110,7 @@ public class RestoreJob extends AbstractJob { LOG.info("finished to cancel restore job. is replay: {}. {}", isReplay, this); } - private void setTableStateToNormal(Database db, boolean committed, boolean isReplay) { + private void setTableStateToNormalAndUpdateProperties(Database db, boolean committed, boolean isReplay) { for (String tableName : jobInfo.backupOlapTableObjects.keySet()) { Table tbl = db.getTableNullable(jobInfo.getAliasByOriginNameIfSet(tableName)); if (tbl == null) { @@ -2153,6 +2153,9 @@ public class RestoreJob extends AbstractJob { DynamicPartitionScheduler.LAST_UPDATE_TIME, TimeUtils.getCurrentFormatTime()); } } + if (committed && isBeingSynced) { + olapTbl.setBeingSyncedProperties(); + } } finally { tbl.writeUnlock(); } diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java index c7d87e35221..a2777b0c399 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/OlapTable.java @@ -590,17 +590,26 @@ public class OlapTable extends Table implements MTMVRelatedTableIf { tableProperty.resetPropertiesForRestore(reserveDynamicPartitionEnable, reserveReplica, replicaAlloc); } if (isBeingSynced) { - TableProperty tableProperty = getOrCreatTableProperty(); - tableProperty.setIsBeingSynced(); - tableProperty.removeInvalidProperties(); - if (isAutoBucket()) { - markAutoBucket(); - } + setBeingSyncedProperties(); } // remove colocate property. setColocateGroup(null); } + /** + * Set the related properties when is_being_synced properties is true. + * + * Some properties, like storage_policy, colocate_with, are not supported by the ccr syncer. + */ + public void setBeingSyncedProperties() { + TableProperty tableProperty = getOrCreatTableProperty(); + tableProperty.setIsBeingSynced(); + tableProperty.removeInvalidProperties(); + if (isAutoBucket()) { + markAutoBucket(); + } + } + public void resetVersionForRestore() { for (Partition partition : idToPartition.values()) { partition.setNextVersion(partition.getVisibleVersion() + 1); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org