| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Verify that a partially failed 'GRANT' statement does not save its gtid |
| 4 |
# into @@GLOBAL.GTID_EXECUTED and is not binlogged when binlog is enabled. |
| 5 |
# |
| 6 |
# ==== Implementation ==== |
| 7 |
# |
| 8 |
# 1) Execute a partially failed 'GRANT' statement. |
| 9 |
# 2) Verify that the partially failed statement does not save its gtid |
| 10 |
# into @@GLOBAL.GTID_EXECUTED, since it is not binlogged when binlog |
| 11 |
# is enabled. |
| 12 |
# 3) Execute above two steps for all different types of statements. |
| 13 |
# |
| 14 |
# ==== References ==== |
| 15 |
# |
| 16 |
# Bug#21686749 PARTIALLY FAILED DROP OR ACL STMT FAILS TO CONSUME GTID ON BINLOGLESS SLAVE |
| 17 |
# See mysql-test/t/no_binlog_gtid_next_partially_failed_stmts.test |
| 18 |
# See mysql-test/t/no_binlog_gtid_next_partially_failed_stmts_error.test |
| 19 |
# See mysql-test/suite/binlog/t/binlog_gtid_next_partially_failed_stmts.test |
| 20 |
# See mysql-test/t/no_binlog_gtid_next_partially_failed_stmts_anonymous.test |
| 21 |
# |
| 22 |
|
| 23 |
# Test in this file is binlog format agnostic, thus no need |
| 24 |
# to rerun it for every format. |
| 25 |
--source include/have_binlog_format_row.inc |
| 26 |
|
| 27 |
# Make sure the test is repeatable |
| 28 |
RESET MASTER; |
| 29 |
|
| 30 |
call mtr.add_suppression("REVOKE/GRANT failed while storing table level and column level grants in the privilege tables. An incident event has been written to the binary log which will stop the replicas."); |
| 31 |
|
| 32 |
--let $master_uuid= `SELECT @@GLOBAL.SERVER_UUID` |
| 33 |
|
| 34 |
CREATE TABLE t1(a INT, b INT); |
| 35 |
CREATE USER u1@h; |
| 36 |
--echo # |
| 37 |
--echo # Verify that u1 is added into mysql.user. |
| 38 |
--echo # |
| 39 |
SELECT user FROM mysql.user where user='u1'; |
| 40 |
|
| 41 |
--let $saved_master_pos=query_get_value('SHOW MASTER STATUS', Position, 1) |
| 42 |
--error ER_CANT_CREATE_USER_WITH_GRANT |
| 43 |
GRANT SELECT(a) ON t1 TO u1@h, u2@h; |
| 44 |
--echo # |
| 45 |
--echo # u1@h should not have been granted any permission |
| 46 |
--echo # |
| 47 |
SELECT user, column_name, column_priv FROM mysql.columns_priv; |
| 48 |
--echo # |
| 49 |
--echo # Verify that the partially failed GRANT statement does not generate |
| 50 |
--echo # a gtid and save the gtid into @@GLOBAL.GTID_EXECUTED. |
| 51 |
--echo # |
| 52 |
--replace_result $master_uuid MASTER_UUID |
| 53 |
--let $assert_text= Does not generate MASTER_UUID:4 and commit it into @@GLOBAL.GTID_EXECUTED |
| 54 |
--let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$master_uuid:1-3" |
| 55 |
--source include/assert.inc |
| 56 |
--echo # |
| 57 |
--echo # Verify that the partially failed GRANT statement is not binlogged. |
| 58 |
--echo # |
| 59 |
--let $binlog_start= $saved_master_pos |
| 60 |
--source include/show_binlog_events.inc |
| 61 |
|
| 62 |
DROP USER u1@h; |
| 63 |
DROP TABLE t1; |
| 64 |
|