[fix](restore) Reset next version for remote table when restore #40118 (#40165)

cherry pick from #40118

Co-authored-by: smallx <e9999e@163.com>
This commit is contained in:
walter
2024-08-30 13:22:23 +08:00
committed by GitHub
parent 531fe54207
commit 80508fb595
2 changed files with 9 additions and 0 deletions

View File

@ -751,6 +751,9 @@ public class RestoreJob extends AbstractJob {
return;
}
// reset next version to visible version + 1 for all partitions
remoteOlapTbl.resetVersionForRestore();
// Reset properties to correct values.
remoteOlapTbl.resetPropertiesForRestore(reserveDynamicPartitionEnable, reserveReplica,
replicaAlloc, isBeingSynced);

View File

@ -577,6 +577,12 @@ public class OlapTable extends Table implements MTMVRelatedTableIf {
setColocateGroup(null);
}
public void resetVersionForRestore() {
for (Partition partition : idToPartition.values()) {
partition.setNextVersion(partition.getVisibleVersion() + 1);
}
}
public Status resetIdsForRestore(Env env, Database db, ReplicaAllocation restoreReplicaAlloc,
boolean reserveReplica, String srcDbName) {
// ATTN: The meta of the restore may come from different clusters, so the