1
################# mysql-test\t\tx_isolation_basic.test ########################
3
# Variable Name: tx_isolation #
4
# Scope: GLOBAL | SESSION #
5
# Access Type: Dynamic #
6
# Data Type: enumeration #
7
# Default Value: REPEATABLE-READ #
8
# Valid Values: READ-UNCOMMITTED, READCOMMITTED, REPEATABLE-READ,SERIALIZABLE #
11
# Creation Date: 2008-02-07 #
14
# Description: Test Cases of Dynamic System Variable tx_isolation #
15
# that checks the behavior of this variable in the following ways#
17
# * Valid & Invalid values #
18
# * Scope & Access method #
21
# Reference: http://dev.mysql.com/doc/refman/5.1/en/ #
22
# server-system-variables.html #
24
###############################################################################
26
--source include/load_sysvars.inc
28
########################################################################
29
# START OF tx_isolation TESTS #
30
########################################################################
33
#########################################################################
34
# Saving initial value of tx_isolation in a temporary variable #
35
#########################################################################
37
SET @global_start_value = @@global.tx_isolation;
38
SELECT @global_start_value;
40
SET @session_start_value = @@session.tx_isolation;
41
SELECT @session_start_value;
43
--echo '#--------------------FN_DYNVARS_183_01------------------------#'
44
####################################################################
45
# Display the DEFAULT value of tx_isolation #
46
####################################################################
48
SET @@global.tx_isolation = 'READ-UNCOMMITTED';
50
SET @@global.tx_isolation = DEFAULT;
51
--echo 'Bug# 34878: Documentation specifies a DEFAULT value of REPEATABLE-READ';
52
--echo 'where as DEFAULT is not supported here.';
54
SET @@session.tx_isolation = 'SERIALIZABLE';
55
SET @@session.tx_isolation = DEFAULT;
56
SELECT @@session.tx_isolation;
57
--echo 'Bug# 34876: Documentation specifies a DEFAULT value of REPEATABLE-READ';
58
--echo 'where as DEFAULT here as no effect.';
60
--echo '#---------------------FN_DYNVARS_183_02-------------------------#'
61
#########################################################
62
# Check if NULL or empty value is accepeted #
63
#########################################################
65
--Error ER_WRONG_VALUE_FOR_VAR
66
SET @@global.tx_isolation = NULL;
68
--Error ER_WRONG_VALUE_FOR_VAR
69
SET @@global.tx_isolation = '';
71
--Error ER_WRONG_VALUE_FOR_VAR
72
SET @@session.tx_isolation = NULL;
74
--Error ER_WRONG_VALUE_FOR_VAR
75
SET @@session.tx_isolation = '';
77
--echo '#--------------------FN_DYNVARS_183_03------------------------#'
78
#####################################################################
79
# Change the value of tx_isolation to a valid value #
80
#####################################################################
82
SET @@global.tx_isolation = 'READ-UNCOMMITTED';
83
SELECT @@global.tx_isolation;
85
SET @@global.tx_isolation = 'read-COMMITTED';
86
SELECT @@global.tx_isolation;
88
SET @@global.tx_isolation = 'REPEATABLE-READ';
89
SELECT @@global.tx_isolation;
91
SET @@global.tx_isolation = 'SERIALIZable';
92
SELECT @@global.tx_isolation;
95
SET @@session.tx_isolation = 'READ-UNCOMMITTED';
96
SELECT @@session.tx_isolation;
98
SET @@session.tx_isolation = 'READ-COMMITTED';
99
SELECT @@session.tx_isolation;
101
SET @@session.tx_isolation = 'REPEATABLE-READ';
102
SELECT @@session.tx_isolation;
104
SET @@session.tx_isolation = 'serializable';
105
SELECT @@session.tx_isolation;
108
--echo '#--------------------FN_DYNVARS_183_04-------------------------#'
109
#######################################################################
110
# Change the value of tx_isolation to invalid value #
111
#######################################################################
114
--Error ER_WRONG_VALUE_FOR_VAR
115
SET @@global.tx_isolation = -1;
116
--Error ER_WRONG_VALUE_FOR_VAR
117
SET @@global.tx_isolation = READUNCOMMITTED;
120
SET @@global.tx_isolation = 'REPEATABLE';
121
SELECT @@global.tx_isolation;
122
--echo 'Bug# 34833: REPEATABLE is not documented as as valid tx_isolation level'
124
--Error ER_WRONG_VALUE_FOR_VAR
125
SET @@global.tx_isolation = OFF;
127
--Error ER_WRONG_VALUE_FOR_VAR
128
SET @@global.tx_isolation = ON;
130
--Error ER_WRONG_VALUE_FOR_VAR
131
SET @@global.tx_isolation = 'NON-SERIALIZABLE';
135
--Error ER_WRONG_VALUE_FOR_VAR
136
SET @@tx_isolation = -1;
137
--Error ER_WRONG_VALUE_FOR_VAR
138
SET @@tx_isolation = READUNCOMMITTED;
140
SET @@tx_isolation = 'REPEATABLE';
141
SELECT @@tx_isolation;
142
--echo 'Bug# 34833: REPEATABLE is not documented as as valid tx_isolation level'
144
--Error ER_WRONG_VALUE_FOR_VAR
145
SET @@tx_isolation = 'NONE';
146
--Error ER_WRONG_VALUE_FOR_VAR
147
SET @@tx_isolation = 'ALL';
149
--echo '#-------------------FN_DYNVARS_183_05----------------------------#'
150
#########################################################################
151
# Check if the value in session Table matches value in variable #
152
#########################################################################
154
SELECT @@session.tx_isolation = VARIABLE_VALUE
155
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
156
WHERE VARIABLE_NAME='tx_isolation';
158
--echo '#----------------------FN_DYNVARS_183_06------------------------#'
159
#########################################################################
160
# Check if the value in GLOBAL Table matches value in variable #
161
#########################################################################
163
SELECT @@global.tx_isolation = VARIABLE_VALUE
164
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
165
WHERE VARIABLE_NAME='tx_isolation';
168
--echo '#---------------------FN_DYNVARS_183_07-------------------------#'
169
###################################################################
170
# Check if numbers can be used on variable #
171
###################################################################
173
# test if variable accepts 0,1,2
174
SET @@global.tx_isolation = 0;
175
SELECT @@global.tx_isolation;
177
SET @@global.tx_isolation = 1;
178
SELECT @@global.tx_isolation;
180
SET @@global.tx_isolation = 2;
181
SELECT @@global.tx_isolation;
183
SET @@global.tx_isolation = 3;
184
SELECT @@global.tx_isolation;
186
# use of decimal values
188
SET @@global.tx_isolation = 0.4;
189
SELECT @@global.tx_isolation;
191
SET @@global.tx_isolation = 1.1;
192
SELECT @@global.tx_isolation;
194
SET @@global.tx_isolation = 1.5;
195
SELECT @@global.tx_isolation;
197
SET @@global.tx_isolation = 2.9;
198
SELECT @@global.tx_isolation;
200
SET @@session.tx_isolation = 3.49;
201
SELECT @@session.tx_isolation;
203
--Error ER_WRONG_VALUE_FOR_VAR
204
SET @@session.tx_isolation = 3.6;
206
--echo 'Bug: Decimal values can be used within the range [0.0-3.5).';
207
--echo 'Values are rounded to 0,1,2,3 as evident from outcome.';
210
--echo '#---------------------FN_DYNVARS_183_08----------------------#'
211
###################################################################
212
# Check if TRUE and FALSE values can be used on variable #
213
###################################################################
215
SET @@global.tx_isolation = TRUE;
216
SELECT @@global.tx_isolation;
217
SET @@global.tx_isolation = FALSE;
218
SELECT @@global.tx_isolation;
220
--echo '#---------------------FN_DYNVARS_183_09----------------------#'
221
########################################################################
222
# Check if tx_isolation can be accessed with and without @@ sign #
223
########################################################################
225
SET tx_isolation = 'REPEATABLE-READ';
227
--Error ER_PARSE_ERROR
228
SET session.tx_isolation = 'REPEATABLE-READ';
229
--Error ER_PARSE_ERROR
230
SET global.tx_isolation = 'REPEATABLE-READ';
231
#using SET SESSION|GLOBAL syntax
232
SET session tx_isolation = 'REPEATABLE-READ';
233
SELECT @@tx_isolation;
235
SET global tx_isolation = 'REPEATABLE-READ';
236
SELECT @@global.tx_isolation;
238
##############################
239
# Restore initial value #
240
##############################
242
SET @@global.tx_isolation = @global_start_value;
243
SELECT @@global.tx_isolation;
245
SET @@session.tx_isolation = @session_start_value;
246
SELECT @@session.tx_isolation;
248
####################################################################
249
# END OF tx_isolation TESTS #
250
####################################################################