| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Execute all known scenarios/corner cases where a GTID is generated |
| 4 |
# despite super_read_only=1. It is normally expected that |
| 5 |
# super_read_only=1 prevents the execution of all statements, but |
| 6 |
# there are some exceptions. |
| 7 |
# |
| 8 |
# Also execute some scenarios where no GTID is generated, but which |
| 9 |
# are considered 'suspicious', either because they are similar to |
| 10 |
# scenarios where a GTID is generated, or because the server code |
| 11 |
# writes the binary log in a special way, or takes other unusual code |
| 12 |
# paths related to GTID generation. |
| 13 |
# |
| 14 |
# === Implementation ==== |
| 15 |
# |
| 16 |
# Configure replication. |
| 17 |
# |
| 18 |
# 1. Run START REPLICA and replicate from some server. |
| 19 |
# 2. Restart a replica while there is any MEMORY table defined. |
| 20 |
# 3. Restart a replica server while slave_open_temp_tables > 0 |
| 21 |
# (requires statement-based replication on the source). |
| 22 |
#(3b).When replica has open temp tables and we restart the |
| 23 |
# source server and reconnect replica. Replica generate extra |
| 24 |
# DROP TEMPORARY TABLE statements in this case |
| 25 |
# 4. Using statement-based replication, create a temporary table |
| 26 |
# while not in super_read_only mode, and then disconnect while in |
| 27 |
# super_read_only mode. |
| 28 |
# 5. ALTER INSTANCE (check all syntax variants, since there is |
| 29 |
# variation in their implementation). |
| 30 |
# 6. FLUSH statements (check all syntax variants, since there is |
| 31 |
# variation in their implementation). |
| 32 |
#(6b).FLUSH STATEMENTS UNDER NO_WRITE_TO_BINLOG AND CHECK GTID EXCECUTED |
| 33 |
# 7. SET gtid_purged. |
| 34 |
# 8. SET gtid_next to a GTID, and then execute any of: |
| 35 |
# #CREATE TABLE |
| 36 |
# #COMMIT |
| 37 |
# #XA START |
| 38 |
# #SET autocommit = 1 |
| 39 |
# #SET autocommit = 0 |
| 40 |
# #START TRANSACTION READ_ONLY; COMMIT; |
| 41 |
# 9. The unusual DDL statements |
| 42 |
# 10. [UN]INSTALL [PLUGIN | COMPONENT] |
| 43 |
# 11. [OPTIMIZE | ANALYZE | REPAIR] TABLE |
| 44 |
# 12. ALTER TABLE ... [OPTIMIZE | ANALYZE | REPAIR] PARTITION. |
| 45 |
# 13. Run GRANT, REVOKE, CREATE USER, DROP USER in a way that it fails, e.g., create two users where the second already exists. |
| 46 |
# 14. Run DML on the tables gtid_executed, slave_master_info, |
| 47 |
# slave_relay_log_info, and slave_worker_info. |
| 48 |
# 15. Cleanup |
| 49 |
# |
| 50 |
# === References === |
| 51 |
# |
| 52 |
# Bug #33001701 : VERIFY STATEMENTS THAT GENERATE GTID IF THE SERVER IS IN SUPER_READ_ONLY MODE |
| 53 |
# |
| 54 |
|
| 55 |
--let $rpl_gtid_utils = 1 |
| 56 |
--let $rpl_skip_start_slave = 1 |
| 57 |
--source include/master-slave.inc |
| 58 |
|
| 59 |
# Supression is needed as we alter InnoDB relaylog in the test. |
| 60 |
let $messages = |
| 61 |
.*InnoDB redo logging is disabled.* All data could be lost in case of a server crash.* |
| 62 |
; |
| 63 |
--source include/suppress_messages.inc |
| 64 |
#call mtr.add_suppression("InnoDB redo logging is disabled. All data could be lost in case of a server crash."); |
| 65 |
|
| 66 |
######################################################################## |
| 67 |
--echo #### 1. Run START REPLICA and replicate from some server. |
| 68 |
######################################################################## |
| 69 |
--source include/rpl_connection_slave.inc |
| 70 |
SET GLOBAL SUPER_READ_ONLY = ON; |
| 71 |
--source include/start_slave.inc |
| 72 |
--let server_2_uuid = `SELECT @@GLOBAL.SERVER_UUID` |
| 73 |
|
| 74 |
--source include/rpl_connection_master.inc |
| 75 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 76 |
--source include/sync_slave_sql_with_master.inc |
| 77 |
|
| 78 |
--let $gtid_step_uuid = $server_2_uuid |
| 79 |
--let $gtid_step_only_count = 1 |
| 80 |
--let $gtid_step_count = 1 |
| 81 |
--source include/gtid_step_assert.inc |
| 82 |
|
| 83 |
--let $gtid_step_count = 0 |
| 84 |
--let $gtid_step_only_count = 0 |
| 85 |
|
| 86 |
######################################################################## |
| 87 |
--echo #### 2. Restart a replica while there is any MEMORY table defined. |
| 88 |
######################################################################## |
| 89 |
--source include/rpl_connection_slave.inc |
| 90 |
--source include/gtid_step_reset.inc |
| 91 |
|
| 92 |
--source include/rpl_connection_master.inc |
| 93 |
--source include/gtid_step_reset.inc |
| 94 |
|
| 95 |
CREATE TABLE m1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=Memory; |
| 96 |
--source include/sync_slave_sql_with_master.inc |
| 97 |
|
| 98 |
#Assert that data is replicated correctly |
| 99 |
--let $assert_text = Table m1 must exists |
| 100 |
--let $assert_cond = [ SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = "test" AND TABLE_NAME = "m1"] = 1 |
| 101 |
--source include/assert.inc |
| 102 |
--source include/stop_slave.inc |
| 103 |
|
| 104 |
--source include/rpl_connection_slave.inc |
| 105 |
--source include/start_slave.inc |
| 106 |
|
| 107 |
# Checking gtid count after create statement |
| 108 |
--source include/rpl_connection_slave.inc |
| 109 |
--let $gtid_step_count = 1 |
| 110 |
--let $gtid_step_only_count = 1 |
| 111 |
--source include/gtid_step_assert.inc |
| 112 |
|
| 113 |
--source include/rpl_restart_server.inc |
| 114 |
--source include/start_slave.inc |
| 115 |
--source include/rpl_connection_master.inc |
| 116 |
|
| 117 |
# Verifies that read-only queries on m1 do not generate a TRUNCATE statement. |
| 118 |
SELECT COUNT(*) FROM m1; |
| 119 |
--let $gtid_step_count = 0 |
| 120 |
--source include/gtid_step_assert.inc |
| 121 |
|
| 122 |
INSERT INTO m1 values(1); |
| 123 |
--source include/sync_slave_sql_with_master.inc |
| 124 |
|
| 125 |
# After operation on memory table replica generats a TRUNCATE TABLE statement when replicating into the memory table. |
| 126 |
--let $gtid_step_count = 2 |
| 127 |
--let $gtid_step_only_count = 1 |
| 128 |
--source include/gtid_step_assert.inc |
| 129 |
--let $gtid_step_count = 0 |
| 130 |
--let $gtid_step_only_count = 0 |
| 131 |
|
| 132 |
######################################################################## |
| 133 |
--echo #### 3. Restart a replica server while replica_open_temp_tables > 0 |
| 134 |
######################################################################## |
| 135 |
--source include/rpl_connection_slave.inc |
| 136 |
--source include/stop_slave.inc |
| 137 |
SET @@global.binlog_format = STATEMENT; |
| 138 |
--source include/start_slave.inc |
| 139 |
|
| 140 |
--source include/rpl_connection_master.inc |
| 141 |
SET SESSION BINLOG_FORMAT = STATEMENT; |
| 142 |
CREATE TEMPORARY TABLE t2(i INT); |
| 143 |
--source include/sync_slave_sql_with_master.inc |
| 144 |
|
| 145 |
--source include/rpl_connection_slave.inc |
| 146 |
--source include/gtid_step_reset.inc |
| 147 |
|
| 148 |
--let $var_value = query_get_value(SHOW STATUS LIKE 'Replica_open_temp_tables', Value, 1) |
| 149 |
--let $assert_text = Replica_open_temp_tables shall be 1 |
| 150 |
--let $assert_cond = $var_value = 1 |
| 151 |
--source include/assert.inc |
| 152 |
|
| 153 |
--source include/stop_slave.inc |
| 154 |
|
| 155 |
--source include/rpl_connection_slave.inc |
| 156 |
--source include/start_slave.inc |
| 157 |
|
| 158 |
# Checking GTID of source and replica. No change in GTID |
| 159 |
--source include/rpl_connection_slave.inc |
| 160 |
--let $gtid_step_count = 0 |
| 161 |
--source include/gtid_step_assert.inc |
| 162 |
|
| 163 |
# Restart replica and checking GTID has not changed |
| 164 |
--let $rpl_server_number = 2 |
| 165 |
--let $rpl_start_with_gtids = 1 |
| 166 |
-- source include/rpl_restart_server.inc |
| 167 |
--source include/gtid_step_reset.inc |
| 168 |
--source include/start_slave.inc |
| 169 |
|
| 170 |
--source include/rpl_connection_slave.inc |
| 171 |
|
| 172 |
--let $var_value = query_get_value(SHOW STATUS LIKE 'Replica_open_temp_tables', Value, 1) |
| 173 |
--let $assert_text = Replica_open_temp_tables shall be 0 |
| 174 |
--let $assert_cond = $var_value = 0 |
| 175 |
--source include/assert.inc |
| 176 |
|
| 177 |
--let $gtid_step_count = 0 |
| 178 |
--source include/gtid_step_assert.inc |
| 179 |
|
| 180 |
# ######################################################################## |
| 181 |
--echo #### 3 (b). when replica has open temp tables and we restart the |
| 182 |
--echo #### source server and reconnect replica. Replica generate extra |
| 183 |
--echo #### DROP TEMPORARY TABLE statements in this case |
| 184 |
# ######################################################################## |
| 185 |
--source include/rpl_connection_slave.inc |
| 186 |
--source include/stop_slave.inc |
| 187 |
SET @@global.binlog_format = STATEMENT; |
| 188 |
--source include/start_slave.inc |
| 189 |
|
| 190 |
--source include/rpl_connection_master.inc |
| 191 |
CREATE TEMPORARY TABLE t3(i INT); |
| 192 |
--source include/sync_slave_sql_with_master.inc |
| 193 |
--source include/save_binlog_position.inc |
| 194 |
|
| 195 |
# Stop receiver thread before restarting source server. The GTID |
| 196 |
# generation does not depend on doing this, but it makes the replica |
| 197 |
# more deterministic; we are sure that there will be no errors in the |
| 198 |
# receiver thread, which makes it easier to code the test in a |
| 199 |
# deterministic way. We start the thread again once the replica server |
| 200 |
# has started. |
| 201 |
--source include/rpl_connection_slave.inc |
| 202 |
--source include/stop_slave_io.inc |
| 203 |
|
| 204 |
--let $rpl_server_number = 1 |
| 205 |
--let $rpl_force_stop = 1 |
| 206 |
--source include/rpl_restart_server.inc |
| 207 |
|
| 208 |
--source include/rpl_connection_slave.inc |
| 209 |
|
| 210 |
--source include/gtid_step_reset.inc |
| 211 |
--source include/start_slave.inc |
| 212 |
|
| 213 |
# Usually, when using gtid_mode=on, sync_slave_sql_with_master.inc |
| 214 |
# will just wait for the replica's gtid_executed to become equal to |
| 215 |
# the source's gtid_executed. But here, we need replica to apply the |
| 216 |
# Format_description_log_event, since the replica executes the DROP |
| 217 |
# while applying that. Format_description_log_event doesn't have a |
| 218 |
# GTID, and the replica's gtid_executed is already equal to the |
| 219 |
# source's gtid_executed, so if we would merely invoke |
| 220 |
# sync_slave_sql_with_master.inc, it may return before the replica has |
| 221 |
# applied the Format_description_log_event. To be sure that the |
| 222 |
# replica has executed the Format_description_log_event, we create a |
| 223 |
# new transaction, which will appear in the binary log after the |
| 224 |
# Format_description_log_event, and wait for the replica to apply that |
| 225 |
# too. Actually we create two transactions; one CREATE and one DROP, |
| 226 |
# in order to clean up after ourselves. |
| 227 |
--source include/rpl_connection_master.inc |
| 228 |
CREATE TABLE aux_table_to_sync (a INT); |
| 229 |
DROP TABLE aux_table_to_sync; |
| 230 |
--source include/sync_slave_sql_with_master.inc |
| 231 |
|
| 232 |
--source include/rpl_connection_slave.inc |
| 233 |
--let event_sequence = Gtid # Query/.*DROP.*t3.* # Gtid # Query/.*CREATE.*aux.* # Gtid # Query/.*DROP.*aux.* |
| 234 |
--source include/assert_binlog_events.inc |
| 235 |
|
| 236 |
# We expect 3 GTIDs: one for the DROP, one for CREATE TABLE, and one |
| 237 |
# for DROP TABLE. |
| 238 |
--let $gtid_step_only_count = 1 |
| 239 |
--let $gtid_step_count = 3 |
| 240 |
--source include/gtid_step_assert.inc |
| 241 |
|
| 242 |
--source include/rpl_connection_master.inc |
| 243 |
|
| 244 |
--let $gtid_step_only_count = 0 |
| 245 |
|
| 246 |
# ######################################################################## |
| 247 |
--echo #### 4. Using statement-based replication, create a temporary table |
| 248 |
--echo #### while not in super_read_only mode, and then disconnect while |
| 249 |
--echo #### in super_read_only mode. |
| 250 |
# ######################################################################## |
| 251 |
# Create temporary table on a new connection. |
| 252 |
--connect (con1, 127.0.0.1, root, , , $SLAVE_MYPORT,) |
| 253 |
--connection con1 |
| 254 |
SET @@global.super_read_only = 0; |
| 255 |
SET @@session.binlog_format = STATEMENT; |
| 256 |
CREATE TEMPORARY TABLE t1 (a INT); |
| 257 |
|
| 258 |
# Remember gtid_executed and binlog position. |
| 259 |
--source include/gtid_step_reset.inc |
| 260 |
--source include/save_binlog_position.inc |
| 261 |
|
| 262 |
# Enable super_read_only and disconnect |
| 263 |
SET @@global.super_read_only = 1; |
| 264 |
--disconnect con1 |
| 265 |
--source include/wait_until_disconnected.inc |
| 266 |
|
| 267 |
# Wait for the disconnected session to log DROP |
| 268 |
--source include/rpl_connection_slave.inc |
| 269 |
--let $wait_for_binlog_events = 1 |
| 270 |
--let $event_sequence = Gtid # Query(.*DROP.*) |
| 271 |
--source include/assert_binlog_events.inc |
| 272 |
--let $wait_for_binlog_events = 0 |
| 273 |
|
| 274 |
# Assert that one GTID was generated. |
| 275 |
--let $gtid_step_count = 1 |
| 276 |
--source include/gtid_step_assert.inc |
| 277 |
|
| 278 |
--let $gtid_step_count = 0 |
| 279 |
|
| 280 |
######################################################################## |
| 281 |
--echo #### 5. ALTER INSTANCE AND CHECK GTID_EXCECUTED |
| 282 |
######################################################################## |
| 283 |
--source include/rpl_connection_slave.inc |
| 284 |
SET GLOBAL SUPER_READ_ONLY = ON; |
| 285 |
--source include/gtid_step_reset.inc |
| 286 |
|
| 287 |
--disable_query_log |
| 288 |
SET @@global.binlog_encryption = ON; |
| 289 |
--enable_query_log |
| 290 |
|
| 291 |
ALTER INSTANCE ENABLE INNODB REDO_LOG; |
| 292 |
ALTER INSTANCE DISABLE INNODB REDO_LOG; |
| 293 |
|
| 294 |
--disable_warnings |
| 295 |
ALTER INSTANCE ROTATE BINLOG MASTER KEY; |
| 296 |
--enable_warnings |
| 297 |
ALTER INSTANCE RELOAD TLS; |
| 298 |
|
| 299 |
# Assert that no GTID was executed. |
| 300 |
--let $gtid_step_count = 0 |
| 301 |
--source include/gtid_step_assert.inc |
| 302 |
|
| 303 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 304 |
ALTER INSTANCE ROTATE INNODB MASTER KEY; |
| 305 |
|
| 306 |
######################################################################## |
| 307 |
--echo #### 6(a) FLUSH STATEMENTS AND CHECK GTID EXCECUTED |
| 308 |
######################################################################## |
| 309 |
--source include/rpl_connection_slave.inc |
| 310 |
FLUSH LOGS; |
| 311 |
--let $gtid_step_count = 0 |
| 312 |
--source include/gtid_step_assert.inc |
| 313 |
|
| 314 |
FLUSH BINARY LOGS; |
| 315 |
--let $gtid_step_count = 0 |
| 316 |
--source include/gtid_step_assert.inc |
| 317 |
|
| 318 |
FLUSH TABLES; |
| 319 |
--let $gtid_step_count = 1 |
| 320 |
--source include/gtid_step_assert.inc |
| 321 |
|
| 322 |
FLUSH TABLES t1; |
| 323 |
--let $gtid_step_count = 1 |
| 324 |
--source include/gtid_step_assert.inc |
| 325 |
|
| 326 |
FLUSH ENGINE LOGS; |
| 327 |
--let $gtid_step_count = 1 |
| 328 |
--source include/gtid_step_assert.inc |
| 329 |
|
| 330 |
FLUSH ERROR LOGS; |
| 331 |
--let $gtid_step_count = 1 |
| 332 |
--source include/gtid_step_assert.inc |
| 333 |
|
| 334 |
FLUSH GENERAL LOGS; |
| 335 |
--let $gtid_step_count = 1 |
| 336 |
--source include/gtid_step_assert.inc |
| 337 |
|
| 338 |
FLUSH HOSTS; |
| 339 |
--let $gtid_step_count = 1 |
| 340 |
--source include/gtid_step_assert.inc |
| 341 |
|
| 342 |
FLUSH PRIVILEGES; |
| 343 |
--let $gtid_step_count = 1 |
| 344 |
--source include/gtid_step_assert.inc |
| 345 |
|
| 346 |
FLUSH OPTIMIZER_COSTS; |
| 347 |
--let $gtid_step_count = 1 |
| 348 |
--source include/gtid_step_assert.inc |
| 349 |
|
| 350 |
FLUSH RELAY LOGS; |
| 351 |
--let $gtid_step_count = 1 |
| 352 |
--source include/gtid_step_assert.inc |
| 353 |
|
| 354 |
FLUSH SLOW LOGS; |
| 355 |
--let $gtid_step_count = 1 |
| 356 |
--source include/gtid_step_assert.inc |
| 357 |
|
| 358 |
FLUSH STATUS; |
| 359 |
--let $gtid_step_count = 1 |
| 360 |
--source include/gtid_step_assert.inc |
| 361 |
|
| 362 |
FLUSH USER_RESOURCES; |
| 363 |
--let $gtid_step_count = 1 |
| 364 |
--source include/gtid_step_assert.inc |
| 365 |
|
| 366 |
--let $gtid_step_count = 0 |
| 367 |
######################################################################## |
| 368 |
--echo #### 6(b) FLUSH STATEMENTS UNDER NO_WRITE_TO_BINLOG AND CHECK GTID EXCECUTED |
| 369 |
######################################################################## |
| 370 |
|
| 371 |
--source include/rpl_connection_slave.inc |
| 372 |
--source include/gtid_step_reset.inc |
| 373 |
|
| 374 |
FLUSH LOCAL ENGINE LOGS; |
| 375 |
--let $gtid_step_count = 0 |
| 376 |
--source include/gtid_step_assert.inc |
| 377 |
|
| 378 |
FLUSH NO_WRITE_TO_BINLOG ERROR LOGS; |
| 379 |
--let $gtid_step_count = 0 |
| 380 |
--source include/gtid_step_assert.inc |
| 381 |
|
| 382 |
FLUSH NO_WRITE_TO_BINLOG GENERAL LOGS; |
| 383 |
--let $gtid_step_count = 0 |
| 384 |
--source include/gtid_step_assert.inc |
| 385 |
|
| 386 |
FLUSH NO_WRITE_TO_BINLOG HOSTS; |
| 387 |
--let $gtid_step_count = 0 |
| 388 |
--source include/gtid_step_assert.inc |
| 389 |
|
| 390 |
FLUSH NO_WRITE_TO_BINLOG LOGS; |
| 391 |
--let $gtid_step_count = 0 |
| 392 |
--source include/gtid_step_assert.inc |
| 393 |
|
| 394 |
FLUSH NO_WRITE_TO_BINLOG PRIVILEGES; |
| 395 |
--let $gtid_step_count = 0 |
| 396 |
--source include/gtid_step_assert.inc |
| 397 |
|
| 398 |
FLUSH NO_WRITE_TO_BINLOG OPTIMIZER_COSTS; |
| 399 |
--let $gtid_step_count = 0 |
| 400 |
--source include/gtid_step_assert.inc |
| 401 |
|
| 402 |
FLUSH NO_WRITE_TO_BINLOG RELAY LOGS; |
| 403 |
--let $gtid_step_count = 0 |
| 404 |
--source include/gtid_step_assert.inc |
| 405 |
|
| 406 |
FLUSH NO_WRITE_TO_BINLOG SLOW LOGS; |
| 407 |
--let $gtid_step_count = 0 |
| 408 |
--source include/gtid_step_assert.inc |
| 409 |
|
| 410 |
FLUSH NO_WRITE_TO_BINLOG STATUS; |
| 411 |
--let $gtid_step_count = 0 |
| 412 |
--source include/gtid_step_assert.inc |
| 413 |
|
| 414 |
FLUSH NO_WRITE_TO_BINLOG USER_RESOURCES; |
| 415 |
--let $gtid_step_count = 0 |
| 416 |
--source include/gtid_step_assert.inc |
| 417 |
|
| 418 |
FLUSH NO_WRITE_TO_BINLOG TABLES; |
| 419 |
--let $gtid_step_count = 0 |
| 420 |
--source include/gtid_step_assert.inc |
| 421 |
|
| 422 |
FLUSH NO_WRITE_TO_BINLOG TABLES t1; |
| 423 |
--let $gtid_step_count = 0 |
| 424 |
--source include/gtid_step_assert.inc |
| 425 |
|
| 426 |
FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS; |
| 427 |
--let $gtid_step_count = 0 |
| 428 |
--source include/gtid_step_assert.inc |
| 429 |
|
| 430 |
FLUSH NO_WRITE_TO_BINLOG BINARY LOGS; |
| 431 |
--let $gtid_step_count = 0 |
| 432 |
--source include/gtid_step_assert.inc |
| 433 |
|
| 434 |
######################################################################## |
| 435 |
--echo #### 7. SET gtid_purged. |
| 436 |
######################################################################## |
| 437 |
--source include/rpl_connection_slave.inc |
| 438 |
|
| 439 |
SET @@GLOBAL.GTID_PURGED = '00000000-0000-0000-0000-000000000000:1-1000000000000000000'; |
| 440 |
|
| 441 |
--let $assert_text = Assert the GTID_PURGED value |
| 442 |
--let $assert_cond = "[SELECT @@GLOBAL.GTID_PURGED]" = "00000000-0000-0000-0000-000000000000:1-1000000000000000000" |
| 443 |
--source include/assert.inc |
| 444 |
|
| 445 |
######################################################################## |
| 446 |
--echo #### 8. SET gtid_next to a GTID, and then execute any of: |
| 447 |
--echo #### COMMIT |
| 448 |
--echo #### XA START |
| 449 |
--echo #### SET autocommit = 1 |
| 450 |
--echo #### SET autocommit = 0 |
| 451 |
--echo #### START TRANSACTION READ_ONLY; COMMIT; |
| 452 |
######################################################################## |
| 453 |
# Due to BUG#33599946, the connection is in an inconsistent state after this transaction. |
| 454 |
# We cannot continue executing tests on it. Hence, using a different connection just |
| 455 |
# for this transaction. |
| 456 |
|
| 457 |
--connect (conn, localhost, root,) |
| 458 |
--source include/gtid_step_reset.inc |
| 459 |
|
| 460 |
eval SET GTID_NEXT = '$uuida:1'; |
| 461 |
XA START 'xa1'; |
| 462 |
XA END 'xa1'; |
| 463 |
XA PREPARE 'xa1'; |
| 464 |
SET GTID_NEXT = 'AUTOMATIC'; |
| 465 |
|
| 466 |
--let $gtid_step_only_count = 1 |
| 467 |
--let $gtid_step_count = 1 |
| 468 |
--source include/gtid_step_assert.inc |
| 469 |
|
| 470 |
SET @@SESSION.AUTOCOMMIT = ON; |
| 471 |
--let $gtid_step_count = 0 |
| 472 |
--source include/gtid_step_assert.inc |
| 473 |
|
| 474 |
SET @@SESSION.AUTOCOMMIT = OFF; |
| 475 |
--let $gtid_step_count = 0 |
| 476 |
--source include/gtid_step_assert.inc |
| 477 |
|
| 478 |
--disconnect conn |
| 479 |
|
| 480 |
--source include/wait_until_disconnected.inc |
| 481 |
sleep 15; |
| 482 |
|
| 483 |
--source include/rpl_connection_slave.inc |
| 484 |
SET GLOBAL SUPER_READ_ONLY = ON; |
| 485 |
--source include/gtid_step_reset.inc |
| 486 |
|
| 487 |
eval SET GTID_NEXT = '$uuida:2'; |
| 488 |
START TRANSACTION WITH CONSISTENT SNAPSHOT; |
| 489 |
COMMIT; |
| 490 |
SET GTID_NEXT = 'AUTOMATIC'; |
| 491 |
--let $gtid_step_only_count = 1 |
| 492 |
--let $gtid_step_count = 1 |
| 493 |
--source include/gtid_step_assert.inc |
| 494 |
|
| 495 |
eval SET GTID_NEXT = '$uuida:3'; |
| 496 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 497 |
START TRANSACTION READ WRITE; |
| 498 |
|
| 499 |
eval SET GTID_NEXT = '$uuida:4'; |
| 500 |
START TRANSACTION READ ONLY; |
| 501 |
COMMIT; |
| 502 |
SET GTID_NEXT = 'AUTOMATIC'; |
| 503 |
--let $gtid_step_only_count = 1 |
| 504 |
--let $gtid_step_count = 1 |
| 505 |
--source include/gtid_step_assert.inc |
| 506 |
|
| 507 |
--let $gtid_step_count = 0 |
| 508 |
--let $gtid_step_only_count = 0 |
| 509 |
|
| 510 |
######################################################################## |
| 511 |
--echo #### 9. The unusual DDL statements: |
| 512 |
--echo #### [CREATE | ALTER] [SPATIAL REFERENCE SYTEM | SERVER | LOGFILE GROUP]. |
| 513 |
######################################################################## |
| 514 |
--source include/rpl_connection_slave.inc |
| 515 |
|
| 516 |
SET GLOBAL SUPER_READ_ONLY = OFF; |
| 517 |
CREATE TABLE t_part(c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB |
| 518 |
PARTITION BY RANGE(c1) |
| 519 |
(PARTITION p0 VALUES LESS THAN (2), |
| 520 |
PARTITION p1 VALUES LESS THAN (5), |
| 521 |
PARTITION p3 VALUES LESS THAN (10), |
| 522 |
PARTITION sp00 VALUES LESS THAN (15)); |
| 523 |
CREATE TABLE t_hash(c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 524 |
CREATE TABLE t_nopart1(c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 525 |
CREATE TABLE t_part1(c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB |
| 526 |
PARTITION BY RANGE(c1) |
| 527 |
(PARTITION p1 VALUES LESS THAN (5), |
| 528 |
PARTITION p2 VALUES LESS THAN (10)); |
| 529 |
SET GLOBAL SUPER_READ_ONLY = ON; |
| 530 |
|
| 531 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 532 |
CREATE TABLE t_test(c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB; |
| 533 |
|
| 534 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 535 |
CREATE SPATIAL REFERENCE SYSTEM 13001000 NAME 'TEST13001000 Long-Lat WGS 84' DEFINITION 'GEOGCS["Long-Lat WGS 84",DATUM["World Geodetic System 1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943278,AUTHORITY["EPSG","9122"]],AXIS["Lon",EAST],AXIS["Lat",NORTH],AUTHORITY["EPSG","4326"]]'; |
| 536 |
|
| 537 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 538 |
CREATE SERVER s1 FOREIGN DATA WRAPPER mysql |
| 539 |
OPTIONS (USER 'Remote', HOST '198.51.100.106', DATABASE 'test'); |
| 540 |
|
| 541 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 542 |
CREATE LOGFILE GROUP lg1 ADD UNDOFILE 'undo.dat' INITIAL_SIZE = 10M; |
| 543 |
|
| 544 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 545 |
ALTER TABLE t_part TRUNCATE PARTITION p0, p1; |
| 546 |
|
| 547 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 548 |
ALTER TABLE t_hash DISCARD TABLESPACE; |
| 549 |
|
| 550 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 551 |
ALTER TABLE t_hash IMPORT TABLESPACE; |
| 552 |
|
| 553 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 554 |
ALTER TABLE t_hash COALESCE PARTITION 1; |
| 555 |
|
| 556 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 557 |
ALTER TABLE t_nopart1 REMOVE PARTITIONING; |
| 558 |
|
| 559 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 560 |
ALTER TABLE t_part EXCHANGE PARTITION sp00 WITH TABLE t_nopart1; |
| 561 |
|
| 562 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 563 |
ALTER TABLE t_part REBUILD PARTITION p0; |
| 564 |
|
| 565 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 566 |
ALTER TABLE t_part1 REORGANIZE PARTITION p1,p2 INTO (PARTITION p3 VALUES LESS THAN (300)); |
| 567 |
|
| 568 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 569 |
ALTER TABLE t_part ADD PARTITION (PARTITION p3 VALUES LESS THAN (300)); |
| 570 |
|
| 571 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 572 |
ALTER TABLE t_part DROP PARTITION p3; |
| 573 |
|
| 574 |
######################################################################## |
| 575 |
--echo #### 10. [UN]INSTALL [PLUGIN | COMPONENT] |
| 576 |
######################################################################## |
| 577 |
--source include/gtid_step_reset.inc |
| 578 |
|
| 579 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 580 |
INSTALL PLUGIN keyring_file SONAME 'keyring_file.so'; |
| 581 |
|
| 582 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 583 |
UNINSTALL PLUGIN keyring_file; |
| 584 |
|
| 585 |
--let $gtid_step_count = 0 |
| 586 |
--source include/gtid_step_assert.inc |
| 587 |
|
| 588 |
######################################################################## |
| 589 |
--echo #### 11. [OPTIMIZE | ANALYZE | REPAIR] TABLE |
| 590 |
######################################################################## |
| 591 |
|
| 592 |
REPAIR TABLE t1; |
| 593 |
|
| 594 |
--let $gtid_step_count = 1 |
| 595 |
--source include/gtid_step_assert.inc |
| 596 |
|
| 597 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 598 |
ANALYZE TABLE t1; |
| 599 |
|
| 600 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 601 |
OPTIMIZE TABLE t1; |
| 602 |
|
| 603 |
--let $gtid_step_count = 0 |
| 604 |
######################################################################## |
| 605 |
--echo #### 12. ALTER TABLE ... [OPTIMIZE | ANALYZE | REPAIR] PARTITION. |
| 606 |
######################################################################## |
| 607 |
--source include/gtid_step_reset.inc |
| 608 |
|
| 609 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 610 |
ALTER TABLE t_part OPTIMIZE PARTITION p0, p1; |
| 611 |
--let $gtid_step_count = 0 |
| 612 |
--source include/gtid_step_assert.inc |
| 613 |
|
| 614 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 615 |
ALTER TABLE t_part ANALYZE PARTITION p0; |
| 616 |
--let $gtid_step_count = 0 |
| 617 |
--source include/gtid_step_assert.inc |
| 618 |
|
| 619 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 620 |
ALTER TABLE t_part REPAIR PARTITION p0, p1; |
| 621 |
--let $gtid_step_count = 0 |
| 622 |
--source include/gtid_step_assert.inc |
| 623 |
|
| 624 |
######################################################################## |
| 625 |
--echo #### 13. Run GRANT, REVOKE, CREATE USER, DROP USER in a way that it |
| 626 |
--echo #### fails, e.g., create two users where the second already exists. |
| 627 |
######################################################################## |
| 628 |
SET @@global.super_read_only = 0; |
| 629 |
CREATE USER 'u1'@localhost IDENTIFIED BY ''; |
| 630 |
SET @@global.super_read_only = 1; |
| 631 |
--source include/gtid_step_reset.inc |
| 632 |
|
| 633 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 634 |
CREATE USER u1,u2; |
| 635 |
--let $gtid_step_count = 0 |
| 636 |
--source include/gtid_step_assert.inc |
| 637 |
|
| 638 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 639 |
GRANT ALL ON *.* To u1,u2; |
| 640 |
--let $gtid_step_count = 0 |
| 641 |
--source include/gtid_step_assert.inc |
| 642 |
|
| 643 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 644 |
REVOKE ALL ON *.* from u1; |
| 645 |
--let $gtid_step_count = 0 |
| 646 |
--source include/gtid_step_assert.inc |
| 647 |
|
| 648 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 649 |
DROP USER u1; |
| 650 |
--let $gtid_step_count = 0 |
| 651 |
--source include/gtid_step_assert.inc |
| 652 |
|
| 653 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 654 |
DROP USER u1,u2; |
| 655 |
--let $gtid_step_count = 0 |
| 656 |
--source include/gtid_step_assert.inc |
| 657 |
|
| 658 |
######################################################################## |
| 659 |
--echo #### 14. Run DML on mysql.gtid_executed, slave_master_info, |
| 660 |
--echo #### slave_relay_log_info, and slave_worker_info tables. |
| 661 |
######################################################################## |
| 662 |
|
| 663 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 664 |
UPDATE mysql.slave_master_info SET Retry_count = Retry_count + 1; |
| 665 |
--let $gtid_step_count = 0 |
| 666 |
--source include/gtid_step_assert.inc |
| 667 |
|
| 668 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 669 |
UPDATE mysql.slave_relay_log_info SET Sql_delay = Sql_delay + 1; |
| 670 |
--let $gtid_step_count = 0 |
| 671 |
--source include/gtid_step_assert.inc |
| 672 |
|
| 673 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 674 |
UPDATE mysql.slave_worker_info SET Relay_log_pos = Relay_log_pos + 1; |
| 675 |
--let $gtid_step_count = 0 |
| 676 |
--source include/gtid_step_assert.inc |
| 677 |
|
| 678 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 679 |
UPDATE mysql.gtid_executed SET interval_end = interval_end + 1; |
| 680 |
--let $gtid_step_count = 0 |
| 681 |
--source include/gtid_step_assert.inc |
| 682 |
|
| 683 |
######################################################################## |
| 684 |
--echo #### 15. Cleanup |
| 685 |
######################################################################## |
| 686 |
SET GLOBAL READ_ONLY = OFF; |
| 687 |
SET GTID_NEXT = 'AUTOMATIC'; |
| 688 |
--source include/rpl_connection_master.inc |
| 689 |
SET GLOBAL SUPER_READ_ONLY = OFF; |
| 690 |
SET GLOBAL READ_ONLY = OFF; |
| 691 |
DROP TABLE t1, m1; |
| 692 |
--source include/rpl_end.inc |