~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/t/innodb-semi-consistent.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- source include/not_embedded.inc
 
2
-- source include/have_innodb.inc
 
3
 
 
4
--disable_warnings
 
5
drop table if exists t1;
 
6
--enable_warnings
 
7
 
 
8
# basic tests of semi-consistent reads
 
9
 
 
10
connect (a,localhost,root,,);
 
11
connect (b,localhost,root,,);
 
12
connection a;
 
13
set binlog_format=mixed;
 
14
set session transaction isolation level repeatable read;
 
15
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
 
16
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
 
17
set autocommit=0;
 
18
# this should lock the entire table
 
19
select * from t1 where a=3 lock in share mode;
 
20
connection b;
 
21
set binlog_format=mixed;
 
22
set session transaction isolation level repeatable read;
 
23
set autocommit=0;
 
24
-- error ER_LOCK_WAIT_TIMEOUT
 
25
update t1 set a=10 where a=5;
 
26
connection a;
 
27
commit;
 
28
connection b;
 
29
# perform a semi-consisent read (and unlock non-matching rows)
 
30
set session transaction isolation level read committed;
 
31
update t1 set a=10 where a=5;
 
32
connection a;
 
33
-- error ER_LOCK_WAIT_TIMEOUT
 
34
select * from t1 where a=2 for update;
 
35
# this should lock the records (1),(2)
 
36
select * from t1 where a=2 limit 1 for update;
 
37
connection b;
 
38
# semi-consistent read will skip non-matching locked rows a=1, a=2
 
39
update t1 set a=11 where a=6;
 
40
-- error ER_LOCK_WAIT_TIMEOUT
 
41
update t1 set a=12 where a=2;
 
42
-- error ER_LOCK_WAIT_TIMEOUT
 
43
update t1 set a=13 where a=1;
 
44
connection a;
 
45
commit;
 
46
connection b;
 
47
update t1 set a=14 where a=1;
 
48
commit;
 
49
connection a;
 
50
select * from t1;
 
51
drop table t1;
 
52
 
 
53
connection default;
 
54
disconnect a;
 
55
disconnect b;
 
56
 
 
57
# Bug 39320
 
58
create table t1 (a int, b int) engine=myisam;
 
59
create table t2 (c int, d int, key (c)) engine=innodb;
 
60
insert into t1 values (1,1);
 
61
insert into t2 values (1,2);
 
62
connect (a,localhost,root,,);
 
63
connection a;
 
64
set session transaction isolation level read committed;
 
65
delete from t1 using t1 join t2 on t1.a = t2.c where t2.d in (1);
 
66
connection default;
 
67
disconnect a;
 
68
drop table t1, t2;