| 1 |
RESET MASTER; |
| 2 |
call mtr.add_suppression("Did not write failed .* into binary log while storing table level and column level grants in the privilege tables"); |
| 3 |
CREATE TABLE t1(a INT, b INT); |
| 4 |
CREATE USER u1@h; |
| 5 |
# |
| 6 |
# Verify that u1 is added into mysql.user. |
| 7 |
# |
| 8 |
SELECT user FROM mysql.user where user='u1'; |
| 9 |
user |
| 10 |
u1 |
| 11 |
GRANT SELECT(a), SELECT(c) ON t1 TO u1@h; |
| 12 |
ERROR 42S22: Unknown column 'c' in 't1' |
| 13 |
# |
| 14 |
# The SELECT privilege on column a is not granted to u1@h, |
| 15 |
# which means that GRANT can not be failed partially when |
| 16 |
# granting an available privilege and a non-available |
| 17 |
# privilege to an existent user. |
| 18 |
# |
| 19 |
SELECT user, column_name, column_priv FROM mysql.columns_priv; |
| 20 |
user column_name column_priv |
| 21 |
# |
| 22 |
# Verify that the failed GRANT statement does not generate |
| 23 |
# a gtid and save the gtid into @@GLOBAL.GTID_EXECUTED. |
| 24 |
# |
| 25 |
include/assert.inc [Committed gtid MASTER_UUID:3 into @@GLOBAL.GTID_EXECUTED] |
| 26 |
# |
| 27 |
# Verify that the failed GRANT statement is not binlogged |
| 28 |
# |
| 29 |
include/show_binlog_events.inc |
| 30 |
GRANT SELECT(a) ON t1 TO u1@h; |
| 31 |
# |
| 32 |
# Verify that the grant info is added into mysql.columns_priv. |
| 33 |
# |
| 34 |
SELECT user, column_name, column_priv FROM mysql.columns_priv; |
| 35 |
user column_name column_priv |
| 36 |
u1 a Select |
| 37 |
REVOKE SELECT(a), SELECT(b) ON t1 FROM u1@h; |
| 38 |
ERROR 42000: There is no such grant defined for user 'u1' on host 'h' on table 't1' |
| 39 |
# |
| 40 |
# The SELECT privilege is removed on column a from user u1, |
| 41 |
# which means that REVOKE statement can be failed partially |
| 42 |
# when revoking multiple privileges from a user. |
| 43 |
# |
| 44 |
SELECT user, column_name, column_priv FROM mysql.columns_priv; |
| 45 |
user column_name column_priv |
| 46 |
u1 a Select |
| 47 |
# |
| 48 |
# Verify that the partially failed REVOKE statement does not generate |
| 49 |
# a gtid master_uuid:5 and save the gtid into @@GLOBAL.GTID_EXECUTED. |
| 50 |
# |
| 51 |
include/assert.inc [Committed gtid MASTER_UUID:4 into @@GLOBAL.GTID_EXECUTED] |
| 52 |
# |
| 53 |
# Verify that the partially failed REVOKE statement is not binlogged |
| 54 |
# |
| 55 |
include/show_binlog_events.inc |
| 56 |
DROP USER u1@h, u2@h; |
| 57 |
ERROR HY000: Operation DROP USER failed for 'u2'@'h' |
| 58 |
# |
| 59 |
# u1@h should not have been dropped. |
| 60 |
# |
| 61 |
SELECT user FROM mysql.user where user='u1'; |
| 62 |
user |
| 63 |
u1 |
| 64 |
# |
| 65 |
# Verify that the failed DROP USER statement does not generate |
| 66 |
# a gtid and save it into @@GLOBAL.GTID_EXECUTED. |
| 67 |
# |
| 68 |
include/assert.inc [Does not generate MASTER_UUID:5 and commit it into @@GLOBAL.GTID_EXECUTED] |
| 69 |
# |
| 70 |
# Verify failed DROP USER statement is not binlogged |
| 71 |
# |
| 72 |
include/show_binlog_events.inc |
| 73 |
RENAME TABLE t1 TO t2, t3 TO t4; |
| 74 |
ERROR 42S02: Table 'test.t3' doesn't exist |
| 75 |
# |
| 76 |
# The table t1 was not renamed, which means RENAME TABLE |
| 77 |
# can not be failed partially. |
| 78 |
# |
| 79 |
SHOW CREATE TABLE t1; |
| 80 |
Table Create Table |
| 81 |
t1 CREATE TABLE `t1` ( |
| 82 |
`a` int DEFAULT NULL, |
| 83 |
`b` int DEFAULT NULL |
| 84 |
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci |
| 85 |
# |
| 86 |
# Verify that the failed RENAME TABLE statement does not generate |
| 87 |
# a new GTID MASTER_UUID:7 and save it into @@GLOBAL.GTID_EXECUTED. |
| 88 |
# |
| 89 |
include/assert.inc [Does not generate MASTER_UUID:6 and commit it into @@GLOBAL.GTID_EXECUTED] |
| 90 |
# |
| 91 |
# Verify that the failed RENAME TABLE statement is not binlogged |
| 92 |
# |
| 93 |
include/show_binlog_events.inc |
| 94 |
# |
| 95 |
# The OPTIMIZE TABLE statement can be failed partially when optimizing |
| 96 |
# multiple tables, which contain a non-existent table. |
| 97 |
# |
| 98 |
OPTIMIZE TABLE t1, t_non_existent; |
| 99 |
Table Op Msg_type Msg_text |
| 100 |
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead |
| 101 |
test.t1 optimize status OK |
| 102 |
test.t_non_existent optimize Error Table 'test.t_non_existent' doesn't exist |
| 103 |
test.t_non_existent optimize status Operation failed |
| 104 |
# |
| 105 |
# When optimizing a non-existent table, verify that the OPTIMIZE TABLE |
| 106 |
# statement generates a gtid and save it into @@GLOBAL.GTID_EXECUTED. |
| 107 |
# |
| 108 |
include/assert.inc [Committed gtid MASTER_UUID:7 into @@GLOBAL.GTID_EXECUTED] |
| 109 |
# |
| 110 |
# When optimizing a non-existent table, verify that the OPTIMIZE TABLE |
| 111 |
# statement is binlogged. |
| 112 |
# |
| 113 |
include/show_binlog_events.inc |
| 114 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 115 |
binlog.000001 # Query # # use `test`; OPTIMIZE TABLE t1, t_non_existent |
| 116 |
# |
| 117 |
# The ANALYZE TABLE statement can be failed partially when analyzing |
| 118 |
# multiple tables, which contain a non-existent table. |
| 119 |
# |
| 120 |
ANALYZE TABLE t1, t_non_existent; |
| 121 |
Table Op Msg_type Msg_text |
| 122 |
test.t1 analyze status OK |
| 123 |
test.t_non_existent analyze Error Table 'test.t_non_existent' doesn't exist |
| 124 |
test.t_non_existent analyze status Operation failed |
| 125 |
# |
| 126 |
# When analyzing a non-existent table, verify that the ANALYZE TABLE |
| 127 |
# statement generates a gtid and save it into @@GLOBAL.GTID_EXECUTED. |
| 128 |
# |
| 129 |
include/assert.inc [Committed gtid MASTER_UUID:8 into @@GLOBAL.GTID_EXECUTED] |
| 130 |
# |
| 131 |
# When analyzing a non-existent table, verify that the ANALYZE TABLE |
| 132 |
# statement is binlogged. |
| 133 |
# |
| 134 |
include/show_binlog_events.inc |
| 135 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 136 |
binlog.000001 # Query # # use `test`; ANALYZE TABLE t1, t_non_existent |
| 137 |
# |
| 138 |
# The REPAIR TABLE statement can be failed partially when repairing |
| 139 |
# multiple tables, which contain a non-existent table. |
| 140 |
# |
| 141 |
REPAIR TABLE t1, t_non_existent; |
| 142 |
Table Op Msg_type Msg_text |
| 143 |
test.t1 repair note The storage engine for the table doesn't support repair |
| 144 |
test.t_non_existent repair Error Table 'test.t_non_existent' doesn't exist |
| 145 |
test.t_non_existent repair status Operation failed |
| 146 |
# |
| 147 |
# When repairing a non-existent table, verify that the REPAIR TABLE |
| 148 |
# statement generates a gtid and save it into @@GLOBAL.GTID_EXECUTED. |
| 149 |
# |
| 150 |
include/assert.inc [Committed gtid MASTER_UUID:9 into @@GLOBAL.GTID_EXECUTED] |
| 151 |
# |
| 152 |
# When repairing a non-existent table, verify that the REPAIR TABLE |
| 153 |
# statement is binlogged. |
| 154 |
# |
| 155 |
include/show_binlog_events.inc |
| 156 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 157 |
binlog.000001 # Query # # use `test`; REPAIR TABLE t1, t_non_existent |
| 158 |
# |
| 159 |
# The CHECKSUM TABLE statement can be failed partially when checksuming |
| 160 |
# multiple tables, which contain a non-existent table. |
| 161 |
# |
| 162 |
CHECKSUM TABLE t1, t_non_existent; |
| 163 |
Table Checksum |
| 164 |
test.t1 0 |
| 165 |
test.t_non_existent NULL |
| 166 |
Warnings: |
| 167 |
Error 1146 Table 'test.t_non_existent' doesn't exist |
| 168 |
# |
| 169 |
# When checksuming a non-existent table, verify that the CHECKSUM TABLE |
| 170 |
# statement generates a gtid and save it into @@GLOBAL.GTID_EXECUTED. |
| 171 |
# |
| 172 |
include/assert.inc [Does not generate MASTER_UUID:10 and commit it into @@GLOBAL.GTID_EXECUTED] |
| 173 |
# |
| 174 |
# When checksuming a non-existent table, verify that the CHECKSUM TABLE |
| 175 |
# statement is not binlogged. |
| 176 |
# |
| 177 |
include/show_binlog_events.inc |
| 178 |
DROP TABLE t1; |
| 179 |
DROP USER u1@h; |