1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
|
RESET MASTER;
SET SESSION GTID_NEXT='MASTER_UUID:1';
CREATE TABLE t1 (a int) ENGINE=MyISAM;
SET SESSION GTID_NEXT='MASTER_UUID:2';
CREATE TABLE t5 (a int) ENGINE=InnoDB;
SET SESSION GTID_NEXT='MASTER_UUID:3';
#
# Original test case.
#
# The below DROP TABLE has partially failed before WL#7743.
# Now if fails without side-effects and thus should not consume gitd.
#
DROP TABLE t1, t3;
ERROR 42S02: Unknown table 'test.t3'
#
# The table t1 was not dropped.
#
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
#
# Verify that the above DROP TABLE statement has not consumed gtid.
#
include/assert.inc [Committed gtid MASTER_UUID:2 into @@GLOBAL.GTID_EXECUTED]
SET SESSION GTID_NEXT='AUTOMATIC';
FLUSH LOGS;
include/assert.inc [Saved gtid MASTER_UUID:2 into mysql.gtid_executed table]
#
# Now we simulate error after dropping MyISAM table. In this case
# DROP TABLE is partially executed/failed and should consume gtid.
#
SET @@debug="+d,rm_table_no_locks_abort_before_atomic_tables";
SET SESSION GTID_NEXT='MASTER_UUID:3';
DROP TABLE t1, t5;
ERROR HY000: Unknown error
SET @@debug="-d,rm_table_no_locks_abort_before_atomic_tables";
#
# The above DROP TABLE should have deleted t1.
#
SHOW CREATE TABLE t1;
ERROR 42S02: Table 'test.t1' doesn't exist
#
# Verify that the partially failed DROP TABLE statement can consume
# its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did when
# binlog is enabled.
#
include/assert.inc [Committed gtid MASTER_UUID:2 into @@GLOBAL.GTID_EXECUTED]
SET SESSION GTID_NEXT='AUTOMATIC';
FLUSH LOGS;
include/assert.inc [Saved gtid MASTER_UUID:2 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:4';
CREATE TEMPORARY TABLE tmp1 (a int);
SET SESSION GTID_NEXT='MASTER_UUID:5';
#
# The below DROP TEMPORARY TABLE has partially failed before WL#7743.
# Now if fails without side-effects and thus should not consume gitd.
#
# There is no way for DROP TEMPORARY TABLE to partially fail now,
# so unlike for DROP TABLE, there is no way to test scenario with
# partial failure for it.
DROP TEMPORARY TABLE tmp1, t2;
ERROR 42S02: Unknown table 'test.t2'
#
# Verify that failed DROP TEMPORARY TABLE statement has not
# consumed its gtid.
#
include/assert.inc [Committed gtid MASTER_UUID:4 into @@GLOBAL.GTID_EXECUTED]
SET SESSION GTID_NEXT='AUTOMATIC';
FLUSH LOGS;
include/assert.inc [Saved gtid MASTER_UUID:4 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:5';
CREATE TABLE t1(a INT, b INT);
SET SESSION GTID_NEXT='MASTER_UUID:6';
CREATE USER u1@h;
#
# Verify that u1 is added into mysql.user.
#
SELECT user FROM mysql.user where user='u1';
user
u1
SET SESSION GTID_NEXT='MASTER_UUID:7';
GRANT SELECT(a), SELECT(c) ON t1 TO u1@h;
ERROR 42S22: Unknown column 'c' in 't1'
#
# The SELECT privilege on column a is not granted to u1@h,
# which means that GRANT can not be failed partially when
# granting an available privilege and a non-available
# privilege to an existent user.
#
SELECT user, column_name, column_priv FROM mysql.columns_priv;
user column_name column_priv
#
# Verify that the failed GRANT statement does not save
# the specified gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table.
#
include/assert.inc [Did not commit gtid MASTER_UUID:7 into @@GLOBAL.GTID_EXECUTED]
SET SESSION GTID_NEXT='AUTOMATIC';
FLUSH LOGS;
include/assert.inc [Did not save gtid MASTER_UUID:7 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:7';
GRANT SELECT(a) ON t1 TO u1@h, u2@h;
ERROR 42000: You are not allowed to create a user with GRANT
#
# The SELECT privilege on column a is not granted to u1@h,
# which means that GRANT can not fail partially when
# granting an available privilege to both an existent
# user and a non-existent user.
#
SELECT user, column_name, column_priv FROM mysql.columns_priv;
user column_name column_priv
#
# Verify that the failed GRANT statement does not save
# the specified gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table.
#
include/assert.inc [Did not commit gtid MASTER_UUID:7 into @@GLOBAL.GTID_EXECUTED]
SET SESSION GTID_NEXT='AUTOMATIC';
FLUSH LOGS;
include/assert.inc [Did not save gtid MASTER_UUID:7 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:7';
REVOKE SELECT(a), SELECT(b) ON t1 FROM u1@h;
ERROR 42000: There is no such grant defined for user 'u1' on host 'h' on table 't1'
#
# The SELECT privilege is not removed on column a from user u1,
# which means that REVOKE statement can not fail partially
# when revoking multiple privileges from a user.
#
SELECT user, column_name, column_priv FROM mysql.columns_priv;
user column_name column_priv
#
# Verify that the failed REVOKE statement does not save
# the specified gtid into @@GLOBAL.GTID_EXECUTED and
# and mysql.gtid_executed table.
#
include/assert.inc [Did not commit gtid MASTER_UUID:7 into @@GLOBAL.GTID_EXECUTED]
SET SESSION GTID_NEXT='AUTOMATIC';
FLUSH LOGS;
include/assert.inc [Did not save gtid MASTER_UUID:7 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:7';
DROP USER u1@h, u2@h;
ERROR HY000: Operation DROP USER failed for 'u2'@'h'
#
# The u1 is not removed from mysql.user which means that DROP USER
# can not fail partially.
#
SELECT user FROM mysql.user where user='u1';
user
u1
#
# Verify that the failed DROP USER statement does not consume
# its gtid and save the gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table.
#
include/assert.inc [Did not commit gtid MASTER_UUID:7 into @@GLOBAL.GTID_EXECUTED]
SET SESSION GTID_NEXT='AUTOMATIC';
FLUSH LOGS;
include/assert.inc [Did not save gtid MASTER_UUID:7 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:7';
RENAME TABLE t1 TO t2, t3 TO t4;
ERROR 42S02: Table 'test.t3' doesn't exist
#
# The table t1 was not renamed, which means RENAME TABLE
# can not be failed partially.
#
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int DEFAULT NULL,
`b` int DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
#
# Verify that the failed RENAME TABLE statement does not save
# the specified gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did
# when binlog is enabled.
#
include/assert.inc [Did not commit gtid MASTER_UUID:7 into @@GLOBAL.GTID_EXECUTED]
SET SESSION GTID_NEXT='AUTOMATIC';
FLUSH LOGS;
include/assert.inc [Did not save gtid MASTER_UUID:7 into mysql.gtid_executed table]
#
# The OPTIMIZE TABLE statement can be failed partially when optimizing
# multiple tables, which contain a non-existent table.
#
SET SESSION GTID_NEXT='MASTER_UUID:7';
OPTIMIZE TABLE t1, t_non_existent;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
test.t_non_existent optimize Error Table 'test.t_non_existent' doesn't exist
test.t_non_existent optimize status Operation failed
#
# When optimizing a non-existent table, verify that the OPTIMIZE TABLE
# statement saves its specified gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did
# when binlog is enabled.
#
include/assert.inc [Committed gtid MASTER_UUID:7 into @@GLOBAL.GTID_EXECUTED]
SET SESSION GTID_NEXT='AUTOMATIC';
FLUSH LOGS;
include/assert.inc [Saved gtid MASTER_UUID:7 into mysql.gtid_executed table]
#
# The ANALYZE TABLE statement can be failed partially when analyzingu
# multiple tables, which contain a non-existent table.
#
SET SESSION GTID_NEXT='MASTER_UUID:8';
ANALYZE TABLE t1, t_non_existent;
Table Op Msg_type Msg_text
test.t1 analyze status Table is already up to date
test.t_non_existent analyze Error Table 'test.t_non_existent' doesn't exist
test.t_non_existent analyze status Operation failed
#
# When analyzing a non-existent table, verify that the ANALYZE TABLE
# statement saves its specified gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did
# when binlog is enabled.
#
include/assert.inc [Committed gtid MASTER_UUID:8 into @@GLOBAL.GTID_EXECUTED]
SET SESSION GTID_NEXT='AUTOMATIC';
FLUSH LOGS;
include/assert.inc [Saved gtid MASTER_UUID:8 into mysql.gtid_executed table]
#
# The REPAIR TABLE statement can be failed partially when repairing
# multiple tables, which contain a non-existent table.
#
SET SESSION GTID_NEXT='MASTER_UUID:9';
REPAIR TABLE t1, t_non_existent;
Table Op Msg_type Msg_text
test.t1 repair status OK
test.t_non_existent repair Error Table 'test.t_non_existent' doesn't exist
test.t_non_existent repair status Operation failed
#
# When repairing a non-existent table, verify that the REPAIR TABLE
# statement saves its specified gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table when binlog is disabled as it did
# when binlog is enabled.
#
include/assert.inc [Committed gtid MASTER_UUID:9 into @@GLOBAL.GTID_EXECUTED]
SET SESSION GTID_NEXT='AUTOMATIC';
FLUSH LOGS;
include/assert.inc [Saved gtid MASTER_UUID:9 into mysql.gtid_executed table]
#
# The CHECKSUM TABLE statement can be failed partially when checksuming
# multiple tables, which contain a non-existent table.
#
SET SESSION GTID_NEXT='MASTER_UUID:10';
CHECKSUM TABLE t1, t_non_existent;
Table Checksum
test.t1 0
test.t_non_existent NULL
Warnings:
Error 1146 Table 'test.t_non_existent' doesn't exist
#
# When checksuming a non-existent table, verify that the CHECKSUM TABLE
# statement does not save its specified gtid into @@GLOBAL.GTID_EXECUTED
# and mysql.gtid_executed table when binlog is disabled as it did
# when binlog is enabled.
#
include/assert.inc [Did not commit gtid MASTER_UUID:10 into @@GLOBAL.GTID_EXECUTED]
SET SESSION GTID_NEXT='AUTOMATIC';
FLUSH LOGS;
include/assert.inc [Did not save gtid MASTER_UUID:10 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:11';
RENAME USER u1@h TO u11@h, u3@h TO u33@h;
ERROR HY000: Operation RENAME USER failed for 'u3'@'h'
#
# The u1 is not renamed on mysql.user which means that RENAME USER
# cannot be failed partially.
#
SELECT user FROM mysql.user where user='u1';
user
u1
#
# Verify that the failed RENAME USER statement does not save
# the specified gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table.
#
include/assert.inc [Did not commit gtid MASTER_UUID:11 into @@GLOBAL.GTID_EXECUTED]
SET SESSION GTID_NEXT='AUTOMATIC';
FLUSH LOGS;
include/assert.inc [Did not save gtid MASTER_UUID:11 and :12 into mysql.gtid_executed table]
SELECT password_expired FROM mysql.user where user='u1';
password_expired
N
SET SESSION GTID_NEXT='MASTER_UUID:13';
ALTER USER u1@h, u3@h PASSWORD EXPIRE;
ERROR HY000: Operation ALTER USER failed for 'u3'@'h'
#
# The u1 is not altered on mysql.user which means that ALTER USER
# cannot be failed partially.
#
SELECT password_expired FROM mysql.user where user='u1';
password_expired
N
#
# Verify that the failed ALTER USER statement does not save
# the specified gtid into @@GLOBAL.GTID_EXECUTED and
# mysql.gtid_executed table.
#
include/assert.inc [Did not commit gtid MASTER_UUID:13 into @@GLOBAL.GTID_EXECUTED]
SET SESSION GTID_NEXT='AUTOMATIC';
FLUSH LOGS;
include/assert.inc [Did not save gtid MASTER_UUID:13 into mysql.gtid_executed table]
SET SESSION GTID_NEXT='MASTER_UUID:14';
DROP TABLE t1;
SET SESSION GTID_NEXT='MASTER_UUID:15';
DROP TABLE t5;
SET SESSION GTID_NEXT='MASTER_UUID:16';
DROP USER u1@h;
|