~stewart/drizzle/embedded-innodb-create-select-transaction-arrgh

« back to all changes in this revision

Viewing changes to mysql-test/t/flush_read_lock_kill.test

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Let's see if FLUSH TABLES WITH READ LOCK can be killed when waiting
 
2
# for running commits to finish (in the past it could not)
 
3
# This will not be a meaningful test on non-debug servers so will be
 
4
# skipped.
 
5
# If running mysql-test-run --debug, the --debug added by
 
6
# mysql-test-run to the mysqld command line will override the one of
 
7
# -master.opt. But this test is designed to still pass then (though it
 
8
# won't test anything interesting).
 
9
 
 
10
# This also won't work with the embedded server test
 
11
-- source include/not_embedded.inc
 
12
 
 
13
-- source include/have_debug.inc
 
14
 
 
15
# Disable concurrent inserts to avoid test failures when reading the
 
16
# connection id which was inserted into a table by another thread.
 
17
set @old_concurrent_insert= @@global.concurrent_insert;
 
18
set @@global.concurrent_insert= 0;
 
19
 
 
20
connect (con1,localhost,root,,);
 
21
connect (con2,localhost,root,,);
 
22
connection con1;
 
23
 
 
24
--disable_warnings
 
25
drop table if exists t1;
 
26
--enable_warnings
 
27
create table t1 (kill_id int);
 
28
insert into t1 values(connection_id());
 
29
 
 
30
# Thanks to the parameter we passed to --debug, this FLUSH will
 
31
# block on a debug build running with our --debug=make_global... It
 
32
# will block until killed. In other cases (non-debug build or other
 
33
# --debug) it will succeed immediately
 
34
 
 
35
connection con1;
 
36
send flush tables with read lock;
 
37
 
 
38
# kill con1
 
39
connection con2;
 
40
select ((@id := kill_id) - kill_id) from t1; 
 
41
 
 
42
# Wait for the debug sync point, test won't run on non-debug
 
43
# builds anyway.
 
44
let $wait_condition=
 
45
  select count(*) = 1 from information_schema.processlist
 
46
  where state = "Waiting for all running commits to finish"
 
47
  and info = "flush tables with read lock";
 
48
--source include/wait_condition.inc
 
49
 
 
50
kill connection @id;
 
51
 
 
52
connection con1;
 
53
# On debug builds it will be error 1053 (killed); on non-debug, or
 
54
# debug build running without our --debug=make_global..., will be
 
55
# error 0 (no error). The only important thing to test is that on
 
56
# debug builds with our --debug=make_global... we don't hang forever.
 
57
--error 0,1053,2013
 
58
reap;
 
59
 
 
60
connection con2;
 
61
drop table t1;
 
62
connection default;
 
63
 
 
64
# Restore global concurrent_insert value
 
65
set @@global.concurrent_insert= @old_concurrent_insert;