Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Allow restore data from sites in groups backup to different site #4509

Closed
wants to merge 12 commits into from

Conversation

meain
Copy link
Member

@meain meain commented Oct 16, 2023

This adds the option restore a site to a different one from the one that it was backed up from.


Does this PR need a docs update or release note?

  • βœ… Yes, it's included
  • πŸ• Yes, but in a later PR
  • β›” No

Type of change

  • 🌻 Feature
  • πŸ› Bugfix
  • πŸ—ΊοΈ Documentation
  • πŸ€– Supportability/Tests
  • πŸ’» CI/Deployment
  • 🧹 Tech Debt/Cleanup

Issue(s)

Test Plan

  • πŸ’ͺ Manual
  • ⚑ Unit test
  • πŸ’š E2E

@meain meain added restore teams & groups Teams and Groups service and API functionality. labels Oct 16, 2023
@meain meain self-assigned this Oct 16, 2023
@aviator-app
Copy link
Contributor

aviator-app bot commented Oct 16, 2023

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This PR was closed without merging. If you still want to merge this PR, re-open it.


See the real-time status of this PR on the Aviator webapp.
Use the Aviator Chrome Extension to see the status of your PR within GitHub.

@meain meain temporarily deployed to Testing October 16, 2023 13:38 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 16, 2023 13:38 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 16, 2023 13:38 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 16, 2023 13:39 — with GitHub Actions Inactive
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!Β  Β  Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@meain meain force-pushed the group-alternate-site branch from 9e62337 to 4ffa2d4 Compare October 16, 2023 14:44
@meain meain temporarily deployed to Testing October 16, 2023 14:44 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 16, 2023 14:44 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 16, 2023 14:44 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 16, 2023 14:45 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 16, 2023 14:45 — with GitHub Actions Inactive
@meain meain force-pushed the group-alternate-site branch from 4ffa2d4 to b70e20d Compare October 17, 2023 09:25
@meain meain temporarily deployed to Testing October 17, 2023 09:26 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 17, 2023 09:26 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 17, 2023 09:26 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 17, 2023 09:27 — with GitHub Actions Inactive
@meain meain force-pushed the group-alternate-site branch from db4853b to 04c3d20 Compare October 18, 2023 11:43
@meain meain temporarily deployed to Testing October 18, 2023 11:44 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 18, 2023 11:44 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 18, 2023 11:44 — with GitHub Actions Inactive
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!Β  Β  Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.3% 0.3% Duplication

@meain meain temporarily deployed to Testing October 18, 2023 11:45 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 18, 2023 11:45 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 18, 2023 11:45 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 18, 2023 11:45 — with GitHub Actions Inactive
@meain meain temporarily deployed to Testing October 18, 2023 11:45 — with GitHub Actions Inactive
Comment on lines +30 to +31
SubServiceType path.ServiceType
SubService string
Copy link
Member Author

Choose a reason for hiding this comment

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

Any thoughts on this pattern? Any alternate suggestions?

Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to duplicate the selector's ownership. Moving these out of there and into the restore config opens up the potential for conflict between these props and the selector. Similarly, it might lead to building this data into the selector downstream anyway. Iirc, the selector already has the capacity to specify the secondary resource; seems like this identification could be owned there instead.

Comment on lines +57 to +60
// SubService specifies the sub-service which we are restoring in
// case of services that are constructed out of multiple services
// like Groups.
SubService RestoreConfigSubService
Copy link
Member Author

Choose a reason for hiding this comment

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

RestoreConfig change here.

@@ -197,88 +198,6 @@ func (ctrl *Controller) CacheItemInfo(dii details.ItemInfo) {
}
}

// ---------------------------------------------------------------------------
Copy link
Member Author

Choose a reason for hiding this comment

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

Move as is to src/internal/m365/service/common/lookup.go.


var protectedResource idname.Provider = sel

// In case of groups, we use the root site as the restore target
Copy link
Member Author

Choose a reason for hiding this comment

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

Do we have to make it configurable by caller? I didn't think it was required as this is test code.

@meain meain changed the title [WIP] Allow restore data from sites in groups backup to different site Allow restore data from sites in groups backup to different site Oct 19, 2023
@meain meain requested review from ryanfkeepers and ashmrtn October 19, 2023 09:26
@meain meain marked this pull request as ready for review October 19, 2023 09:26
Copy link
Contributor

@ryanfkeepers ryanfkeepers left a comment

Choose a reason for hiding this comment

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

Looks functional, but I don't fully agree with the design as it splits ownership across multiple systems (configuration, selection) instead of holding to the current pattern of using selectors to source restore data, which would centralize control within a singular interface.

Separately, this PR has too much going on to easily review. There's a lot of refactoring, plus changes across the cli, operations, and service layers. To review it properly these things need to get split out across several PRs. I'd recommend:

  • first: change selectors to best accomodate subservice declaration and identification according to an interface (we may want a design doc for this).
  • second: change the operations and service layers to consume the new selectors interface.
  • third: expose these changes via the CLI and SDK boundaries.

interpolate large refactors as separate PRs along the way, whenever appropriate.

}
fs.StringVar(
&ToResourceFV, ToResourceFN, "",
"Overrides the protected resource (mailbox, site, user, etc) where data gets restored")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"Overrides the protected resource (mailbox, site, user, etc) where data gets restored")
"Overrides which protected resource (mailbox, site, user, etc) receives the restored data")

} else if len(opts.WebURL)+len(opts.SiteID) > 1 {
return clues.New("only a single site can be selected for restore")
}
// When restoring the user has to select a single site to
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// When restoring the user has to select a single site to
// When restoring, the caller must select a single site to

}

if len(opts.WebURL)+len(opts.SiteID) > 1 {
return clues.New("only a single site can be selected when processing sub resources")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return clues.New("only a single site can be selected when processing sub resources")
return clues.New("cannot select multiple sites for this operation")

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not confident that this code belongs in the common package, either at the top level or as a subpackage. Is there a strong reason not to keep it in its current location at this time?

"github.com/alcionai/corso/src/pkg/count"
"github.com/alcionai/corso/src/pkg/fault"
"github.com/alcionai/corso/src/pkg/path"
)

func (ctrl *Controller) GetRestoreResource(
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func (ctrl *Controller) GetRestoreResource(
func (ctrl *Controller) GetResource(

Comment on lines +30 to +31
SubServiceType path.ServiceType
SubService string
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to duplicate the selector's ownership. Moving these out of there and into the restore config opens up the potential for conflict between these props and the selector. Similarly, it might lead to building this data into the selector downstream anyway. Iirc, the selector already has the capacity to specify the secondary resource; seems like this identification could be owned there instead.

@@ -227,7 +227,11 @@ func (op *RestoreOperation) do(
return nil, clues.Wrap(err, "getting backup and details")
}

restoreToProtectedResource, err := chooseRestoreResource(ctx, op.rc, op.RestoreCfg, bup.Selector)
restoreService, restoreToProtectedResource, err := op.rc.GetRestoreResource(
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a way the selector and this service can differ? Could we remove the service return value and continue to use the value from the selector? Seems like it would be less error prone

@meain
Copy link
Member Author

meain commented Nov 7, 2023

Temporarily moving over to implementing exports for email as that has moved up in priority. Will get back to rework this after that.

@meain
Copy link
Member Author

meain commented Feb 5, 2024

Closing this PR. Will create a new PR when revisiting this issue.

@meain meain closed this Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
restore teams & groups Teams and Groups service and API functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow restoring to a different Group(site) that the one backed up from
3 participants