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 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
|
# ==== Requirements ====
#
# R1. The server GTID-violation counters must be kept
# consistent when using XA transactions and GTID.
# R2. The above must occur even if GTID_MODE and
# ENSURE_GTID_CONSISTENCY are turned off.
# R3. Even after processing statements that will increment
# the GTID-violation counters while not using GTID
# (like 'CREATE TEMPORARY TABLE'), the server
# should always arrive to a state where the counters
# are consistent with the given state.
#
# ==== Implementation ====
#
# With GTID_MODE and ENSURE_GTID_CONSISTENCY turned
# off, test:
# 1) Start with a GTID_NEXT value of 'AUTOMATIC',
# start a XA transaction, create a temporary table,
# and end the transaction with:
# a) XA PREPARE, change GTID_NEXT to 'ANONYMOUS'
# and XA COMMIT
# b) XA PREPARE, change GTID_NEXT to 'ANONYMOUS'
# and XA ROLLBACK
# c) XA COMMIT ONE PHASE, change GTID_NEXT to 'ANONYMOUS'
# 2) Start with a GTID_NEXT value of 'ANONYMOUS',
# start a XA transaction, create a temporary table,
# and end the transaction with:
# a) XA PREPARE, change GTID_NEXT to 'AUTOMATIC'
# and XA COMMIT
# b) XA PREPARE, change GTID_NEXT to 'AUTOMATIC'
# and XA ROLLBACK
# c) XA COMMIT ONE PHASE, change GTID_NEXT to 'AUTOMATIC'
#
# ==== References ====
#
# Bug#27041402 ASSERTION `NEW_VALUE >= 0' FAILED.
--let $option_name = xa_detach_on_prepare
--let $option_value = 0
--source include/only_with_option.inc
--source include/have_debug.inc
--let $rpl_gtid_mode= OFF
--source include/rpl_set_gtid_mode.inc
--connect (verify,127.0.0.1,root,,test,$MASTER_MYPORT,)
--echo [connection default]
--connection default
--echo # 1) start with GTID_NEXT to 'AUTOMATIC' and
--echo # and then change to 'ANONYMOUS'
--echo #
--let $end_type= 0
while ($end_type < 3) {
if ($end_type == 0) {
--echo # 1.a) Create transaction, create temporary
--echo # table, end transaction with XA PREPARE
--echo # and XA COMMIT
--echo #
}
if ($end_type == 1) {
--echo # 1.b) Create transaction, create temporary
--echo # table, end transaction with XA PREPARE
--echo # and XA ROLLBACK
--echo #
}
if ($end_type == 2) {
--echo # 1.c) Create transaction, create temporary
--echo # table, end transaction with XA COMMIT
--echo # ONE PHASE
--echo #
}
SET @@SESSION.GTID_NEXT = 'AUTOMATIC';
XA START 'trx1';
CREATE TEMPORARY TABLE temp_table_1 (a INT);
XA END 'trx1';
if ($end_type == 0) {
XA PREPARE 'trx1';
SET @@SESSION.GTID_NEXT = 'ANONYMOUS';
}
if ($end_type == 1) {
XA PREPARE 'trx1';
SET @@SESSION.GTID_NEXT = 'ANONYMOUS';
}
if ($end_type == 2) {
XA COMMIT 'trx1' ONE PHASE;
SET @@SESSION.GTID_NEXT = 'ANONYMOUS';
}
--echo [connection verify]
--connection verify
--let $assert_cond= [SHOW STATUS LIKE "ONGOING_AUTOMATIC_GTID_VIOLATING_TRANSACTION_COUNT", Value, 1] = 0
--let $assert_text= There are no AUTOMATIC violating transactions
--source include/assert.inc
--let $assert_cond= [SHOW STATUS LIKE "ONGOING_ANONYMOUS_GTID_VIOLATING_TRANSACTION_COUNT", Value, 1] = 0
--let $assert_text= There are no ANONYMOUS violating transactions
--source include/assert.inc
--echo [connection default]
--connection default
if ($end_type == 0) {
XA COMMIT 'trx1';
}
if ($end_type == 1) {
XA ROLLBACK 'trx1';
}
DROP TEMPORARY TABLE IF EXISTS temp_table_1;
--inc $end_type
}
--echo [connection default]
--connection default
--echo # 2) start with GTID_NEXT to 'ANONYMOUS' and
--echo # and then change to 'AUTOMATIC'
--echo #
--let $end_type= 0
while ($end_type < 3) {
if ($end_type == 0) {
--echo # 2.a) Create transaction, create temporary
--echo # table, end transaction with XA PREPARE
--echo # and XA COMMIT
--echo #
}
if ($end_type == 1) {
--echo # 2.b) Create transaction, create temporary
--echo # table, end transaction with XA PREPARE
--echo # and XA ROLLBACK
--echo #
}
if ($end_type == 2) {
--echo # 2.c) Create transaction, create temporary
--echo # table, end transaction with XA COMMIT
--echo # ONE PHASE
--echo #
}
SET @@SESSION.GTID_NEXT = 'ANONYMOUS';
XA START 'trx1';
CREATE TEMPORARY TABLE temp_table_1 (a INT);
XA END 'trx1';
if ($end_type == 0) {
XA PREPARE 'trx1';
SET @@SESSION.GTID_NEXT = 'AUTOMATIC';
}
if ($end_type == 1) {
XA PREPARE 'trx1';
SET @@SESSION.GTID_NEXT = 'AUTOMATIC';
}
if ($end_type == 2) {
XA COMMIT 'trx1' ONE PHASE;
SET @@SESSION.GTID_NEXT = 'AUTOMATIC';
}
--echo [connection verify]
--connection verify
--let $assert_cond= [SHOW STATUS LIKE "ONGOING_AUTOMATIC_GTID_VIOLATING_TRANSACTION_COUNT", Value, 1] = 0
--let $assert_text= There are no AUTOMATIC violating transactions
--source include/assert.inc
--let $assert_cond= [SHOW STATUS LIKE "ONGOING_ANONYMOUS_GTID_VIOLATING_TRANSACTION_COUNT", Value, 1] = 0
--let $assert_text= There are no ANONYMOUS violating transactions
--source include/assert.inc
--echo [connection default]
--connection default
if ($end_type == 0) {
XA COMMIT 'trx1';
}
if ($end_type == 1) {
XA ROLLBACK 'trx1';
}
DROP TEMPORARY TABLE IF EXISTS temp_table_1;
--inc $end_type
}
|