~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Jay Pipes
  • Date: 2009-09-15 21:01:42 UTC
  • mto: (1126.2.5 merge)
  • mto: This revision was merged to the branch mainline in revision 1128.
  • Revision ID: jpipes@serialcoder-20090915210142-x8mwiqn1q0vzjspp
Moves Alter_info out into its own header and source file, cleans up some related include mess in sql_lex.h, and renames Alter_info to AlterInfo.

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;