~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to mysql-test/t/tx_isolation_basic.test

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
################# mysql-test\t\tx_isolation_basic.test ########################
 
2
#                                                                             #
 
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 #
 
9
#                                                                             #
 
10
#                                                                             #
 
11
# Creation Date: 2008-02-07                                                   #
 
12
# Author:  Rizwan                                                             #
 
13
#                                                                             #
 
14
# Description: Test Cases of Dynamic System Variable tx_isolation             #
 
15
#              that checks the behavior of this variable in the following ways#
 
16
#              * Default Value                                                #
 
17
#              * Valid & Invalid values                                       #
 
18
#              * Scope & Access method                                        #
 
19
#              * Data Integrity                                               #
 
20
#                                                                             #
 
21
# Reference: http://dev.mysql.com/doc/refman/5.1/en/                          #
 
22
#  server-system-variables.html                                               #
 
23
#                                                                             #
 
24
###############################################################################
 
25
 
 
26
--source include/load_sysvars.inc
 
27
 
 
28
######################################################################## 
 
29
#                    START OF tx_isolation TESTS                       #
 
30
######################################################################## 
 
31
 
 
32
 
 
33
#########################################################################
 
34
#     Saving initial value of tx_isolation in a temporary variable      #
 
35
#########################################################################
 
36
 
 
37
SET @global_start_value = @@global.tx_isolation;
 
38
SELECT @global_start_value;
 
39
 
 
40
SET @session_start_value = @@session.tx_isolation;
 
41
SELECT @session_start_value;
 
42
 
 
43
--echo '#--------------------FN_DYNVARS_183_01------------------------#'
 
44
####################################################################
 
45
#                    Display the DEFAULT value of tx_isolation     #
 
46
####################################################################
 
47
 
 
48
SET @@global.tx_isolation = 'READ-UNCOMMITTED';
 
49
--Error ER_NO_DEFAULT
 
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.';
 
53
 
 
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.';
 
59
 
 
60
--echo '#---------------------FN_DYNVARS_183_02-------------------------#'
 
61
######################################################### 
 
62
#      Check if NULL or empty value is accepeted        #
 
63
######################################################### 
 
64
 
 
65
--Error ER_WRONG_VALUE_FOR_VAR
 
66
SET @@global.tx_isolation = NULL;
 
67
 
 
68
--Error ER_WRONG_VALUE_FOR_VAR
 
69
SET @@global.tx_isolation = '';
 
70
 
 
71
--Error ER_WRONG_VALUE_FOR_VAR
 
72
SET @@session.tx_isolation = NULL;
 
73
 
 
74
--Error ER_WRONG_VALUE_FOR_VAR
 
75
SET @@session.tx_isolation = '';
 
76
 
 
77
--echo '#--------------------FN_DYNVARS_183_03------------------------#'
 
78
#####################################################################
 
79
#              Change the value of tx_isolation to a valid value    #
 
80
#####################################################################
 
81
 
 
82
SET @@global.tx_isolation = 'READ-UNCOMMITTED';
 
83
SELECT @@global.tx_isolation;
 
84
 
 
85
SET @@global.tx_isolation = 'read-COMMITTED';
 
86
SELECT @@global.tx_isolation;
 
87
 
 
88
SET @@global.tx_isolation = 'REPEATABLE-READ';
 
89
SELECT @@global.tx_isolation;
 
90
 
 
91
SET @@global.tx_isolation = 'SERIALIZable';
 
92
SELECT @@global.tx_isolation;
 
93
 
 
94
 
 
95
SET @@session.tx_isolation = 'READ-UNCOMMITTED';
 
96
SELECT @@session.tx_isolation;
 
97
 
 
98
SET @@session.tx_isolation = 'READ-COMMITTED';
 
99
SELECT @@session.tx_isolation;
 
100
 
 
101
SET @@session.tx_isolation = 'REPEATABLE-READ';
 
102
SELECT @@session.tx_isolation;
 
103
 
 
104
SET @@session.tx_isolation = 'serializable';
 
105
SELECT @@session.tx_isolation;
 
106
 
 
107
 
 
108
--echo '#--------------------FN_DYNVARS_183_04-------------------------#'
 
109
#######################################################################
 
110
#               Change the value of tx_isolation to invalid value     #
 
111
#######################################################################
 
112
 
 
113
# for global scope
 
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;
 
118
 
 
119
 
 
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'
 
123
 
 
124
--Error ER_WRONG_VALUE_FOR_VAR
 
125
SET @@global.tx_isolation = OFF;
 
126
 
 
127
--Error ER_WRONG_VALUE_FOR_VAR
 
128
SET @@global.tx_isolation = ON;
 
129
 
 
130
--Error ER_WRONG_VALUE_FOR_VAR
 
