Percona-Lab / mongodb_consistent_backup

A tool for performing consistent backups of MongoDB Clusters or Replica Sets
https://www.percona.com
Apache License 2.0
276 stars 80 forks source link

Disable use of --oplog flag in 'mongodump' backup method #232

Open timvaillancourt opened 7 years ago

timvaillancourt commented 7 years ago

Since the beginning of this tool the '--oplog' flag is passed to mongodump. Our Python code ALSO tails the oplog and merges the mongodump+Python oplog at the end.

This was done because I didn't want to make any assumptions about how mongodump achieved consistency via the oplog. In hindsight, it isn't doing anything 'special' aside from dump the oplog from before the collection dumping to the end of backup.

I'm now confident that removing the '--oplog' dumping in mongodump will achieve the same consistency due to MongoDB's replication design. This also prepares us for backup methods that don't support oplog tailing, such as block snapshots.

This means we can disable oplog tailing in 'mongodump'.

This will require:

  1. '--oplog' flag is NOT passed to mongodump.
  2. Logic for merging the mongodump and Python oplog is removed from Oplog/Resolver/*.py.

Benefits:

  1. Oplog is not dumped twice, this is lighter on MongoDB nodes.
  2. Less resources+space used during backup on the host running MCB.
  3. Faster and simpler Oplog Resolver stage - it only needs to trim the oplogs to a consistent time, not merge and trim.