Non-blocking backup

To provide consistent backup, mydumper acquires GLOBAL LOCK by executing FLUSH TABLES WITH READ LOCK.

You have already seen how dangerous it is to use FLUSH TABLES WITH READ LOCK if there are any long-running transactions (explained in Chapter 5, Transactions). To avoid that, you can pass the --kill-long-queries option to kill blocking queries rather than aborting mydumper.

  • --trx-consistency-only: This is equivalent to --single-transaction for mysqldump but with a binlog position. Obviously, this position only applies to transactional tables. One of the advantages of using this option is that the global read lock is only held for the threads' coordination, so it's released as soon as the transactions are started.
  • --use-savepoints ...

Get MySQL 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.