Sunday, August 19, 2007

MySQL Online Backup

My summary of the MySQL Online Backup algorithm.

There are basically 2 backup methods:
  • "At end" - Point Behind method
  • "At begin" - Point Forward method, this is also know as a snapshot backup.
  1. INITIAL PHASE
    • "At end" - Scan and write all data, and at the same time,
    • start writing all changes to a log.
  2. READY TO CREATE A VALIDITY POINT
    The engine is ready to create a validity point instantly.
    • "At end" - All data has been scanned, continue to write changes to a log.
  3. WAITING PHASE
    The engine is waiting for all other engines to reach the waiting phase.
    • "At end" - Continue to write changes to log.
  4. CREATE VALIDITY POINT
    The engine creates the validity point quickly.
    Changes after this point do NOT belong in the backup.
    • "At end" - Stop logging changes.
    • "At begin" - Create snapshot now!
  5. FINAL PHASE
    • "At end" - Write all changes recorded in the log.
    • "At begin" - Write all data in the snapshot.
  6. BACKUP END
    All engines have finished the final stage.