~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/mysql-test/innodb_bug38231.test

[patch 112/129] Merge patch for revision 1925 from InnoDB SVN:
revno: 1925
revision-id: svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6169
parent: svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:6163
committer: calvin
timestamp: Thu 2009-11-12 12:40:43 +0000
message:
  branches/zip: add test case for bug#46676
  
  This crash is reproducible with InnoDB plugin 1.0.4 + MySQL 5.1.37.
  But no longer reproducible after MySQL 5.1.38 (with plugin 1.0.5).
  Add test case to catch future regression.
added:
  mysql-test/innodb_bug46676.result 6169@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2Fmysql-test%2Finnodb_bug46676.result
  mysql-test/innodb_bug46676.test 6169@16c675df-0fcb-4bc9-8058-dcc011a37293:branches%2Fzip%2Fmysql-test%2Finnodb_bug46676.test
diff:
=== added file 'mysql-test/innodb_bug46676.result'

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#
2
 
# Bug#38231 Innodb crash in lock_reset_all_on_table() on TRUNCATE + LOCK / UNLOCK
3
 
# http://bugs.mysql.com/38231
4
 
#
5
 
 
6
 
 
7
 
SET storage_engine=InnoDB;
8
 
 
9
 
# we care only that the following SQL commands do not crash the server
10
 
 
11
 
DROP TABLE IF EXISTS bug38231;
12
 
CREATE TABLE bug38231 (a INT);
13
 
 
14
 
 
15
 
SET autocommit=0;
16
 
LOCK TABLE bug38231 WRITE;
17
 
 
18
 
SET autocommit=0;
19
 
LOCK TABLE bug38231 WRITE;
20
 
 
21
 
# When con1 does UNLOCK below this will release either con2 or con3 which are
22
 
# both waiting on LOCK. At the end we must first --reap and UNLOCK the
23
 
# connection that has been released, otherwise it will wait forever. We assume
24
 
# that the released connection will be the first one that has gained the LOCK,
25
 
# thus we force the order here - con2 does LOCK first, then con3. In other
26
 
# words we wait for LOCK from con2 above to be exected before doing LOCK in
27
 
# con3.
28
 
let $wait_condition =
29
 
  SELECT COUNT(*) = 1 FROM information_schema.processlist
30
 
  WHERE info = 'LOCK TABLE bug38231 WRITE';
31
 
# the above enables query log, re-disable it
32
 
 
33
 
SET autocommit=0;
34
 
LOCK TABLE bug38231 WRITE;
35
 
 
36
 
TRUNCATE TABLE bug38231;
37
 
 
38
 
# Wait for TRUNCATE and the other two LOCKs to be executed; without this,
39
 
# sometimes UNLOCK executes before them. We assume there are no other
40
 
# sessions executing at the same time with the same SQL commands.
41
 
let $wait_condition =
42
 
  SELECT COUNT(*) = 1 FROM information_schema.processlist
43
 
  WHERE info = 'TRUNCATE TABLE bug38231';
44
 
let $wait_condition =
45
 
  SELECT COUNT(*) = 2 FROM information_schema.processlist
46
 
  WHERE info = 'LOCK TABLE bug38231 WRITE';
47
 
# the above enables query log, re-disable it
48
 
 
49
 
# this crashes the server if the bug is present
50
 
UNLOCK TABLES;
51
 
 
52
 
# clean up
53
 
 
54
 
UNLOCK TABLES;
55
 
 
56
 
UNLOCK TABLES;
57
 
 
58
 
 
59
 
 
60
 
# test that TRUNCATE works with with row-level locks
61
 
 
62
 
 
63
 
INSERT INTO bug38231 VALUES (1), (10), (300);
64
 
 
65
 
 
66
 
SET autocommit=0;
67
 
SELECT * FROM bug38231 FOR UPDATE;
68
 
 
69
 
TRUNCATE TABLE bug38231;
70
 
 
71
 
COMMIT;
72
 
 
73
 
 
74
 
 
75
 
DROP TABLE bug38231;