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 |
2018-03-08T05:09:54.293991Z 0 [Note] WSREP: Shifting SYNCED -> DONOR/DESYNCED (TO: 1777)<br>2018-03-08T05:09:58.040809Z 5 [Note] WSREP: Provider paused at c7daf065-2285-11e8-a848-af3e3329ab8f:2002 (2047)<br>2018-03-08T05:14:20.508317Z 5 [Note] WSREP: resuming provider at 2047<br>2018-03-08T05:14:20.508350Z 5 [Note] WSREP: Provider resumed.<br>2018-03-08T05:14:20.508887Z 0 [Note] WSREP: Member 1.0 (n2) resyncs itself to group<br>2018-03-08T05:14:20.508900Z 0 [Note] WSREP: Shifting DONOR/DESYNCED -> JOINED (TO: 29145)<br>2018-03-08T05:15:16.932759Z 0 [Note] WSREP: Member 1.0 (n2) synced with group.<br>2018-03-08T05:15:16.932782Z 0 [Note] WSREP: Shifting JOINED -> SYNCED (TO: 29145)<br>2018-03-08T05:15:16.988029Z 2 [Note] WSREP: Synchronized with group, ready for connections<br>2018-03-08T05:15:16.988054Z 2 [Note] WSREP: Setting wsrep_ready to true |
|
1 |
2018-03-07T06:40:00.143783Z 5 [Note] WSREP: Provider paused at 40de14ba-21be-11e8-8e3d-0ee226700bda:147682 (149032)<br>2018-03-07T06:40:00.144347Z 5 [Note] InnoDB: Sync to disk of `test`.`t` started.<br>2018-03-07T06:40:00.144365Z 5 [Note] InnoDB: Stopping purge<br>2018-03-07T06:40:00.144468Z 5 [Note] InnoDB: Writing table metadata to './test/t.cfg'<br>2018-03-07T06:40:00.144537Z 5 [Note] InnoDB: Table `test`.`t` flushed to disk<br>2018-03-07T06:40:01.855847Z 5 [Note] InnoDB: Deleting the meta-data file './test/t.cfg'<br>2018-03-07T06:40:01.855874Z 5 [Note] InnoDB: Resuming purge<br>2018-03-07T06:40:01.855955Z 5 [Note] WSREP: resuming provider at 149032<br>2018-03-07T06:40:01.855970Z 5 [Note] WSREP: Provider resumed. |
|
1 |
mysql> show status like 'Com%lock%';<br>+----------------------------+-------+<br>| Variable_name | Value |<br>+----------------------------+-------+<br>| Com_lock_tables | 2 |<br>| Com_lock_tables_for_backup | 1 |<br>| Com_lock_binlog_for_backup | 1 |<br>| Com_unlock_binlog | 1 |<br>| Com_unlock_tables | 5 |<br>+----------------------------+-------+<br>5 rows in set (0.01 sec)<br><br>mysql> show status like '%flush%';<br>+--------------------------------------+---------+<br>| Variable_name | Value |<br>+--------------------------------------+---------+<br>| Com_flush | 4 |<br>| Flush_commands | 3 |<br><br>* 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.
Resources
RELATED POSTS