File: binlog_xa_recovery_errors.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (121 lines) | stat: -rw-r--r-- 3,512 bytes parent folder | download
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
# ==== Purpose ====
#
# The purpose of this test is to check that the XA recovery identifies
# and reports errors returned by the SEs.
#
# ==== Requirements ====
#
# R1. An error message describing the transaction and the error will be
#     outputted to the server log.
# R2. Server will abort if any pending transaction fails to finish in the
#     SE.
#
# ==== Implementation ====
#
# For each of the possible errors(1) returned by the SE and for each of the
# possible actions(2) performed by the SE:
# 1. Start the transaction and insert some record.
# 2. Setup a conditional sync point for timestamp for the statement
#    associated with the one of the possible SE actions(2) and execute up
#    until that sync point.
# 3. Kill the server.
# 4. Restart server passing debug symbols that will simulate SEs returning
#    a given error(1) and expect crash during start.
# 5. Find in the server log the error message corresponding to the
#    simulated error(1).
# 6. Restart the server without the debug symbols.
#
# (1) List of possible errors returned by the SE:
# - XAER_ASYNC
# - XAER_RMERR
# - XAER_NOTA
# - XAER_INVAL
# - XAER_PROTO
# - XAER_RMFAIL
# - XAER_DUPID
# - XAER_OUTSIDE
#
# (2) List of possible SE actions during recovery:
# - Commit a normal transaction
# - Rollback a normal transaction
# - Prepare an XA transaction
# - Commit an XA transaction
# - Rollback an XA transaction
# - Commit an XA transaction with one-phase
#
# ==== References ====
#
# WL#11300: Crash-safe XA + binary log
#
# Related tests;
#   see extra/xa_crash_safe_tests/setup.inc
#
--source include/have_binlog_format_row.inc
--source include/not_valgrind.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/big_test.inc

let $messages = .*Crash recovery finished in InnoDB engine. Failed to.*
.*Storage engines failed to recover one or more transactions*
.*Can.t init tc log.*
.*Aborting.*;
--source include/suppress_messages.inc

--let $xid = 'xid0'
--source extra/xa_crash_safe_tests/setup.inc

let $xa_errors = [
  "XAER_ASYNC",
  "XAER_RMERR",
  "XAER_NOTA",
  "XAER_INVAL",
  "XAER_PROTO",
  "XAER_RMFAIL",
  "XAER_DUPID",
  "XAER_OUTSIDE"
];
--let $json_label = xa_error_list
--source include/create_json_iterator.inc

# Include $error_on_recovery_for_normal_transaction and
# $error_on_recovery_for_xa_transaction procedures
--source extra/xa_crash_safe_tests/utility_functions.inc

--let $nth_iteration = 3

# Commit a normal transaction
--let $action = commit
--let $sync_point = before_commit_in_engines
--source $error_on_recovery_for_normal_transaction

# Rollback a normal transaction
--let $action = rollback
--let $sync_point = before_write_binlog
--source $error_on_recovery_for_normal_transaction

# Prepare an XA transaction
--let $action = prepare
--let $sync_point = before_set_prepared_in_tc
--source $error_on_recovery_for_xa_transaction

# Commit an XA transaction
--let $action = commit
--let $sync_point = before_commit_in_engines
--source $error_on_recovery_for_xa_transaction

# Rollback an XA transaction
--let $action = rollback
--let $sync_point = before_rollback_in_engines
--source $error_on_recovery_for_xa_transaction

# Commit an XA transaction with one-phase
--let $action = commit
--let $xa_opt = one phase
--let $sync_point = before_commit_in_engines
--source $error_on_recovery_for_xa_transaction

--connection default
DROP TABLE t1;
--source extra/xa_crash_safe_tests/end_utility_functions.inc
--source include/destroy_json_functions.inc