The rake task gitlab:backup:create should take consistent snapshots of the main & ci databases

Proposal

We can follow the snapshots approach that was suggested in this comment #364292 (comment 1013182777):

  1. Open from rake task a transaction that will set isolation level, and do pg_export_snapshot()
  2. Do whatever it takes to have pg_export_snapshot() as consistent across many databases as possible
  3. Run pg_dump --snapshot=name-of-snapshot to export exactly at the synchronization point

Ref.:

This effectively solves consistency between exports.

Edited by Thong Kuah