Skip to content

Commit

Permalink
[fix](restore) Reset next version for remote table when restore #40118 (
Browse files Browse the repository at this point in the history
#40166)

cherry pick from #40118

Co-authored-by: smallx <[email protected]>
  • Loading branch information
w41ter and smallx authored Aug 30, 2024
1 parent 18bde27 commit 03d9296
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,9 @@ private void checkAndPrepareMeta() {
return;
}

// reset next version to visible version + 1 for all partitions
remoteOlapTbl.resetVersionForRestore();

// Reset properties to correct values.
remoteOlapTbl.resetPropertiesForRestore(reserveDynamicPartitionEnable, reserveReplica,
replicaAlloc, isBeingSynced);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,12 @@ public void resetPropertiesForRestore(boolean reserveDynamicPartitionEnable, boo
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
Expand Down

0 comments on commit 03d9296

Please sign in to comment.