Resync pbmBackups when storage location changes in config

Description

When the storage destination is changed (included being initialized for the first time) the available backups change. E.g. if you change from your Minio localhost test at [127.0.0.1:9000 testbucket1, some_dir] to using, say, AWS S3 at [region xxx-yyy, mongodb_prod_bk_bucket1, some_dir_prefix] then the backups available to PBM stop being those on the Minio and are the ones in that AWS S3 location instead.

After the storage location changes the list of backups in admin.pbmBackups should be resynced to match those in the new location. If there are none, then yes delete all.

Regarding old pbmBackup documents from the earlier storage location: I think we should drop them for now. Keeping them for archival purposes is desirable, and maybe putting them in pbmLog is sufficient, but that is a different ticket.

Environment

None

Smart Checklist

Activity

Show:

andrew.pogrebnoi December 18, 2019 at 7:54 PM

Also added the `pbm config --resync` flag to enforce resync. Resync from the filesystem store also supported.

Backups list is fully synchronized with the [remote] store. Meaning if there is nothing there - `pbm list` is empty.

All the existing backups' meta is copied to the `admin.pbmBackups.old` collection beforehand. In format 

{ "copied_at" : ISODate("2019-12-18T18:09:24.238Z"), "backups" : [{backupMeta}, ...] }
Done

Details

Assignee

Reporter

Needs Review

Yes

Needs QA

Yes

Time tracking

2d 2h logged

Fix versions

Affects versions

Priority

Smart Checklist

Created December 12, 2019 at 6:12 AM
Updated March 5, 2024 at 7:19 PM
Resolved January 15, 2020 at 4:47 PM