131
SET @@global.tx_isolation = 'NON-SERIALIZABLE';
 
132
 
 
133
# for session scope
 
134
 
 
135
--Error ER_WRONG_VALUE_FOR_VAR
 
136
SET @@tx_isolation = -1;
 
137
--Error ER_WRONG_VALUE_FOR_VAR
 
138
SET @@tx_isolation = READUNCOMMITTED;
 
139
 
 
140
SET @@tx_isolation = 'REPEATABLE';
 
141
SELECT @@tx_isolation;
 
142
--echo 'Bug# 34833: REPEATABLE is not documented as as valid tx_isolation level'
 
143
 
 
144
--Error ER_WRONG_VALUE_FOR_VAR
 
145
SET @@tx_isolation = 'NONE';
 
146
--Error ER_WRONG_VALUE_FOR_VAR
 
147
SET @@tx_isolation = 'ALL';
 
148
 
 
149
--echo '#-------------------FN_DYNVARS_183_05----------------------------#'
 
150
######################################################################### 
 
151
#     Check if the value in session Table matches value in variable     #
 
152
#########################################################################
 
153
 
 
154
SELECT @@session.tx_isolation = VARIABLE_VALUE 
 
155
FROM INFORMATION_SCHEMA.SESSION_VARIABLES 
 
156
WHERE VARIABLE_NAME='tx_isolation';
 
157
 
 
158
--echo '#----------------------FN_DYNVARS_183_06------------------------#'
 
159
######################################################################### 
 
160
#     Check if the value in GLOBAL Table matches value in variable      #
 
161
#########################################################################
 
162
 
 
163
SELECT @@global.tx_isolation = VARIABLE_VALUE 
 
164
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
 
165
WHERE VARIABLE_NAME='tx_isolation';
 
166
 
 
167
 
 
168
--echo '#---------------------FN_DYNVARS_183_07-------------------------#'
 
169
################################################################### 
 
170
#        Check if numbers can be used on variable                 #
 
171
################################################################### 
 
172
 
 
173
# test if variable accepts 0,1,2
 
174
SET @@global.tx_isolation = 0;
 
175
SELECT @@global.tx_isolation;
 
176
 
 
177
SET @@global.tx_isolation = 1;
 
178
SELECT @@global.tx_isolation;
 
179
 
 
180
SET @@global.tx_isolation = 2;
 
181
SELECT @@global.tx_isolation;
 
182
 
 
183
SET @@global.tx_isolation = 3;
 
184
SELECT @@global.tx_isolation;
 
185
 
 
186
# use of decimal values
 
187
 
 
188
SET @@global.tx_isolation = 0.4;
 
189
SELECT @@global.tx_isolation;
 
190
 
 
191
SET @@global.tx_isolation = 1.1;
 
192
SELECT @@global.tx_isolation;
 
193
 
 
194
SET @@global.tx_isolation = 1.5;
 
195
SELECT @@global.tx_isolation;
 
196
 
 
197
SET @@global.tx_isolation = 2.9;
 
198
SELECT @@global.tx_isolation;
 
199
 
 
200
SET @@session.tx_isolation = 3.49;
 
201
SELECT @@session.tx_isolation;
 
202
 
 
203
--Error ER_WRONG_VALUE_FOR_VAR
 
204
SET @@session.tx_isolation = 3.6;
 
205
 
 
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.';
 
208
 
 
209
 
 
210
--echo '#---------------------FN_DYNVARS_183_08----------------------#'
 
211
################################################################### 
 
212
#      Check if TRUE and FALSE values can be used on variable     #
 
213
################################################################### 
 
214
 
 
215
SET @@global.tx_isolation = TRUE;
 
216
SELECT @@global.tx_isolation;
 
217
SET @@global.tx_isolation = FALSE;
 
218
SELECT @@global.tx_isolation;
 
219
 
 
220
--echo '#---------------------FN_DYNVARS_183_09----------------------#'
 
221
######################################################################## 
 
222
# Check if tx_isolation can be accessed with and without @@ sign       #
 
223
########################################################################
 
224
 
 
225
SET tx_isolation = 'REPEATABLE-READ';
 
226
 
 
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;
 
234
 
 
235
SET global tx_isolation = 'REPEATABLE-READ';
 
236
SELECT @@global.tx_isolation;
 
237
 
 
238
##############################
 
239
#   Restore initial value    #
 
240
##############################
 
241
 
 
242
SET @@global.tx_isolation = @global_start_value;
 
243
SELECT @@global.tx_isolation;
 
244
 
 
245
SET @@session.tx_isolation = @session_start_value;
 
246
SELECT @@session.tx_isolation;
 
247
 
 
248
####################################################################
 
249
#                    END OF tx_isolation TESTS                     #
 
250
####################################################################
 
251