Skip to content

Conversation

@andreaangiolillo
Copy link
Collaborator

@andreaangiolillo andreaangiolillo commented Feb 7, 2025

Proposed changes

Jira ticket: CLOUDP-299544

Bug:
The atlas backup restore start download returns MISSING_ATTRIBUTE error when trying a restore download with a Dedicated Cluster. The reason is that we are wrongly calling the Flex API.

This PR updates the command logic to get the cluster first to see if is flex or not, and then call the right API.

atlas backup restore start download --clusterName Cluster0 --snapshotId 67a645ae781f9601bf0925bb -P prod
Error: https://cloud.mongodb.com/api/atlas/v2/groups/663268874ddd3b236fd2f107/flexClusters/Cluster0/backup/restoreJobs POST: HTTP 400 Bad Request (Error code: "MISSING_ATTRIBUTE") Detail: The required attribute targetProjectId was not specified. Reason: Bad Request. Params: [targetProjectId], BadRequestDetail:

Fix:

./bin/atlas backup restore start download --clusterName Cluster0 --snapshotId 67a645ae781f9601bf0925bb -P prod
Restore job '67a64a93781f9601bf0da6c2' successfully started

For Flex cluster we still see the error:

./bin/atlas backup restore start download --clusterName FlexCluster --snapshotId 67a645ae781f9601bf0925bb -P prod
Error: https://cloud.mongodb.com/api/atlas/v2/groups/663268874ddd3b236fd2f107/flexClusters/FlexCluster/backup/restoreJobs POST: HTTP 400 Bad Request (Error code: "MISSING_ATTRIBUTE") Detail: The required attribute targetProjectId was not specified. Reason: Bad Request. Params: [targetProjectId], BadRequestDetail:
/bin/atlas backup restore start download --clusterName FlexCluster --snapshotId 67a76aae20363e4226209201 --targetProjectId 663268874ddd3b236fd2f107 -P prod --targetClusterName FlexCluster

Restore job '67aa2b8870e79e22dfac338a' successfully started

@mongodb mongodb deleted a comment from apix-bot bot Feb 10, 2025
@andreaangiolillo andreaangiolillo marked this pull request as ready for review February 10, 2025 16:29
@andreaangiolillo andreaangiolillo requested a review from a team as a code owner February 10, 2025 16:29
@mongodb mongodb deleted a comment from apix-bot bot Feb 11, 2025
@andreaangiolillo andreaangiolillo marked this pull request as draft February 11, 2025 12:28
@andreaangiolillo andreaangiolillo marked this pull request as ready for review February 11, 2025 12:39
@apix-bot
Copy link
Contributor

apix-bot bot commented Feb 11, 2025

Coverage Report 📈

Branch Commit Coverage
master a5e6628 39.3%
CLOUDP-299544 fb07b6a 39.4%
Difference .1%

Comment on lines +67 to +69
if result.GetDeliveryType() == deliveryTypeDownload && len(result.GetDeliveryUrl()) > 0 {
return true
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dry-by: the watch command hanged forever for download restore with Dedicated Cluster (It works for Flex Cluster). I discovered this by adding a new e2e test.

@andreaangiolillo andreaangiolillo requested a review from a team February 11, 2025 12:48
@andreaangiolillo andreaangiolillo merged commit 0386f20 into master Feb 11, 2025
25 checks passed
@andreaangiolillo andreaangiolillo deleted the CLOUDP-299544 branch February 11, 2025 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants