Skip to content

Commit

Permalink
[YW][#5890] Fix nested backup info to include the destination univers…
Browse files Browse the repository at this point in the history
…e in the event of restoring cross-universe.

Summary:
When restoring to a universe we check the universeUUID of the backupInfo object but
universe backups contain nested backupInfo, so the fix is to update the nested objects to match the
parent universeUUID.

Test Plan:
Create universe backup and then try restoring to a different universe from the Backups
tabs and selecting a specific backup from the table action.

Reviewers: sanketh, arnav

Reviewed By: arnav

Subscribers: jenkins-bot, yugaware

Differential Revision: https://phabricator.dev.yugabyte.com/D9514
  • Loading branch information
Andrew Cai committed Sep 30, 2020
1 parent 1c6c113 commit e9b58ad
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public Result restore(UUID customerUUID, UUID universeUUID) {
return ApiResponse.error(BAD_REQUEST, errMsg);
}

taskParams.universeUUID = universeUUID;

// Change the BackupTableParams in list to be "RESTORE" action type
if (taskParams.backupList != null) {
for (BackupTableParams subParams: taskParams.backupList) {
Expand All @@ -78,6 +80,7 @@ public Result restore(UUID customerUUID, UUID universeUUID) {
subParams.tableUUID = null;
subParams.tableName = null;
subParams.keyspace = null;
subParams.universeUUID = universeUUID;
subParams.parallelism = taskParams.parallelism;;
}
}
Expand All @@ -91,8 +94,6 @@ public Result restore(UUID customerUUID, UUID universeUUID) {
return ApiResponse.error(BAD_REQUEST, errMsg);
}

taskParams.universeUUID = universeUUID;

Backup newBackup = Backup.create(customerUUID, taskParams);
UUID taskUUID = commissioner.submit(TaskType.BackupUniverse, taskParams);
LOG.info("Submitted task to restore table backup to {}.{}, task uuid = {}.",
Expand Down

0 comments on commit e9b58ad

Please sign in to comment.