BUG:mysql 5.6 Invalid use of GRANT/REVOKE command breaks replication,revokereplication

來源:互聯網
上載者:User

BUG:mysql 5.6 Invalid use of GRANT/REVOKE command breaks replication,revokereplication

bug描述:當使用revoke,grant命令收回,授予許可權出錯時(語法錯誤除外),會導致主從同步異常終止。如:

mysql> revoke select on *.* from aaa;
ERROR 1141 (42000): There is no such grant defined for user 'aaa' on host '%'     該使用者沒有該許可權卻執行了回收該許可權

mysql> GRANT FILE ON test.* TO test@127.0.0.1;
ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES   錯誤授權等

影響版本:mysql 5.6~5.6.13

情境重現:

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


解決方案:

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 a;
+----+
| 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)


官方bug參考地址:http://bugs.mysql.com/bug.php?id=68892


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.