| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# The purpose of this test is to check that the binlog recovery identifies |
| 4 |
# and reports malformed binary log files which hold invalid sequence of |
| 5 |
# events. |
| 6 |
# |
| 7 |
# ==== Requirements ==== |
| 8 |
# |
| 9 |
# R1. When the sequence of events found in the binary log, at recovery, |
| 10 |
# isn't the expected one, the server will report the issue through the |
| 11 |
# error log. |
| 12 |
# R2. Finding an Xid_log_event after a sequence of events that represent a |
| 13 |
# finished (committed or rolled back) transaction must report an error |
| 14 |
# to the error log. |
| 15 |
# R3. Finding an XA_prepare_log_event after a sequence of events that |
| 16 |
# represent a finished (committed or rolled back) transaction must |
| 17 |
# report an error to the error log. |
| 18 |
# R4. Finding an XA_prepare_log_event holding an XID that was previously |
| 19 |
# found in the binary log and hasn't been yet used with `XA |
| 20 |
# COMMIT/ROLLBACK` must report an error to the error log. |
| 21 |
# R5. Finding a Query_log_event containing a `BEGIN/XA START` after a |
| 22 |
# sequence of events that represent an ongoing transaction must report |
| 23 |
# an error to the error log. |
| 24 |
# R6. Finding a Query_log_event containing a `COMMIT` after a sequence of |
| 25 |
# events that represent a finished (committed or rolled back) |
| 26 |
# transaction must report an error to the error log. |
| 27 |
# R7. Finding a Query_log_event containing a `ROLLBACK` after a sequence of |
| 28 |
# events that represent a finished (committed or rolled back) |
| 29 |
# transaction must report an error to the error log. |
| 30 |
# R8. Finding a Query_log_event containing a DDL after a sequence of events |
| 31 |
# that represent a finished (committed or rolled back) transaction must |
| 32 |
# report an error to the error log. |
| 33 |
# R9. Finding a Query_log_event containing an `XA COMMIT` after a sequence |
| 34 |
# of events that represent a finished (committed or rolled back) |
| 35 |
# transaction must report an error to the error log. |
| 36 |
# R10. Finding a Query_log_event containing an `XA COMMIT` holding an XID |
| 37 |
# that was previously found in the binary log and hasn't been yet used |
| 38 |
# with `XA PREPARE` must report an error to the error log. |
| 39 |
# R11. Finding a Query_log_event containing an `XA COMMIT` holding an XID |
| 40 |
# that doesn't conform with the standard format of an XID, must report |
| 41 |
# an error to the error log. |
| 42 |
# R12. Finding a Query_log_event containing an `XA ROLLBACK` after a |
| 43 |
# sequence of events that represent a finished (committed or rolled |
| 44 |
# back) transaction must report an error to the error log. |
| 45 |
# R13. Finding a Query_log_event containing an `XA ROLLBACK` holding an XID |
| 46 |
# that was previously found in the binary log and hasn't been yet used |
| 47 |
# with `XA PREPARE` must report an error to the error log. |
| 48 |
# R14. Finding a Query_log_event containing an `XA ROLLBACK` holding an XID |
| 49 |
# that doesn't conform with the standard format of an XID, must report |
| 50 |
# an error to the error log. |
| 51 |
# |
| 52 |
# ==== Implementation ==== |
| 53 |
# |
| 54 |
# TC1. Orphan Xid_log_event |
| 55 |
# 1) Insert two records on the table. |
| 56 |
# 2) Kill the server. |
| 57 |
# 3) Replace the binlog file with a tampered file where the body of the |
| 58 |
# second insert's transaction was removed. |
| 59 |
# 4) Start the server. |
| 60 |
# 5) Check the error log for a message stating that an out of place |
| 61 |
# Xid_log_event was found. |
| 62 |
# 6) Clear the table and reset server state. |
| 63 |
# |
| 64 |
# TC2. Duplicate XID in Xid_log_event |
| 65 |
# 1) Insert two records on the table. |
| 66 |
# 2) Kill the server. |
| 67 |
# 3) Replace the binlog file with a tampered file where the XID in the |
| 68 |
# Xid_log_event for the second insert transaction as been set to the XID |
| 69 |
# for the first insert transaction. |
| 70 |
# 4) Start the server |
| 71 |
# 5) Check the error log for a message stating that an invalid XID was |
| 72 |
# found in an Xid_log_event. |
| 73 |
# 6) Clear the table and reset server state. |
| 74 |
# |
| 75 |
# TC3. Orphan `XA PREPARE` |
| 76 |
# 1) Execute an XA transaction up until the `XA PREPARE`. |
| 77 |
# 2) Kill the server. |
| 78 |
# 3) Replace the binlog file with a tampered file where the body of the |
| 79 |
# XA transaction (from `XA START` to `XA END`) was removed. |
| 80 |
# 4) Start the server. |
| 81 |
# 5) Check the error log for a message stating that an out of place |
| 82 |
# XA_prepare_log_event was found. |
| 83 |
# 6) Clear the table and reset server state. |
| 84 |
# |
| 85 |
# TC4. Duplicate XID in XA_prepare_log_event |
| 86 |
# 1) Execute two XA transactions up until the `XA PREPARE`. |
| 87 |
# 2) Kill the server. |
| 88 |
# 3) Replace the binlog file with a tampered file where the XID in the |
| 89 |
# second XA_prepare_log_event has been replace with the XID for the |
| 90 |
# first XA_prepare_log_event. |
| 91 |
# 4) Start the server. |
| 92 |
# 5) Check the error log for a message stating that an invalid XID was |
| 93 |
# found in an XA_prepare_log_event. |
| 94 |
# 6) Clear the table and reset server state. |
| 95 |
# |
| 96 |
# TC5. Orphan `BEGIN/XA START` |
| 97 |
# 1) Insert two records on the table within a transaction and execute an |
| 98 |
# XA transaction up until `XA PREPARE`. |
| 99 |
# 2) Kill the server. |
| 100 |
# 3) Replace the binlog file with a tampered file where the Xid_log_event |
| 101 |
# for the first transaction has been removed. |
| 102 |
# 4) Start the server. |
| 103 |
# 5) Check the error log for a message stating that an out of place |
| 104 |
# `BEGIN/START` has been found. |
| 105 |
# 6) Clear the table and reset server state. |
| 106 |
# |
| 107 |
# TC6. Orphan `COMMIT` |
| 108 |
# 1) Create a table in MyISAM engine. |
| 109 |
# 2) Insert a record on the table, while setting the `binlog_format` |
| 110 |
# session variable to `STATEMENT`. |
| 111 |
# 3) Kill the server. |
| 112 |
# 4) Replace the binlog file with a tampered file where the body of the |
| 113 |
# transaction is removed, leaving only the `COMMIT` query. |
| 114 |
# 5) Start the server. |
| 115 |
# 6) Check the error log for a message stating that an out of place |
| 116 |
# `COMMIT` has been found. |
| 117 |
# 7) Clear the table and reset server state. |
| 118 |
# |
| 119 |
# TC7. Orphan `ROLLBACK` |
| 120 |
# 1) Create a function that creates and deletes a temporary table in the |
| 121 |
# MyISAM engine. |
| 122 |
# 2) Invoke the function within a transaction and issue a `ROLLBACK`, |
| 123 |
# while setting the `binlog_format` session variable to `STATEMENT`. |
| 124 |
# 3) Kill the server. |
| 125 |
# 4) Replace the binlog file with a tampered file where the transaction |
| 126 |
# body has been removed. |
| 127 |
# 5) Start the server. |
| 128 |
# 6) Check the error log for a message stating that an out of place |
| 129 |
# `ROLLBACK` has been found. |
| 130 |
# 7) Clear the table and reset server state. |
| 131 |
# |
| 132 |
# TC8. DDL in the middle of transaction |
| 133 |
# 1) Insert a records on the table, create a new table and insert a |
| 134 |
# record in the new table. |
| 135 |
# 2) Kill the server. |
| 136 |
# 3) Replace the binlog file with a tampered file where the Xid_log_event |
| 137 |
# for the first insert's transaction has been removed. |
| 138 |
# 4) Start the server. |
| 139 |
# 5) Check the error log for a message stating that an out of place |
| 140 |
# DDL has been found. |
| 141 |
# 6) Clear the table and reset server state. |
| 142 |
# |
| 143 |
# TC9. DDL holding a duplicate XID |
| 144 |
# 1) Insert a records on the table and create a new table. |
| 145 |
# 2) Kill the server. |
| 146 |
# 3) Replace the binlog file with a tampered file where the XID held by |
| 147 |
# the DDL's Query_log_event is equal to the XID for the insert's |
| 148 |
# transaction. |
| 149 |
# 4) Start the server. |
| 150 |
# 5) Check the error log for a message stating that an invalid XID was |
| 151 |
# found in a Query_log_event. |
| 152 |
# 6) Clear the table and reset server state. |
| 153 |
# |
| 154 |
# TC10. Orphan `XA COMMIT` |
| 155 |
# 1) Insert two records on the table, one of them using an XA |
| 156 |
# transaction. |
| 157 |
# 2) Kill the server. |
| 158 |
# 3) Replace the binlog file with a tampered file where the |
| 159 |
# XA_prepare_log_event was removed, leading to the sequence |
| 160 |
# Query_log_event('XA END') > Gtid_log_event > Query_log_event('XA |
| 161 |
# COMMIT'). |
| 162 |
# 4) Start the server. |
| 163 |
# 5) Check the error log for a message stating that an out of place |
| 164 |
# `XA COMMIT` has been found. |
| 165 |
# 6) Clear the table and reset server state. |
| 166 |
# |
| 167 |
# TC11. `XA COMMIT` holding a malformed XID |
| 168 |
# 1) Insert two records on the table, one of them using an XA |
| 169 |
# transaction. |
| 170 |
# 2) Kill the server. |
| 171 |
# 3) Replace the binlog file with a tampered file where the XID held by |
| 172 |
# the `XA COMMIT` Query_log_event isn't in the correct format. |
| 173 |
# 4) Start the server. |
| 174 |
# 5) Check the error log for a message stating that an invalid XID was |
| 175 |
# found in a Query_log_event. |
| 176 |
# 6) Clear the table and reset server state. |
| 177 |
# |
| 178 |
# TC12. `XA COMMIT` holding a duplicate XID |
| 179 |
# 1) Insert three records on the table, two using distinct XA transactions |
| 180 |
# with the same XID. |
| 181 |
# 2) Kill the server. |
| 182 |
# 3) Replace the binlog file with a tampered file where the body of the |
| 183 |
# second XA transaction was removed, leaving only the `XA COMMIT`. |
| 184 |
# 4) Start the server. |
| 185 |
# 5) Check the error log for a message stating that an invalid XID was |
| 186 |
# found in a Query_log_event. |
| 187 |
# 6) Clear the table and reset server state. |
| 188 |
# |
| 189 |
# TC13. Orphan `XA ROLLBACK` |
| 190 |
# 1) Insert two records on the table, one of them using an XA |
| 191 |
# transaction. |
| 192 |
# 2) Kill the server. |
| 193 |
# 3) Replace the binlog file with a tampered file where the `XA PREPARE` |
| 194 |
# portion of the XA transaction was removed. |
| 195 |
# 4) Start the server. |
| 196 |
# 5) Check the error log for a message stating that an out of place |
| 197 |
# `XA ROLLBACK` has been found. |
| 198 |
# 6) Clear the table and reset server state. |
| 199 |
# |
| 200 |
# TC14. `XA ROLLBACK` holding a malformed XID |
| 201 |
# 1) Insert two records on the table, one of them using an XA |
| 202 |
# transaction. |
| 203 |
# 2) Kill the server. |
| 204 |
# 3) Replace the binlog file with a tampered file where the XID held by |
| 205 |
# the `XA ROLLBACK` Query_log_event isn't in the correct format. |
| 206 |
# 4) Start the server. |
| 207 |
# 5) Check the error log for a message stating that an invalid XID was |
| 208 |
# found in a Query_log_event. |
| 209 |
# 6) Clear the table and reset server state. |
| 210 |
# |
| 211 |
# TC15. `XA ROLLBACK` holding a duplicate XID |
| 212 |
# 1) Execute three transactions, two of them using XA transactions, |
| 213 |
# finishing them with `XA ROLLBACK` and using the same XID. |
| 214 |
# 2) Kill the server. |
| 215 |
# 3) Replace the binlog file with a tampered file where the body of the |
| 216 |
# second XA transaction was removed, leaving only the `XA ROLLBACK`. |
| 217 |
# 4) Start the server. |
| 218 |
# 5) Check the error log for a message stating that an invalid XID was |
| 219 |
# found in a Query_log_event. |
| 220 |
# 6) Clear the table and reset server state. |
| 221 |
# |
| 222 |
# ==== References ==== |
| 223 |
# |
| 224 |
# WL#11300: Crash-safe XA + binary log |
| 225 |
# |
| 226 |
# Related tests; |
| 227 |
# see extra/xa_crash_safe_tests/setup.inc |
| 228 |
# |
| 229 |
--source include/have_binlog_format_row.inc |
| 230 |
--source include/big_test.inc |
| 231 |
--source include/not_valgrind.inc |
| 232 |
--source include/have_debug.inc |
| 233 |
--source include/have_debug_sync.inc |
| 234 |
|
| 235 |
# Add suppression for recovery error message |
| 236 |
let $messages = .*Found invalid event sequence while recovering from binary log file.* |
| 237 |
.*Found.*prepared XA transactions.* |
| 238 |
.*Can.t init tc log.* |
| 239 |
.*Aborting.*; |
| 240 |
--source include/suppress_messages.inc |
| 241 |
|
| 242 |
# Create a table and reset server state |
| 243 |
CREATE TABLE t1 (c1 INT PRIMARY KEY); |
| 244 |
RESET MASTER; |
| 245 |
|
| 246 |
# Log file to be searched for error messages |
| 247 |
--let $grep_file = $MYSQLTEST_VARDIR/log/mysqld.1.err |
| 248 |
|
| 249 |
# TC1. Orphan Xid_log_event |
| 250 |
# ---------------------------------------------------------------------------- |
| 251 |
--let $recovery_scenario = orphan_xid |
| 252 |
INSERT INTO t1 VALUES (1); |
| 253 |
INSERT INTO t1 VALUES (2); |
| 254 |
--source extra/binlog_tests/recovery/kill_copy_malformed_restart.inc |
| 255 |
|
| 256 |
--let $grep_pattern = .*between positions 430 and 540: Xid_log_event outside the boundary of a sequence of events representing an active transaction.* |
| 257 |
--source include/wait_for_pattern_in_file.inc |
| 258 |
|
| 259 |
--source extra/binlog_tests/recovery/end_scenario.inc |
| 260 |
|
| 261 |
# TC2. Duplicate XID in Xid_log_event |
| 262 |
# ---------------------------------------------------------------------------- |
| 263 |
--let $recovery_scenario = duplicate_xid |
| 264 |
INSERT INTO t1 VALUES (1); |
| 265 |
INSERT INTO t1 VALUES (2); |
| 266 |
--source extra/binlog_tests/recovery/kill_copy_malformed_restart.inc |
| 267 |
|
| 268 |
--let $grep_pattern = .*between positions 430 and 703: Xid_log_event holds an invalid XID.* |
| 269 |
--source include/wait_for_pattern_in_file.inc |
| 270 |
|
| 271 |
--source extra/binlog_tests/recovery/end_scenario.inc |
| 272 |
|
| 273 |
# TC3. Orphan `XA PREPARE` |
| 274 |
# ---------------------------------------------------------------------------- |
| 275 |
--let $recovery_scenario = orphan_xa_prepare |
| 276 |
XA START 'x'; |
| 277 |
INSERT INTO t1 VALUES (1); |
| 278 |
XA END 'x'; |
| 279 |
XA PREPARE 'x'; |
| 280 |
--source extra/binlog_tests/recovery/kill_copy_malformed_restart.inc |
| 281 |
|
| 282 |
--let $grep_pattern = .*between positions 157 and 273: XA_prepare_log_event outside the boundary of a sequence of events representing an active transaction.* |
| 283 |
--source include/wait_for_pattern_in_file.inc |
| 284 |
|
| 285 |
--let $end_scenario_stmt = XA ROLLBACK 'x' |
| 286 |
--source extra/binlog_tests/recovery/end_scenario.inc |
| 287 |
|
| 288 |
# TC4. Duplicate XID in XA_prepare_log_event |
| 289 |
# ---------------------------------------------------------------------------- |
| 290 |
--let $recovery_scenario = duplicate_xid_xa_prepare |
| 291 |
XA START 'x'; |
| 292 |
INSERT INTO t1 VALUES (1); |
| 293 |
XA END 'x'; |
| 294 |
XA PREPARE 'x'; |
| 295 |
|
| 296 |
XA START 'y'; |
| 297 |
INSERT INTO t1 VALUES (2); |
| 298 |
XA END 'y'; |
| 299 |
XA PREPARE 'y'; |
| 300 |
--source extra/binlog_tests/recovery/kill_copy_malformed_restart.inc |
| 301 |
|
| 302 |
--let $grep_pattern = .*between positions 539 and 921: XA_prepare_log_event holds an invalid XID.* |
| 303 |
--source include/wait_for_pattern_in_file.inc |
| 304 |
|
| 305 |
--let $end_scenario_stmt = XA ROLLBACK 'x'; XA ROLLBACK 'y' |
| 306 |
--source extra/binlog_tests/recovery/end_scenario.inc |
| 307 |
|
| 308 |
# TC5. Orphan `BEGIN/XA START` |
| 309 |
# ---------------------------------------------------------------------------- |
| 310 |
--let $recovery_scenario = orphan_begin_start |
| 311 |
BEGIN; |
| 312 |
INSERT INTO t1 VALUES (1); |
| 313 |
INSERT INTO t1 VALUES (2); |
| 314 |
COMMIT; |
| 315 |
|
| 316 |
XA START 'x'; |
| 317 |
INSERT INTO t1 VALUES (3); |
| 318 |
XA END 'x'; |
| 319 |
XA PREPARE 'x'; |
| 320 |
--source extra/binlog_tests/recovery/kill_copy_malformed_restart.inc |
| 321 |
|
| 322 |
--let $grep_pattern = .*between positions 157 and 656: Query_log_event containing `BEGIN/XA START` inside the boundary of a sequence of events representing an active transaction.* |
| 323 |
--source include/wait_for_pattern_in_file.inc |
| 324 |
|
| 325 |
--let $end_scenario_stmt = XA ROLLBACK 'x' |
| 326 |
--source extra/binlog_tests/recovery/end_scenario.inc |
| 327 |
|
| 328 |
# TC6. Orphan `COMMIT` |
| 329 |
# ---------------------------------------------------------------------------- |
| 330 |
--let $recovery_scenario = orphan_commit |
| 331 |
CREATE TABLE tmp1 (i INT) ENGINE=MyISAM; |
| 332 |
|
| 333 |
SET @@SESSION.binlog_format = STATEMENT; |
| 334 |
BEGIN; |
| 335 |
INSERT INTO tmp1 (SELECT c1 FROM t1); |
| 336 |
COMMIT; |
| 337 |
SET @@SESSION.binlog_format = ROW; |
| 338 |
--source extra/binlog_tests/recovery/kill_copy_malformed_restart.inc |
| 339 |
|
| 340 |
--let $grep_pattern = .*between positions 352 and 514: Query_log_event containing `COMMIT` outside the boundary of a sequence of events representing an active transaction.* |
| 341 |
--source include/wait_for_pattern_in_file.inc |
| 342 |
|
| 343 |
--let $end_scenario_stmt = DROP TABLE tmp1 |
| 344 |
--source extra/binlog_tests/recovery/end_scenario.inc |
| 345 |
|
| 346 |
# TC7. Orphan `ROLLBACK` |
| 347 |
# ---------------------------------------------------------------------------- |
| 348 |
--let $recovery_scenario = orphan_rollback |
| 349 |
delimiter |; |
| 350 |
CREATE FUNCTION func1 () RETURNS INT |
| 351 |
BEGIN |
| 352 |
CREATE TEMPORARY TABLE tmp1(i INT) ENGINE=MyISAM; |
| 353 |
DROP TEMPORARY TABLE IF EXISTS tmp1; |
| 354 |
RETURN 0; |
| 355 |
END| |
| 356 |
delimiter ;| |
| 357 |
|
| 358 |
SET @@SESSION.binlog_format = STATEMENT; |
| 359 |
BEGIN; |
| 360 |
SELECT func1(); |
| 361 |
ROLLBACK; |
| 362 |
SET @@SESSION.binlog_format = ROW; |
| 363 |
--source extra/binlog_tests/recovery/kill_copy_malformed_restart.inc |
| 364 |
|
| 365 |
--let $grep_pattern = .*between positions 510 and 667: Query_log_event containing `ROLLBACK` outside the boundary of a sequence of events representing an active transaction.* |
| 366 |
--source include/wait_for_pattern_in_file.inc |
| 367 |
|
| 368 |
--let $end_scenario_stmt = DROP FUNCTION func1 |
| 369 |
--source extra/binlog_tests/recovery/end_scenario.inc |
| 370 |
|
| 371 |
# TC8. DDL in the middle of transaction |
| 372 |
# ---------------------------------------------------------------------------- |
| 373 |
--let $recovery_scenario = ddl_in_transaction |
| 374 |
INSERT INTO t1 VALUES (1); |
| 375 |
|
| 376 |
CREATE TABLE tmp1 (i INT); |
| 377 |
INSERT INTO tmp1 (SELECT c1 FROM t1); |
| 378 |
--source extra/binlog_tests/recovery/kill_copy_malformed_restart.inc |
| 379 |
|
| 380 |
--let $grep_pattern = .*between positions 157 and 589: Query_log event containing a DDL inside the boundary of a sequence of events representing an active transaction.* |
| 381 |
--source include/wait_for_pattern_in_file.inc |
| 382 |
|
| 383 |
--let $end_scenario_stmt = DROP TABLE tmp1 |
| 384 |
--source extra/binlog_tests/recovery/end_scenario.inc |
| 385 |
|
| 386 |
# TC9. DDL holding a duplicate XID |
| 387 |
# ---------------------------------------------------------------------------- |
| 388 |
--let $recovery_scenario = duplicate_xid_ddl |
| 389 |
INSERT INTO t1 VALUES (1); |
| 390 |
CREATE TABLE tmp1 (i INT); |
| 391 |
--source extra/binlog_tests/recovery/kill_copy_malformed_restart.inc |
| 392 |
|
| 393 |
--let $grep_pattern = .*between positions 430 and 620: Query_log_event containing a DDL holds an invalid XID.* |
| 394 |
--source include/wait_for_pattern_in_file.inc |
| 395 |
|
| 396 |
--let $end_scenario_stmt = DROP TABLE tmp1 |
| 397 |
--source extra/binlog_tests/recovery/end_scenario.inc |
| 398 |
|
| 399 |
# TC10. Orphan `XA COMMIT` |
| 400 |
# ---------------------------------------------------------------------------- |
| 401 |
--let $recovery_scenario = orphan_xa_commit |
| 402 |
INSERT INTO t1 VALUES (1); |
| 403 |
|
| 404 |
XA START 'x'; |
| 405 |
INSERT INTO t1 VALUES (2); |
| 406 |
XA END 'x'; |
| 407 |
XA PREPARE 'x'; |
| 408 |
XA COMMIT 'x' ; |
| 409 |
--source extra/binlog_tests/recovery/kill_copy_malformed_restart.inc |
| 410 |
|
| 411 |
--let $grep_pattern = .*between positions 430 and 943: Query_log_event containing `XA COMMIT` inside the boundary of a sequence of events representing a transaction not yet in prepared state.* |
| 412 |
--source include/wait_for_pattern_in_file.inc |
| 413 |
|
| 414 |
--source extra/binlog_tests/recovery/end_scenario.inc |
| 415 |
|
| 416 |
# TC11. `XA COMMIT` holding a malformed XID |
| 417 |
# ---------------------------------------------------------------------------- |
| 418 |
--let $recovery_scenario = malformed_xid_xa_commit |
| 419 |
INSERT INTO t1 VALUES (1); |
| 420 |
|
| 421 |
XA START 'x'; |
| 422 |
INSERT INTO t1 VALUES (2); |
| 423 |
XA END 'x'; |
| 424 |
XA PREPARE 'x'; |
| 425 |
XA COMMIT 'x' ; |
| 426 |
--source extra/binlog_tests/recovery/kill_copy_malformed_restart.inc |
| 427 |
|
| 428 |
--let $grep_pattern = .*between positions 812 and 980: Query_log_event containing `XA COMMIT` holds an invalid XID.* |
| 429 |
--source include/wait_for_pattern_in_file.inc |
| 430 |
|
| 431 |
--source extra/binlog_tests/recovery/end_scenario.inc |
| 432 |
|
| 433 |
# TC12. `XA COMMIT` holding a duplicate XID |
| 434 |
# ---------------------------------------------------------------------------- |
| 435 |
--let $recovery_scenario = duplicate_xid_xa_commit |
| 436 |
INSERT INTO t1 VALUES (1); |
| 437 |
|
| 438 |
XA START 'x'; |
| 439 |
INSERT INTO t1 VALUES (2); |
| 440 |
XA END 'x'; |
| 441 |
XA PREPARE 'x'; |
| 442 |
XA COMMIT 'x' ; |
| 443 |
|
| 444 |
XA START 'x'; |
| 445 |
INSERT INTO t1 VALUES (3); |
| 446 |
XA END 'x'; |
| 447 |
XA PREPARE 'x'; |
| 448 |
XA COMMIT 'x' ; |
| 449 |
--source extra/binlog_tests/recovery/kill_copy_malformed_restart.inc |
| 450 |
|
| 451 |
--let $grep_pattern = .*between positions 980 and 1148: Query_log_event containing `XA COMMIT` holds an invalid XID.* |
| 452 |
--source include/wait_for_pattern_in_file.inc |
| 453 |
|
| 454 |
--source extra/binlog_tests/recovery/end_scenario.inc |
| 455 |
|
| 456 |
# TC13. Orphan `XA ROLLBACK` |
| 457 |
# ---------------------------------------------------------------------------- |
| 458 |
--let $recovery_scenario = orphan_xa_rollback |
| 459 |
INSERT INTO t1 VALUES (1); |
| 460 |
|
| 461 |
XA START 'x'; |
| 462 |
INSERT INTO t1 VALUES (2); |
| 463 |
XA END 'x'; |
| 464 |
XA PREPARE 'x'; |
| 465 |
XA ROLLBACK 'x' ; |
| 466 |
--source extra/binlog_tests/recovery/kill_copy_malformed_restart.inc |
| 467 |
|
| 468 |
--let $grep_pattern = .*between positions 430 and 945: Query_log_event containing `XA ROLLBACK` inside the boundary of a sequence of events representing a transaction not yet in prepared state.* |
| 469 |
--source include/wait_for_pattern_in_file.inc |
| 470 |
|
| 471 |
--source extra/binlog_tests/recovery/end_scenario.inc |
| 472 |
|
| 473 |
# TC14. `XA ROLLBACK` holding a malformed XID |
| 474 |
# ---------------------------------------------------------------------------- |
| 475 |
--let $recovery_scenario = malformed_xid_xa_rollback |
| 476 |
INSERT INTO t1 VALUES (1); |
| 477 |
|
| 478 |
XA START 'x'; |
| 479 |
INSERT INTO t1 VALUES (2); |
| 480 |
XA END 'x'; |
| 481 |
XA PREPARE 'x'; |
| 482 |
XA ROLLBACK 'x' ; |
| 483 |
--source extra/binlog_tests/recovery/kill_copy_malformed_restart.inc |
| 484 |
|
| 485 |
--let $grep_pattern = .*between positions 812 and 982: Query_log_event containing `XA ROLLBACK` holds an invalid XID.* |
| 486 |
--source include/wait_for_pattern_in_file.inc |
| 487 |
|
| 488 |
--source extra/binlog_tests/recovery/end_scenario.inc |
| 489 |
|
| 490 |
# TC15. `XA ROLLBACK` holding a duplicate XID |
| 491 |
# ---------------------------------------------------------------------------- |
| 492 |
--let $recovery_scenario = duplicate_xid_xa_rollback |
| 493 |
INSERT INTO t1 VALUES (1); |
| 494 |
|
| 495 |
XA START 'x'; |
| 496 |
INSERT INTO t1 VALUES (2); |
| 497 |
XA END 'x'; |
| 498 |
XA PREPARE 'x'; |
| 499 |
XA COMMIT 'x' ; |
| 500 |
|
| 501 |
XA START 'x'; |
| 502 |
INSERT INTO t1 VALUES (3); |
| 503 |
XA END 'x'; |
| 504 |
XA PREPARE 'x'; |
| 505 |
XA ROLLBACK 'x' ; |
| 506 |
--source extra/binlog_tests/recovery/kill_copy_malformed_restart.inc |
| 507 |
|
| 508 |
--let $grep_pattern = .*between positions 980 and 1150: Query_log_event containing `XA ROLLBACK` holds an invalid XID.* |
| 509 |
--source include/wait_for_pattern_in_file.inc |
| 510 |
|
| 511 |
--source extra/binlog_tests/recovery/end_scenario.inc |
| 512 |
|
| 513 |
DROP TABLE t1; |