-
Notifications
You must be signed in to change notification settings - Fork 111
PBM-1561: Enable selective logical restore for sharded cluster #1235
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
base: dev
Are you sure you want to change the base?
Conversation
PBM applyed cleanup cluster phase only for the full logical restore so far.
The comand is used in the cleanup phase of the selective logical restore. Before the restore procedure, it's necessary to do cluster-wide cleanup of the particular namespace that is part of selective restore.
... to be able to share it between full and selective restore.
For the purpose of fetching config.databases document when performing cleanup phase during logical restore.
It's used for the cleanup phase during selective logical restore.
... within logical restore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enables selective logical restore for sharded MongoDB clusters by introducing database and collection cleanup operations specific to selective restores. The implementation adds support for cluster-wide dropping of databases and collections using MongoDB's internal _shardsvrDropDatabase and _shardsvrDropCollection commands.
Key Changes:
- Added selective restore cleanup logic that drops specific databases/collections based on restore namespaces
- Refactored full restore cleanup to use the same underlying database operation interface
- Introduced
mDBstruct andmDBClinterface to encapsulate database operations for better testability
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 13 comments.
| File | Description |
|---|---|
| pbm/defs/defs.go | Added ConfigDB constant for the "config" database name |
| pbm/restore/query.go | Introduced mDB struct with methods for executing cluster-wide drop commands and fetching config database documents |
| pbm/restore/logical.go | Refactored restore cleanup logic to support both full and selective restores with proper database/collection dropping |
| pbm/restore/logical_test.go | Added comprehensive test coverage for selective restore cleanup scenarios including edge cases |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d0e4954 to
e925b65
Compare
This is follow-up of #1129 which was about full logical restore.
This PR enables selective logical restore in the sharded cluster when targeted database/collection already exists:
cleanup phasePBM drops all the databases/collections that are listed with--nsoption--ns "db.coll") PBM uses_shardsvrDropCollectioncommand to cleanup specified collection.--ns "db.*") PBM uses_shardsvrDropDatabasecommand to cleanup specified database.--time) restore.