summaryrefslogtreecommitdiff
path: root/mysql-test/t/innodb_support_xa_func.test
blob: f1b6fe84fe143d7a1ad686425c2838daf2b634bd (plain)
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
################# mysql-test\t\innodb_support_xa_func.test  ###################
#                                                                             #
# Variable Name: innodb_support_xa                                            #
# Scope: GLOBAL | SESSION                                                     #
# Access Type: Dynamic                                                        #
# Data Type: boolean                                                          #
# Default Value: 1                                                            #
# Range: 0,1                                                                  #
#                                                                             #
#                                                                             #
# Creation Date: 2008-03-08                                                   #
# Author:  Rizwan                                                             #
#                                                                             #
# Description: Test Cases of Dynamic System Variable innodb_support_xa        #
#              that checks the behavior of this variable in the following ways#
#                                                                             #
# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
#  server-system-variables.html                                               #
#                                                                             #
###############################################################################

--source include/have_innodb.inc
--echo '#--------------------FN_DYNVARS_046_01-------------------------#'
####################################################################
# Check if setting innodb_support_xa is changed in new connection  # 
####################################################################

SET @@global.innodb_support_xa = OFF;
--echo 'connect (con1,localhost,root,,,,)'
connect (con1,localhost,root,,,,);
--echo 'connection con1'
connection con1;
SELECT @@global.innodb_support_xa;
SELECT @@session.innodb_support_xa;
disconnect con1;


--echo '#--------------------FN_DYNVARS_046_01-------------------------#'
###########################################################
# Begin the functionality Testing of innodb_support_xa    # 
###########################################################

--echo 'connection default'
connection default;
SET @@global.innodb_support_xa = 1;

--disable_warnings
drop table if exists t1, t2;
--enable_warnings

create table t1 (a int) engine=innodb;

#====================================================
--echo '---check when innodb_support_xa is 1---'
#====================================================


SET @@innodb_support_xa = 1;

xa start 'test1';
INSERT t1 values (10);
xa end 'test1';
xa prepare 'test1';
xa rollback 'test1';
SELECT * from t1;

#====================================================
--echo '---check when innodb_support_xa is 0---'
#====================================================

SET @@innodb_support_xa = 0;
#
xa start 'test1';
INSERT t1 values (10);
xa end 'test1';
xa prepare 'test1';
xa rollback 'test1';
SELECT * from t1;

#====================================================
--echo '------general xa testing--------'
#====================================================

SET @@global.innodb_support_xa = 1;
SET @@innodb_support_xa = 1;

xa start 'testa','testb';
INSERT t1 values (30);
--Error ER_XAER_RMFAIL
COMMIT;
xa end 'testa','testb';
--Error ER_XAER_RMFAIL
BEGIN;
--Error ER_XAER_RMFAIL
CREATE table t2 (a int);
--echo 'connect (con1,localhost,root,,,,)'
CONNECT (con1,localhost,root,,,,);
--echo 'connection con1'
connection con1;

--Error ER_XAER_DUPID
xa start 'testa','testb';
--Error ER_XAER_DUPID
xa start 'testa','testb', 123;

#        gtrid [ , bqual [ , formatID ] ]
xa start 0x7465737462, 0x2030405060, 0xb;
INSERT t1 values (40);
xa end 'testb',' 0@P`',11; 
xa prepare 'testb',0x2030405060,11; 

--Error ER_XAER_RMFAIL
START TRANSACTION;
xa recover;

# uncomment the line below when binlog will be able to prepare
#disconnect con1;

--echo 'connection default'
CONNECTION default;
xa prepare 'testa','testb'; 
xa recover;
--Error ER_XAER_NOTA
xa commit 'testb',0x2030405060,11;
xa commit 'testa','testb';

--echo 'connection con1'
CONNECTION con1;
xa rollback 'testb',0x2030405060,11; 

SELECT * from t1;

DROP table t1;

########################################################
# End of functionality Testing for innodb_support_xa   #
########################################################