テスト用のテーブル
mysql> CREATE TABLE grplt.tbl (pk SERIAL, col1 int, who_update varchar(10));
Query OK, 0 rows affected (0.00 sec)
mysql> INSERT INTO grplt.tbl (col1, who_update) VALUES (1, 'node1') , (2, 'node1'), (3, 'node1');
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> SELECT * FROM grplt.tbl;
+----+------+------------+
| pk | col1 | who_update |
+----+------+------------+
| 1 | 1 | node1 |
| 8 | 2 | node1 |
| 15 | 3 | node1 |
+----+------+------------+
3 rows in set (0.00 sec)
いつものデッドロック
同じサーバに対して、入れ子の行ロックを取る2つのトランザクションを実行するパターン。
ERROR 1213 (40001): Deadlock found when trying to get lock; try
restarting transaction …
[さらに読む]