This file is indexed.

/usr/lib/mysql-testsuite/t/commit.test is in percona-xtradb-cluster-testsuite-5.5 5.5.34-25.9+dfsg-0ubuntu4.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
--source include/have_innodb.inc

connect (con1,localhost,root,,);

--echo #
--echo # Bug#20837 Apparent change of isolation level 
--echo #           during transaction
--echo #
--echo # Bug#53343 completion_type=1, COMMIT/ROLLBACK 
--echo #           AND CHAIN don't preserve the isolation 
--echo #           level
#
# A set of test cases that verifies operation of
# transaction isolation level and chaining is 
# provided

# init
--echo connection default;
connection default;

SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
CREATE TABLE t1 (s1 INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
COMMIT;

#
# Verify that SET TRANS ISO LEVEL is not allowed 
# inside a transaction
#
START TRANSACTION;
--error ER_CANT_CHANGE_TX_ISOLATION
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
COMMIT;

#
# Verify consistent output from 
# SELECT @@tx_isolation  (Bug#20837)
#
# The transaction will be in READ UNCOMMITTED mode,
# but SELECT @@tx_isolation should report the session
# value, which is REPEATABLE READ
#
SET @@autocommit=0;
COMMIT;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
START TRANSACTION;
SELECT @@tx_isolation;
--echo Should be REPEATABLE READ
SELECT * FROM t1;
SELECT @@tx_isolation;
--echo Should be REPEATABLE READ
INSERT INTO t1 VALUES (-1);
SELECT @@tx_isolation;
--echo Should be REPEATABLE READ
COMMIT;

#
# Verify that a change in the session variable
# does not affect the currently started
# transaction
#
START TRANSACTION;
SELECT * FROM t1;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;

--echo connection con1
connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1000);
COMMIT;

--echo connection default
connection default;
--echo We should not be able to read the '1000'
SELECT * FROM t1;
COMMIT;

--echo Now, the '1000' should appear.
START TRANSACTION;
SELECT * FROM t1;
COMMIT;

# restore the session value
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;

#
# A set of test cases for verification that
# isolation level during chaining works. MySQL
# has three variants of chaining, i.e
# COMMIT AND CHAIN, ROLLBACK AND CHAIN, and
# the use of @completion_type
#

#
# Verify isolation level with COMMIT AND CHAIN
#
# COMMIT AND CHAIN causes a new transaction to
# begin as soon as the current ends, and the new
# transaction will have the same tran. iso. level
# as the first.
#
--echo connection default
connection default;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;

--echo connection con1
connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;

--echo connection default
connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1001;
--echo Should be 1
COMMIT AND CHAIN;

--echo connection con1
connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;

--echo connection default
connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1002;
--echo Should be 1
COMMIT;
SELECT * FROM t1;
DELETE FROM t1 WHERE s1 >= 1000;
COMMIT;

#
# Verify isolation level with ROLLBACK AND CHAIN
#
--echo connection default
connection default;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;

--echo connection con1
connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;

--echo connection default
connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1001;
--echo Should be 1
ROLLBACK AND CHAIN;

--echo connection con1
connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;

--echo connection default
connection default;
SELECT COUNT(*) FROM t1 WHERE s1 = 1002;
--echo Should be 1
COMMIT;
SELECT * FROM t1;
DELETE FROM t1 WHERE s1 >= 1000;
COMMIT;

#
# Verify isolation level with @completion_type=1.
# (A @@completion_type value of 1 is equivalentl to 
# explicitly adding "AND CHAIN" to COMMIT or ROLLBACK)
#

#
# Verify that COMMIT AND NO CHAIN  overrides the value
# of @@completion_type
#
SET @@completion_type=1;

--echo connection default
connection default;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;

--echo connection con1
connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;

--echo connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
--echo Should see 1001
COMMIT AND NO CHAIN;
--echo default transaction is now in REPEATABLE READ

--echo connection con1
connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;

--echo connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
--echo Should see 1001 and 1002

--echo connection con1
connection con1;
INSERT INTO t1 VALUES (1003);
COMMIT;

--echo connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
--echo Should see 1001 and 1002, but NOT 1003
COMMIT;

SELECT * FROM t1;
DELETE FROM t1 WHERE s1 >= 1000;
COMMIT AND NO CHAIN;
SET @@completion_type=0;
COMMIT;

#
# Verify that ROLLBACK AND NO CHAIN  overrides the value
# of @@completion_type
#
--echo connection default
connection default;
SET @@completion_type=1;
COMMIT AND NO CHAIN;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;

--echo connection con1
connection con1;
START TRANSACTION;
INSERT INTO t1 VALUES (1001);
COMMIT;

--echo connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
--echo Should see 1001
ROLLBACK AND NO CHAIN;
--echo default transaction is now in REPEATABLE READ

--echo connection con1
connection con1;
INSERT INTO t1 VALUES (1002);
COMMIT;

--echo connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
--echo Should see 1001 and 1002

--echo connection con1
connection con1;
INSERT INTO t1 VALUES (1003);
COMMIT;

--echo connection default
connection default;
SELECT * FROM t1 WHERE s1 >= 1000;
--echo Should see 1001 and 1002, but NOT 1003

COMMIT;
SELECT * FROM t1;
DELETE FROM t1 WHERE s1 >= 1000;
COMMIT AND NO CHAIN;
SET @@completion_type=0;
COMMIT;

#
# Verify that in the sequence:
#  SET TRANSACTION ISOLATION LEVEL
#  SET SESSION ISOLATION LEVEL
#
# SET SESSION ISOLATION LEVEL has precedence over 
# SET TRANSACTION.  (Note that this is _not_ 
# in accordance with ISO 9075.)
#
--echo connection default
connection default;

SET TRANSACTION ISOLATION LEVEL	READ COMMITTED;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
START TRANSACTION;
SELECT * FROM t1;

--echo connection con1
connection con1;
INSERT INTO t1 VALUES (1000);
COMMIT;

--echo connection default
connection default;
SELECT * FROM t1;
--echo Should get same result as above (i.e should not read '1000')
COMMIT;

DELETE FROM t1 WHERE s1 >= 1000;
COMMIT;


#
# Verify that a transaction ended with an
# implicit commit (i.e a DDL statement), the
# @@completetion_type setting is ignored, and
# the next transaction's isolation level is
# the session level.
#
SET @@completion_type=1;
COMMIT AND NO CHAIN;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION;
TRUNCATE TABLE t1;
INSERT INTO t1 VALUES (1000);
SELECT * FROM t1;
--echo Should read '1000'

--echo connection con1
connection con1;
INSERT INTO t1 VALUES (1001);
COMMIT;

--echo connection default
connection default;
SELECT * FROM t1;
--echo Should only read the '1000' as this transaction is now in REP READ
COMMIT AND NO CHAIN;

SET @@completion_type=0;
COMMIT AND NO CHAIN;


#
# Cleanup
#
SET @autocommit=1;
COMMIT;

disconnect con1;

DROP TABLE t1;

--echo #
--echo # End of test cases for Bug#20837
--echo #