PBM restore with the possibility to order the collections by size

Hello :),

I would like to know if you are considering implementing an option for pbm restore for restoring collections and/or databases based on their size?

Here is our use case:

  • PBM Version: 2.10.0
  • MongoDB Version: 6.0
  • Debian Version: 12/13

We have huge collections in production that are not critical to the core functioning of our application, and we need to be able to prioritize or sort the restore process based on collection size.

For example, if our production environment crashes or if we need to test a restore on another platform, we would like to bring up a functional MongoDB instance as fast as possible by postponing or skipping the restoration of these massive, non-critical collections.

Currently, we cannot exclude collections from the pbm backup command (I opened a Jira ticket for this 4 years ago: PBM-798 (https://perconadev.atlassian.net/browse/PBM-798)).

Furthermore, we cannot exclude collections during a pbm restore either, nor can we sort the collections being restored. Our only current option is to manually select and restore specific collections/databases one by one.

I believe adding an option to filter or sort restores by collection size would be a highly valuable improvement for many PBM users in the community.

Please let me know if there are any plans for this, or if I might have missed an existing/ongoing ticket regarding this feature!

Best regards,

Hello and thank you for sharing your use case!

PBM improves flexibility for that type of use case by introducing selective backup/restore for multiple namespaces:

E.g. it’s possible to do the following, create selective backup with specified namespaces:

pbm backup - -ns=”db1.c1, db2.c2, db3.*”

And then restore just part of that selective backup:

pbm restore --ns=”db2.c2, db3.x, db3.y”

For your suggestion, that is just the opposite of excluding namespaces, which we might add at some point in the future.
Related to collection size criteria, that’s a vague requirement because small or big collections can be important or unimportant. If the above doesn’t work for you, please create the jira improvement and try to explain the use case in more detail.

Hey @Boris_Ilijic ,

Thank you for your answer.

I know about the namespace and that’s not what I meant by my post :slight_smile: but thank you for the reminder!

I just wanted to have a way to chose not by name but by size for the order of restore and by your answer I understand that there is none correct ?

Regards,

Hey again,

Our only current option is to manually select and restore specific collections/databases one by one.

In the original post this was mentioned as the only option, but it’s possible to specify the list of collections/databases and basically do that in a single restore. Therefore, I mentioned selective restore for multiple namespaces feature. Sorry for the misunderstanding.

I believe adding an option to filter or sort restores by collection size would be a highly valuable improvement…
I just wanted to have a way to chose not by name but by size for the order of restore …

The proposed feature is to have something like:
pbm restore --ns-size-under=100MiB <backup-id>
for restoring all namespaces less than 100MiB, and it can also be ordered by ns size in ascending order.

Please confirm if that is the intention of the feature?