How does consistent snapshot work?

Created by Domas Mituzas on on 2009-02-02
Last updated by:
Domas Mituzas on on 2009-02-05

This is all done following best MySQL practices and traditions:

1. Global write lock is acquired ("FLUSH TABLES WITH READ LOCK")
2. Various metadata is read ("SHOW SLAVE STATUS","SHOW MASTER STATUS")
3. Other threads connect and establish snapshots ("START TRANSACTION WITH CONSISTENT SNAPSHOT")
3.1. On pre-4.1.8 it creates dummy InnoDB table, and reads from it.
4. Once all worker threads announce the snapshot establishment, master executes "UNLOCK TABLES" and starts queueing jobs.

This for now does not provide consistent snapshots for non-transactional engines - support for that is expected in 0.2 :)