Replication slave from PXC can crash if wsrep_forced_binlog_format=ROW
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Percona XtraDB Cluster moved to https://jira.percona.com/projects/PXC | Status tracked in 5.6 | |||||
5.5 |
Confirmed
|
High
|
Unassigned | |||
5.6 |
Confirmed
|
High
|
Kenn Takara |
Bug Description
Unfortunately, I didn't have much time to dig into it more deeper.
I have the following setup:
- 3 nodes in PXC setup (server names are "db1,db2,db3"), version is the same for all PXC nodes.
Server version: 5.5.31-23.7.5 Percona XtraDB Cluster (GPL) 5.5.31-23.7.5, Revision 438, wsrep_23.7.5.r3880
- 1 replication slave (server name is "s1"), which is using node db3 as a master.
Server version: 5.5.32-rel31.0-log Percona Server with XtraDB (GPL), Release rel31.0, Revision 549
db3 has the following option enabled:
wsrep_forced_
Now let's create test procedure on one of the nodes in our PXC:
mysql> delimiter //
mysql> create procedure test_proc() BEGIN INSERT INTO test VALUES(1);end//
Query OK, 0 rows affected (0.01 sec)
mysql> delimiter ;
Then go to s1 server and check slave status, I left only important info from this output:
mysql> show slave status\G
...
...
...
That's it. We just corrupted our slave (s1). Skipping an error will fix this.
Looks like PXC was trying to create this procedure twice and at the second time it failed because of duplicate record on s1 in mysql.proc (b/c of primary key).
I didn't find any duplicate records in binary log, commands counter was increased by 1 as required, so probably the problem is somewhere is Galera library.
Btw, dropping this procedure leads to the same issue.
This issue can be fixed if we set wsrep_forced_
Verified with PXC 5.5 (Master node) and PS 5.5 (async slave)
On Master:
mysql> show global variables like 'wsrep_forced%'; ------- ------- ------- -+----- --+ ------- ------- ------- -+----- --+ binlog_ format | ROW | ------- ------- ------- -+----- --+
+------
| Variable_name | Value |
+------
| wsrep_forced_
+------
1 row in set (0.00 sec)
mysql> delimiter //
mysql> use nil
Database changed
mysql>
mysql> create procedure test_proc() BEGIN INSERT INTO test VALUES(1);end//
Query OK, 0 rows affected (0.00 sec)
mysql> delimiter ;
mysql> quit
On Slave:
mysql> show slave status \G ******* ******* ****** 1. row ******* ******* ******* ******
Slave_ IO_State: Waiting for master to send event
Master_ Host: 192.168.43.58
Master_ User: root
Master_ Port: 3306
Connect_ Retry: 60
Master_ Log_File: mysql-bin.000002
Read_ Master_ Log_Pos: 759
Relay_ Log_File: mysql_sandbox55 35-relay- bin.000004
Relay_ Log_Pos: 425
Relay_ Master_ Log_File: mysql-bin.000002
Slave_ IO_Running: Yes
Slave_ SQL_Running: No
Last_ Error: Could not execute Write_rows event on table mysql.proc; Duplicate entry 'nil-test_ proc-PROCEDURE' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_ FOUND_DUPP_ KEY; the event's master log mysql-bin.000002, end_log_pos 675
Last_SQL_ Error: Could not execute Write_rows event on table mysql.proc; Duplicate entry 'nil-test_ proc-PROCEDURE' for key 'PRIMARY', Error_code: 1062; handler error HA_ERR_ FOUND_DUPP_ KEY; the event's master log mysql-bin.000002, end_log_pos 675
*******
...
Last_Errno: 1062
...
Last_SQL_Errno: 1062