| 1 |
# ==== Requirements ==== |
| 2 |
# |
| 3 |
# R1. The server GTID-violation counters must be kept |
| 4 |
# consistent when using XA transactions and GTID. |
| 5 |
# R2. The above must occur even if GTID_MODE and |
| 6 |
# ENSURE_GTID_CONSISTENCY are turned off. |
| 7 |
# R3. Even after processing statements that will increment |
| 8 |
# the GTID-violation counters while not using GTID |
| 9 |
# (like 'CREATE TEMPORARY TABLE'), the server |
| 10 |
# should always arrive to a state where the counters |
| 11 |
# are consistent with the given state. |
| 12 |
# |
| 13 |
# ==== Implementation ==== |
| 14 |
# |
| 15 |
# With GTID_MODE and ENSURE_GTID_CONSISTENCY turned |
| 16 |
# off, test: |
| 17 |
# 1) Start with a GTID_NEXT value of 'AUTOMATIC', |
| 18 |
# start a XA transaction, create a temporary table, |
| 19 |
# and end the transaction with: |
| 20 |
# a) XA PREPARE, change GTID_NEXT to 'ANONYMOUS' |
| 21 |
# and XA COMMIT |
| 22 |
# b) XA PREPARE, change GTID_NEXT to 'ANONYMOUS' |
| 23 |
# and XA ROLLBACK |
| 24 |
# c) XA COMMIT ONE PHASE, change GTID_NEXT to 'ANONYMOUS' |
| 25 |
# 2) Start with a GTID_NEXT value of 'ANONYMOUS', |
| 26 |
# start a XA transaction, create a temporary table, |
| 27 |
# and end the transaction with: |
| 28 |
# a) XA PREPARE, change GTID_NEXT to 'AUTOMATIC' |
| 29 |
# and XA COMMIT |
| 30 |
# b) XA PREPARE, change GTID_NEXT to 'AUTOMATIC' |
| 31 |
# and XA ROLLBACK |
| 32 |
# c) XA COMMIT ONE PHASE, change GTID_NEXT to 'AUTOMATIC' |
| 33 |
# |
| 34 |
# ==== References ==== |
| 35 |
# |
| 36 |
# Bug#27041402 ASSERTION `NEW_VALUE >= 0' FAILED. |
| 37 |
|
| 38 |
--let $option_name = xa_detach_on_prepare |
| 39 |
--let $option_value = 0 |
| 40 |
--source include/only_with_option.inc |
| 41 |
|
| 42 |
--source include/have_debug.inc |
| 43 |
--let $rpl_gtid_mode= OFF |
| 44 |
--source include/rpl_set_gtid_mode.inc |
| 45 |
|
| 46 |
--connect (verify,127.0.0.1,root,,test,$MASTER_MYPORT,) |
| 47 |
|
| 48 |
--echo [connection default] |
| 49 |
--connection default |
| 50 |
|
| 51 |
--echo # 1) start with GTID_NEXT to 'AUTOMATIC' and |
| 52 |
--echo # and then change to 'ANONYMOUS' |
| 53 |
--echo # |
| 54 |
|
| 55 |
--let $end_type= 0 |
| 56 |
while ($end_type < 3) { |
| 57 |
|
| 58 |
if ($end_type == 0) { |
| 59 |
--echo # 1.a) Create transaction, create temporary |
| 60 |
--echo # table, end transaction with XA PREPARE |
| 61 |
--echo # and XA COMMIT |
| 62 |
--echo # |
| 63 |
} |
| 64 |
if ($end_type == 1) { |
| 65 |
--echo # 1.b) Create transaction, create temporary |
| 66 |
--echo # table, end transaction with XA PREPARE |
| 67 |
--echo # and XA ROLLBACK |
| 68 |
--echo # |
| 69 |
} |
| 70 |
if ($end_type == 2) { |
| 71 |
--echo # 1.c) Create transaction, create temporary |
| 72 |
--echo # table, end transaction with XA COMMIT |
| 73 |
--echo # ONE PHASE |
| 74 |
--echo # |
| 75 |
} |
| 76 |
|
| 77 |
SET @@SESSION.GTID_NEXT = 'AUTOMATIC'; |
| 78 |
|
| 79 |
XA START 'trx1'; |
| 80 |
CREATE TEMPORARY TABLE temp_table_1 (a INT); |
| 81 |
XA END 'trx1'; |
| 82 |
|
| 83 |
if ($end_type == 0) { |
| 84 |
XA PREPARE 'trx1'; |
| 85 |
SET @@SESSION.GTID_NEXT = 'ANONYMOUS'; |
| 86 |
} |
| 87 |
if ($end_type == 1) { |
| 88 |
XA PREPARE 'trx1'; |
| 89 |
SET @@SESSION.GTID_NEXT = 'ANONYMOUS'; |
| 90 |
} |
| 91 |
if ($end_type == 2) { |
| 92 |
XA COMMIT 'trx1' ONE PHASE; |
| 93 |
SET @@SESSION.GTID_NEXT = 'ANONYMOUS'; |
| 94 |
} |
| 95 |
|
| 96 |
--echo [connection verify] |
| 97 |
--connection verify |
| 98 |
--let $assert_cond= [SHOW STATUS LIKE "ONGOING_AUTOMATIC_GTID_VIOLATING_TRANSACTION_COUNT", Value, 1] = 0 |
| 99 |
--let $assert_text= There are no AUTOMATIC violating transactions |
| 100 |
--source include/assert.inc |
| 101 |
--let $assert_cond= [SHOW STATUS LIKE "ONGOING_ANONYMOUS_GTID_VIOLATING_TRANSACTION_COUNT", Value, 1] = 0 |
| 102 |
--let $assert_text= There are no ANONYMOUS violating transactions |
| 103 |
--source include/assert.inc |
| 104 |
|
| 105 |
--echo [connection default] |
| 106 |
--connection default |
| 107 |
if ($end_type == 0) { |
| 108 |
XA COMMIT 'trx1'; |
| 109 |
} |
| 110 |
if ($end_type == 1) { |
| 111 |
XA ROLLBACK 'trx1'; |
| 112 |
} |
| 113 |
DROP TEMPORARY TABLE IF EXISTS temp_table_1; |
| 114 |
|
| 115 |
--inc $end_type |
| 116 |
} |
| 117 |
|
| 118 |
--echo [connection default] |
| 119 |
--connection default |
| 120 |
|
| 121 |
--echo # 2) start with GTID_NEXT to 'ANONYMOUS' and |
| 122 |
--echo # and then change to 'AUTOMATIC' |
| 123 |
--echo # |
| 124 |
|
| 125 |
--let $end_type= 0 |
| 126 |
while ($end_type < 3) { |
| 127 |
|
| 128 |
if ($end_type == 0) { |
| 129 |
--echo # 2.a) Create transaction, create temporary |
| 130 |
--echo # table, end transaction with XA PREPARE |
| 131 |
--echo # and XA COMMIT |
| 132 |
--echo # |
| 133 |
} |
| 134 |
if ($end_type == 1) { |
| 135 |
--echo # 2.b) Create transaction, create temporary |
| 136 |
--echo # table, end transaction with XA PREPARE |
| 137 |
--echo # and XA ROLLBACK |
| 138 |
--echo # |
| 139 |
} |
| 140 |
if ($end_type == 2) { |
| 141 |
--echo # 2.c) Create transaction, create temporary |
| 142 |
--echo # table, end transaction with XA COMMIT |
| 143 |
--echo # ONE PHASE |
| 144 |
--echo # |
| 145 |
} |
| 146 |
|
| 147 |
SET @@SESSION.GTID_NEXT = 'ANONYMOUS'; |
| 148 |
|
| 149 |
XA START 'trx1'; |
| 150 |
CREATE TEMPORARY TABLE temp_table_1 (a INT); |
| 151 |
XA END 'trx1'; |
| 152 |
|
| 153 |
if ($end_type == 0) { |
| 154 |
XA PREPARE 'trx1'; |
| 155 |
SET @@SESSION.GTID_NEXT = 'AUTOMATIC'; |
| 156 |
} |
| 157 |
if ($end_type == 1) { |
| 158 |
XA PREPARE 'trx1'; |
| 159 |
SET @@SESSION.GTID_NEXT = 'AUTOMATIC'; |
| 160 |
} |
| 161 |
if ($end_type == 2) { |
| 162 |
XA COMMIT 'trx1' ONE PHASE; |
| 163 |
SET @@SESSION.GTID_NEXT = 'AUTOMATIC'; |
| 164 |
} |
| 165 |
|
| 166 |
--echo [connection verify] |
| 167 |
--connection verify |
| 168 |
--let $assert_cond= [SHOW STATUS LIKE "ONGOING_AUTOMATIC_GTID_VIOLATING_TRANSACTION_COUNT", Value, 1] = 0 |
| 169 |
--let $assert_text= There are no AUTOMATIC violating transactions |
| 170 |
--source include/assert.inc |
| 171 |
--let $assert_cond= [SHOW STATUS LIKE "ONGOING_ANONYMOUS_GTID_VIOLATING_TRANSACTION_COUNT", Value, 1] = 0 |
| 172 |
--let $assert_text= There are no ANONYMOUS violating transactions |
| 173 |
--source include/assert.inc |
| 174 |
|
| 175 |
--echo [connection default] |
| 176 |
--connection default |
| 177 |
if ($end_type == 0) { |
| 178 |
XA COMMIT 'trx1'; |
| 179 |
} |
| 180 |
if ($end_type == 1) { |
| 181 |
XA ROLLBACK 'trx1'; |
| 182 |
} |
| 183 |
DROP TEMPORARY TABLE IF EXISTS temp_table_1; |
| 184 |
|
| 185 |
--inc $end_type |
| 186 |
} |