mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / mysql-test / t / flush_table.test
blob50e7e91419ab704be555f0105b8d800f9e36e880
1 # TODO: Only run this if we have privilege to do flush table
4 # Test of flush table
7 # Should work in embedded server after mysqltest is fixed
8 -- source include/not_embedded.inc
9 --disable_warnings
10 drop table if exists t1,t2;
11 --enable_warnings
12 create table t1 (a int not null auto_increment primary key);
13 insert into t1 values(0);
15 # Test for with read lock + flush
17 lock table t1 read;
18 flush table t1;
19 check table t1;
20 unlock tables;
22 # Test for with 2 read lock in different thread + flush
24 lock table t1 read;
25 connect (locker,localhost,root,,test);
26 connection locker;
27 lock table t1 read;
28 connection default;
29 send flush table t1;
30 connection locker;
31 --sleep 2
32 select * from t1;
33 unlock tables;
34 connection default;
35 reap;
36 select * from t1;
37 unlock tables;
39 # Test for with a write lock and a waiting read lock + flush
41 lock table t1 write;
42 connection locker;
43 send lock table t1 read;
44 connection default;
45 sleep 2;
46 flush table t1;
47 select * from t1;
48 unlock tables;
49 connection locker;
50 reap;
51 unlock tables;
52 connection default;
54 # Test for with a read lock and a waiting write lock + flush
56 lock table t1 read;
57 connection locker;
58 send lock table t1 write;
59 connection default;
60 sleep 2;
61 flush table t1;
62 select * from t1;
63 unlock tables;
64 connection locker;
65 reap;
66 unlock tables;
67 select * from t1;
68 connection default;
69 drop table t1;
70 disconnect locker;
73 # In the following test FLUSH TABLES produces a deadlock
74 # (hang forever) if the fix for BUG #3565 is missing.
75 # And it shows that handler tables are re-opened after flush (BUG #4286).
77 create table t1(table_id char(20) primary key);
78 create table t2(table_id char(20) primary key);
79 insert into t1 values ('test.t1');
80 insert into t1 values ('');
81 insert into t2 values ('test.t2');
82 insert into t2 values ('');
83 handler t1 open as a1;
84 handler t1 open as a2;
85 handler t2 open;
86 handler a1 read first limit 9;
87 handler a2 read first limit 9;
88 handler t2 read first limit 9;
89 flush tables;
90 handler a1 read first limit 9;
91 handler a2 read first limit 9;
92 handler t2 read first limit 9;
94 --error 1066
95 handler t1 open as a1;
96 --error 1066
97 handler t1 open as a2;
98 --error 1066
99 handler t2 open;
100 handler a1 read first limit 9;
101 handler a2 read first limit 9;
102 handler t2 read first limit 9;
103 flush table t1;
104 handler a1 read first limit 9;
105 handler a2 read first limit 9;
106 handler t2 read first limit 9;
107 flush table t2;
108 handler t2 close;
109 drop table t1;
110 drop table t2;
113 # The fix for BUG #4286 cannot restore the position after a flush.
115 create table t1(table_id char(20) primary key);
116 insert into t1 values ('Record-01');
117 insert into t1 values ('Record-02');
118 insert into t1 values ('Record-03');
119 insert into t1 values ('Record-04');
120 insert into t1 values ('Record-05');
121 handler t1 open;
122 handler t1 read first limit 1;
123 handler t1 read next limit 1;
124 handler t1 read next limit 1;
125 flush table t1;
126 handler t1 read next limit 1;
127 handler t1 read next limit 1;
128 handler t1 close;
129 drop table t1;
132 # Bug #11934 Two sequential FLUSH TABLES WITH READ LOCK hangs client
134 FLUSH TABLES WITH READ LOCK ;
135 FLUSH TABLES WITH READ LOCK ;
136 UNLOCK TABLES;
138 # End of 4.1 tests