If PBM mongo backup can wait command `pbm config --force-resync` finished

If there is a method for PBM mongo backup to wait pbm config --force-resync finished so that I can run the other command for example list the backups

pbm logs -f contains info about resync progress.
[PBM-1187] Add --wait option to pbm config --force-resync

When do you run the command? What you are trying to resolve by using the command?

PBM resyncs each time it is needed. An exception is after a backup restore (where you need to run the command).

Aha seems there is a story to add --wait, but I have no permission to check PBM-1187.
When I have a product environment and want to clone it, I will prepare a new environment and use the same object storage to restore the data. In the new env, to list all the backups, I will use the following script:

pbm config --file=/home/xxx/percona-mongo-config.yml --mongodb-uri xxx-new-env
pbm config --force-resync --mongodb-uri xxx-new-env
sleep 10
pbm list --mongodb-uri xxx-new-env

However, if the backup is large, I have to increase the sleep time to allow sufficient time for the resync process to be completed.

we will publish the ticket. for now I suggest to “grep” pbm logs for success (one agent resynced) or failure (all agent rejected). I cannot tell how the output can look right now. Please experiment for now

1 Like

In a loop

  if pbm logs -e resync -t 1 | grep '\[resync\] succeed'; then
      echo "Resync succeed."
      exit 0
  fi

Hi, @Dmytro_Zghoba this code works.
Do you know what PBM does when resync, it is a little slow.
It took almost 5 minutes to complete the resync.
In my env the oplogSpanMin is 10

Hi,

pbm config --force-resync can be described as “refresh metadata cache from storage”.

A PBM agent removes metadata in admin.pbm* collections, goes through all backups, restores and oplog chunks on storage, and creates the metadata for them. Oplog chunks are the most time-consuming operation because they are small, and there are a lot of them. For each chunk file (for each replset), it creates a separate metadata document for each.
To speed up, remove older oplog chunks by pbm delete-pitr --older-then=$UTC

1 Like