Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-13136 Enable restore from logical backup for sharded clusters. #3138

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion managed/services/backup/backup_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ func (s *Service) checkArtifactModePreconditions(ctx context.Context, artifactID
return errors.Wrapf(ErrArtifactNotReady, "artifact %q in status: %q", artifactID, artifact.Status)
}

if artifact.IsShardedCluster {
if artifact.IsShardedCluster && artifact.DataModel != models.LogicalDataModel {
return errors.Wrapf(ErrIncompatibleService,
"artifact %q was made for a sharded cluster and cannot be restored from UI; for more information refer to "+
"https://docs.percona.com/percona-monitoring-and-management/get-started/backup/backup_mongo.html", artifactID)
Expand Down
17 changes: 16 additions & 1 deletion managed/services/backup/backup_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ func TestCheckArtifactModePreconditions(t *testing.T) {
err: nil,
},
{
name: "sharded cluster restore not supported",
name: "sharded cluster restore is supported for logical backups",
pitrValue: time.Unix(0, 0),
artifactParams: models.CreateArtifactParams{
Name: "mongo-artifact-name-7",
Expand All @@ -695,6 +695,21 @@ func TestCheckArtifactModePreconditions(t *testing.T) {
Status: models.SuccessBackupStatus,
IsShardedCluster: true,
},
err: nil,
},
{
name: "sharded cluster restore not supported for physical backups",
pitrValue: time.Unix(0, 0),
artifactParams: models.CreateArtifactParams{
Name: "mongo-artifact-name-8",
Vendor: string(models.MongoDBServiceType),
LocationID: locationRes.ID,
ServiceID: *agent.ServiceID,
DataModel: models.PhysicalDataModel,
Mode: models.Snapshot,
Status: models.SuccessBackupStatus,
IsShardedCluster: true,
},
err: ErrIncompatibleService,
},
} {
Expand Down
Loading