How can I instruct MySQL to complete all in-progress transactions, but to delay starting new ones (without kicking clients off) until I have taken a ZFS or LVM snapshot (which takes less than a second).e.g.pause MySQL, waiting for in-progress transactions to completesync to disktake ZFS/LVM snapshotresume MySQLThe point of this is to get a consistent snapshot for backup purposes.  Step 2 takes a fraction of a second.Step one should not cause client errors, just a very short pause until step 4 is reached.Are there MySQL commands which can do 1 and 4?  What are they?
How to pause MySQL before taking an LVM/ZFS snapshot?
linux;lvm;mysql;zfs
A hacky way would be, to wait for the transactions to finish:mysql> FLUSH LOCAL TABLES;Query OK, 0 rows affected (11.31 sec)and then getting a read lock:mysql> FLUSH TABLES WITH READ LOCK;Query OK, 0 rows affected (22.55 sec)Now all queries are blocked (ie. they wait for the lock to get released) until your session ends. Mind you - you still have to wait until all transactions are finished. Depending on your workload this can take a while (UPDATE-ing a few million rows...).You can code this in your favourite script language.But seriously - why not use Xtrabackup ? It does take care of a consistent snapshot of mysql for you and you can dump it on the filesystem,  and zfs/lvm snapshot it.