During a dry-run restore, it is possible that the tenants being restored are modified concurrently. Handle this case with an output message.

This commit is contained in:
A.J. Beamon 2023-02-25 19:59:29 -08:00
parent b869f5a6ac
commit 8e231f8809
1 changed files with 9 additions and 1 deletions

View File

@ -2002,7 +2002,15 @@ struct RestoreClusterImpl {
Optional<MetaclusterTenantMapEntry> existingEntry = wait(tryGetTenantTransaction(tr, tenantEntry.tenantName));
if (existingEntry.present()) {
if (existingEntry.get().assignedCluster == self->clusterName) {
ASSERT(existingEntry.get().matchesConfiguration(tenantEntry));
if (existingEntry.get().id != tenantEntry.id ||
!existingEntry.get().matchesConfiguration(tenantEntry)) {
ASSERT(self->restoreDryRun);
self->messages.push_back(
fmt::format("The tenant `{}' was modified concurrently with the restore dry-run",
printable(tenantEntry.tenantName)));
throw tenant_already_exists();
}
// This is a retry, so return success
return false;
} else {