mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / suite / innodb_plugin / t / innodb_bug12400341.test
blob2ecf30edfa793a7c774596f0bd1c0b7bc5a38221
1 # Test for bug #12400341: INNODB CAN LEAVE ORPHAN IBD FILES AROUND
3 -- source include/have_innodb_plugin.inc
5 if (`select count(*)=0 from information_schema.global_variables where variable_name = 'INNODB_TRX_RSEG_N_SLOTS_DEBUG'`)
7   --skip Test requires InnoDB built with UNIV_DEBUG definition.
10 # Don't test under valgrind, undo slots of the previous test might exist still
11 # and cause unstable result.
12 --source include/not_valgrind.inc
14 call mtr.add_suppression("InnoDB: Warning: cannot find a free slot for an undo log. Do you have too");
16 --disable_query_log
17 set @old_innodb_trx_rseg_n_slots_debug = @@innodb_trx_rseg_n_slots_debug;
18 set global innodb_trx_rseg_n_slots_debug = 32;
19 --enable_query_log
21 show variables like "max_connections";
22 show variables like "innodb_thread_concurrency";
23 show variables like "innodb_file_per_table";
25 --disable_warnings
26 drop database if exists mysqltest;
27 --enable_warnings
29 create database mysqltest;
30 CREATE TABLE mysqltest.transtable (id int unsigned NOT NULL PRIMARY KEY, val int DEFAULT 0) ENGINE=InnoDB;
32 --disable_query_log
34 # Insert in 1 transaction which needs over 1 page undo record to avoid the insert_undo cached,
35 # because the cached insert_undo can be reused at "CREATE TABLE" statement later.
37 START TRANSACTION;
38 let $c = 1024;
39 while ($c)
41   eval INSERT INTO mysqltest.transtable (id) VALUES ($c);
42   dec $c;
44 COMMIT;
46 let $c = 32;
47 while ($c)
49   # if failed at here, it might be shortage of file descriptors limit.
50   connect (con$c,localhost,root,,);
51   dec $c;
53 --enable_query_log
55 select count(*) from information_schema.processlist;
58 # fill the all undo slots
60 --disable_query_log
61 let $c = 32;
62 while ($c)
64   connection con$c;
65   START TRANSACTION;
66   eval UPDATE mysqltest.transtable SET val = 1 WHERE id = 33 - $c;
67   dec $c;
69 --enable_query_log
71 connection default;
73 --error ER_CANT_CREATE_TABLE
74 CREATE TABLE mysqltest.testtable (id int unsigned not null primary key) ENGINE=InnoDB;
76 select count(*) from information_schema.processlist;
78 --disable_query_log
79 let $c = 32;
80 while ($c)
82   connection con$c;
83   ROLLBACK;
84   dec $c;
86 --enable_query_log
88 connection default;
89 select count(*) from information_schema.processlist;
91 --disable_query_log
92 let $c = 32;
93 while ($c)
95   disconnect con$c;
96   dec $c;
98 --enable_query_log
101 # If the isolated .ibd file remained, the drop database should fail.
103 drop database mysqltest;
105 --disable_query_log
106 set global innodb_trx_rseg_n_slots_debug = @old_innodb_trx_rseg_n_slots_debug;
107 --enable_query_log