In this blog post, we’ll look at how Percona XtraDB Cluster (PXC) executes FLUSH and LOCK handling.
Introduction
Percona XtraDB Cluster is a multi-master solution that allows parallel execution of the transactions on multiple nodes at the same point in time. Given this semantics, it is important to understand how Percona XtraDB Cluster executes statements regarding FLUSH and LOCK handling (that operate at node level).
The section below enlist different flavors of these statements and their PXC semantics
|
1 2 3 4 5 6 7 8 9 10 |
2018-03-08T05:09:54.293991Z 0 [Note] WSREP: Shifting SYNCED -> DONOR/DESYNCED (TO: 1777) 2018-03-08T05:09:58.040809Z 5 [Note] WSREP: Provider paused at c7daf065-2285-11e8-a848-af3e3329ab8f:2002 (2047) 2018-03-08T05:14:20.508317Z 5 [Note] WSREP: resuming provider at 2047 2018-03-08T05:14:20.508350Z 5 [Note] WSREP: Provider resumed. 2018-03-08T05:14:20.508887Z 0 [Note] WSREP: Member 1.0 (n2) resyncs itself to group 2018-03-08T05:14:20.508900Z 0 [Note] WSREP: Shifting DONOR/DESYNCED -> JOINED (TO: 29145) 2018-03-08T05:15:16.932759Z 0 [Note] WSREP: Member 1.0 (n2) synced with group. 2018-03-08T05:15:16.932782Z 0 [Note] WSREP: Shifting JOINED -> SYNCED (TO: 29145) 2018-03-08T05:15:16.988029Z 2 [Note] WSREP: Synchronized with group, ready for connections 2018-03-08T05:15:16.988054Z 2 [Note] WSREP: Setting wsrep_ready to true |
|
1 2 3 4 5 6 7 8 9 |
2018-03-07T06:40:00.143783Z 5 [Note] WSREP: Provider paused at 40de14ba-21be-11e8-8e3d-0ee226700bda:147682 (149032) 2018-03-07T06:40:00.144347Z 5 [Note] InnoDB: Sync to disk of `test`.`t` started. 2018-03-07T06:40:00.144365Z 5 [Note] InnoDB: Stopping purge 2018-03-07T06:40:00.144468Z 5 [Note] InnoDB: Writing table metadata to './test/t.cfg' 2018-03-07T06:40:00.144537Z 5 [Note] InnoDB: Table `test`.`t` flushed to disk 2018-03-07T06:40:01.855847Z 5 [Note] InnoDB: Deleting the meta-data file './test/t.cfg' 2018-03-07T06:40:01.855874Z 5 [Note] InnoDB: Resuming purge 2018-03-07T06:40:01.855955Z 5 [Note] WSREP: resuming provider at 149032 2018-03-07T06:40:01.855970Z 5 [Note] WSREP: Provider resumed. |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
mysql> show status like 'Com%lock%'; +----------------------------+-------+ | Variable_name | Value | +----------------------------+-------+ | Com_lock_tables | 2 | | Com_lock_tables_for_backup | 1 | | Com_lock_binlog_for_backup | 1 | | Com_unlock_binlog | 1 | | Com_unlock_tables | 5 | +----------------------------+-------+ 5 rows in set (0.01 sec) mysql> show status like '%flush%'; +--------------------------------------+---------+ | Variable_name | Value | +--------------------------------------+---------+ | Com_flush | 4 | | Flush_commands | 3 | * Flush_commands is a global counter. Check MySQL documentation for more details. |
By now, we can conclude that the user should be a bit more careful when executing local lock commands (understanding the semantics and the effect). Careful execution of these commands can help serve your purpose.