Debian Codegraph @

mysql-test/suite/binlog/t/binlog_xa_recovery_errors.test

raw
1 # ==== Purpose ====
2 #
3 # The purpose of this test is to check that the XA recovery identifies
4 # and reports errors returned by the SEs.
5 #
6 # ==== Requirements ====
7 #
8 # R1. An error message describing the transaction and the error will be
9 # outputted to the server log.
10 # R2. Server will abort if any pending transaction fails to finish in the
11 # SE.
12 #
13 # ==== Implementation ====
14 #
15 # For each of the possible errors(1) returned by the SE and for each of the
16 # possible actions(2) performed by the SE:
17 # 1. Start the transaction and insert some record.
18 # 2. Setup a conditional sync point for timestamp for the statement
19 # associated with the one of the possible SE actions(2) and execute up
20 # until that sync point.
21 # 3. Kill the server.
22 # 4. Restart server passing debug symbols that will simulate SEs returning
23 # a given error(1) and expect crash during start.
24 # 5. Find in the server log the error message corresponding to the
25 # simulated error(1).
26 # 6. Restart the server without the debug symbols.
27 #
28 # (1) List of possible errors returned by the SE:
29 # - XAER_ASYNC
30 # - XAER_RMERR
31 # - XAER_NOTA
32 # - XAER_INVAL
33 # - XAER_PROTO
34 # - XAER_RMFAIL
35 # - XAER_DUPID
36 # - XAER_OUTSIDE
37 #
38 # (2) List of possible SE actions during recovery:
39 # - Commit a normal transaction
40 # - Rollback a normal transaction
41 # - Prepare an XA transaction
42 # - Commit an XA transaction
43 # - Rollback an XA transaction
44 # - Commit an XA transaction with one-phase
45 #
46 # ==== References ====
47 #
48 # WL#11300: Crash-safe XA + binary log
49 #
50 # Related tests;
51 # see extra/xa_crash_safe_tests/setup.inc
52 #
53 --source include/have_binlog_format_row.inc
54 --source include/not_valgrind.inc
55 --source include/have_debug.inc
56 --source include/have_debug_sync.inc
57 --source include/big_test.inc
58
59 let $messages = .*Crash recovery finished in InnoDB engine. Failed to.*
60 .*Storage engines failed to recover one or more transactions*
61 .*Can.t init tc log.*
62 .*Aborting.*;
63 --source include/suppress_messages.inc
64
65 --let $xid = 'xid0'
66 --source extra/xa_crash_safe_tests/setup.inc
67
68 let $xa_errors = [
69 "XAER_ASYNC",
70 "XAER_RMERR",
71 "XAER_NOTA",
72 "XAER_INVAL",
73 "XAER_PROTO",
74 "XAER_RMFAIL",
75 "XAER_DUPID",
76 "XAER_OUTSIDE"
77 ];
78 --let $json_label = xa_error_list
79 --source include/create_json_iterator.inc
80
81 # Include $error_on_recovery_for_normal_transaction and
82 # $error_on_recovery_for_xa_transaction procedures
83 --source extra/xa_crash_safe_tests/utility_functions.inc
84
85 --let $nth_iteration = 3
86
87 # Commit a normal transaction
88 --let $action = commit
89 --let $sync_point = before_commit_in_engines
90 --source $error_on_recovery_for_normal_transaction
91
92 # Rollback a normal transaction
93 --let $action = rollback
94 --let $sync_point = before_write_binlog
95 --source $error_on_recovery_for_normal_transaction
96
97 # Prepare an XA transaction
98 --let $action = prepare
99 --let $sync_point = before_set_prepared_in_tc
100 --source $error_on_recovery_for_xa_transaction
101
102 # Commit an XA transaction
103 --let $action = commit
104 --let $sync_point = before_commit_in_engines
105 --source $error_on_recovery_for_xa_transaction
106
107 # Rollback an XA transaction
108 --let $action = rollback
109 --let $sync_point = before_rollback_in_engines
110 --source $error_on_recovery_for_xa_transaction
111
112 # Commit an XA transaction with one-phase
113 --let $action = commit
114 --let $xa_opt = one phase
115 --let $sync_point = before_commit_in_engines
116 --source $error_on_recovery_for_xa_transaction
117
118 --connection default
119 DROP TABLE t1;
120 --source extra/xa_crash_safe_tests/end_utility_functions.inc
121 --source include/destroy_json_functions.inc