Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MySQL Shell dumpInstance の仕組み

MySQL Shell dumpInstance の仕組み

Satoshi MITANI

October 29, 2020
Tweet

More Decks by Satoshi MITANI

Other Decks in Technology

Transcript

  1. MySQL Shell の util.dumpInstance おさらい • 論理バックアップ • 並列で⾼速にバックアップ •

    1つのテーブルをチャンクに分けてSELECT 2 $ ls -rw-r----- 1 user1 users 296 Oct 28 23:13 t.json -rw-r----- 1 user1 users 531 Oct 28 23:13 t.sql -rw-r----- 1 user1 users 289084 Oct 28 23:13 t@t@@0.tsv -rw-r----- 1 user1 users 8 Oct 28 23:13 t@t@@0.tsv.idx
  2. MySQL Shell 〜8.0.21 4 FLUSH TABLES WITH READ LOCK START

    TRANSACTION START TRANSACTION START TRANSACTION UNLOCK TABLES SELECT 〜 FROM t WHERE pk BETWEEN 1 AND 100 SELECT 〜 FROM t WHERE pk BETWEEN 101 AND 200 SELECT 〜 FROM t WHERE pk BETWEEN 201 AND 300 この間は 書き込め ない
  3. MySQL Shell 〜8.0.21 5 FLUSH TABLES WITH READ LOCK START

    TRANSACTION START TRANSACTION START TRANSACTION UNLOCK TABLES SELECT 〜 FROM t WHERE pk BETWEEN 1 AND 100 SELECT 〜 FROM t WHERE pk BETWEEN 101 AND 200 SELECT 〜 FROM t WHERE pk BETWEEN 201 AND 300 この間は 書き込め ない FTWRLで静⽌点を設ける
  4. MySQL Shell 〜8.0.21 6 FLUSH TABLES WITH READ LOCK START

    TRANSACTION START TRANSACTION START TRANSACTION UNLOCK TABLES SELECT 〜 FROM t WHERE pk BETWEEN 1 AND 100 SELECT 〜 FROM t WHERE pk BETWEEN 101 AND 200 SELECT 〜 FROM t WHERE pk BETWEEN 201 AND 300 この間は 書き込め ない なるほど かしこい
  5. MySQL Shell 8.0.22 9 LOCK TABLES db1.t1 db1.t2…READ START TRANSACTION

    START TRANSACTION START TRANSACTION UNLOCK TABLES SELECT 〜 FROM t WHERE pk BETWEEN 1 AND 100 SELECT 〜 FROM t WHERE pk BETWEEN 101 AND 200 SELECT 〜 FROM t WHERE pk BETWEEN 201 AND 300 この間は 書き込め ない LOCK TABLES db2.t1 db2.t2…READ
  6. MySQL Shell 8.0.22 10 LOCK TABLES db1.t1 db1.t2…READ START TRANSACTION

    START TRANSACTION START TRANSACTION UNLOCK TABLES SELECT 〜 FROM t WHERE pk BETWEEN 1 AND 100 SELECT 〜 FROM t WHERE pk BETWEEN 101 AND 200 SELECT 〜 FROM t WHERE pk BETWEEN 201 AND 300 この間は 書き込め ない LOCK TABLES db2.t1 db2.t2…READ なるほど かしこい
  7. MySQL Shell 8.0.22 • FTWRL が使えなければ、LOCK TABLES にフォールバック 11 NOTE:

    Error acquiring global read lock: MySQL Error 1227 (42000): Access denied; you need (at least one of) the RELOAD privilege(s) for this operation WARNING: The current user lacks privileges to acquire a global read lock using 'FLUSH TABLES WITH READ LOCK'. Falling back to LOCK TABLES... Table locks acquired