BUG: mysql 5.6 Invalid use of GRANT/REVOKE command breaks replication, revokereplication
Bug Description: When the revoke and grant commands are used to revoke the permission, an error occurred while granting the permission (except for syntax errors), causing the master-slave synchronization to terminate abnormally. For example:
Mysql> revoke select on *. * from aaa;
ERROR 1141 (42000): There is no such grant defined for user 'aaa' on host' % 'the user does not have this permission, but the user executes the revoke permission.
Mysql> grant file on test. * TO test@127.0.0.1;
ERROR 1221 (HY000): Incorrect usage of db grant and global privileges, etc.
Affected Versions: mysql 5.6 ~ 5.6.13
Scenario reproduction:
Master:
Mysql> insert into a values (1 );
Query OK, 1 row affected (0.00 sec)
Mysql> grant file on test. * TO test@127.0.0.1;
ERROR 1221 (HY000): Incorrect usage of db grant and GLOBAL PRIVILEGES
Mysql> insert into a values (2 );
Query OK, 1 row affected (0.00 sec)
Mysql> insert into a values (3 );
Query OK, 1 row affected (0.00 sec)
Slave:
Mysql> show slave status \ G
* *************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.16.0.44
Master_User: rpladmin
Master_Port: 3306
Connect_Retry: 10
Master_Log_File: online044-bin.000013
Read_Master_Log_Pos: 307
Relay_Log_File: online045-relay-bin.000028
Relay_Log_Pos: 474
Relay_Master_Log_File: online044-bin.000012
Slave_IO_Running: Yes
Slave_ SQL _Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_errno.: 1590
Last_Error: The incident LOST_EVENTS occured on the master. Message: error writing to the binary log
Skip_Counter: 0
Exec_Master_Log_Pos: 307
Relay_Log_Space: 1634
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_ SQL _Errno: 1590
Last_ SQL _Error: The incident LOST_EVENTS occured on the master. Message: error writing to the binary log
Replicate_Ignore_Server_Ids:
Master_Server_Id: 17216044
Master_UUID: cad43e8b-97b0-11e4-a557-00505681293d
Master_Info_File:/data/mysql/master.info
SQL _Delay: 0
SQL _Remaining_Delay: NULL
Slave_ SQL _Running_State:
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_ SQL _Error_Timestamp: 150109 14:07:55
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Solution:
Mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)
Mysql> set global SQL _slave_skip_counter = 1;
Query OK, 0 rows affected (0.00 sec)
Mysql> start slave;
Query OK, 0 rows affected (0.01 sec)
Mysql> select * from;
+ ---- +
| Id |
+ ---- +
| 1 |
| 2 |
| 3 |
Mysql> show slave status \ G
* *************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.16.0.44
Master_User: rpladmin
Master_Port: 3306
Connect_Retry: 10
Master_Log_File: online044-bin.000012
Read_Master_Log_Pos: 120
Relay_Log_File: online045-relay-bin.000028
Relay_Log_Pos: 287
Relay_Master_Log_File: online044-bin.000012
Slave_IO_Running: Yes
Slave_ SQL _Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 120
Relay_Log_Space: 631
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_ SQL _Errno: 0
Last_ SQL _Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 17216044
Master_UUID: cad43e8b-97b0-11e4-a557-00505681293d
Master_Info_File:/data/mysql/master.info
SQL _Delay: 0
SQL _Remaining_Delay: NULL
Slave_ SQL _Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_ SQL _Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
1 row in set (0.00 sec)
Official bug reference: http://bugs.mysql.com/bug.php? Id = 68892