~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to mysql-test/t/maria-mvcc.test

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Testing insert and select on a table with two threads
 
3
# using locking
 
4
#
 
5
 
 
6
-- source include/have_maria.inc
 
7
set global maria_page_checksum=1;
 
8
 
 
9
--disable_warnings
 
10
drop table if exists t1;
 
11
--enable_warnings
 
12
 
 
13
connect (con1,localhost,root,,);
 
14
connection con1;
 
15
 
 
16
create table t1 (i int) engine=maria;
 
17
show create table t1;
 
18
lock tables t1 write concurrent;
 
19
insert into t1 values (1);
 
20
insert into t1 values (2);
 
21
/* should see 1 and 2 */
 
22
select i from t1;
 
23
select count(*) from t1;
 
24
 
 
25
connect (con2,localhost,root,,);
 
26
connection con2;
 
27
/* should see nothing */
 
28
select i from t1;
 
29
select count(*) from t1;
 
30
lock tables t1 write concurrent;
 
31
insert into t1 values (3);
 
32
insert into t1 values (4);
 
33
/* should see 3 and 4 */
 
34
select i from t1;
 
35
select count(*) from t1;
 
36
unlock tables;
 
37
lock tables t1 write concurrent;
 
38
insert into t1 values (5);
 
39
/* should see 3, 4 and 5 */
 
40
select i from t1;
 
41
select count(*) from t1;
 
42
 
 
43
connect (con3,localhost,root,,);
 
44
connection con3;
 
45
lock tables t1 write concurrent;
 
46
/* should see 3, 4 */
 
47
select i from t1;
 
48
select count(*) from t1;
 
49
 
 
50
connection con1;
 
51
insert into t1 values (6);
 
52
/* Should see 1, 2, 6 */
 
53
select i from t1;
 
54
select count(*) from t1;
 
55
unlock tables;
 
56
lock tables t1 write concurrent;
 
57
/* Should see 1, 2, 3, 4 and 6 */
 
58
select i from t1;
 
59
select count(*) from t1;
 
60
 
 
61
connection con2;
 
62
/* should see 3, 4, 5 */
 
63
select i from t1;
 
64
select count(*) from t1;
 
65
unlock tables;
 
66
/* should see 1, 2, 3, 4, 5, 6 */
 
67
select i from t1;
 
68
select count(*) from t1;
 
69
 
 
70
connection con1;
 
71
unlock tables;
 
72
/* should see 1, 2, 3, 4, 5, 6 */
 
73
select i from t1;
 
74
select count(*) from t1;
 
75
 
 
76
connection con3;
 
77
insert into t1 values (7);
 
78
/* should see 3, 4, 7 */
 
79
select i from t1;
 
80
select count(*) from t1;
 
81
unlock tables;
 
82
/* should see 1, 2, 3, 4, 5, 6, 7 */
 
83
select i from t1;
 
84
select count(*) from t1;
 
85
 
 
86
connection default;
 
87
drop table t1;
 
88
 
 
89
#
 
90
# Test count(*) for not versioned tables
 
91
#
 
92
 
 
93
CREATE TABLE t1 (fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,    g GEOMETRY NOT NULL,   SPATIAL KEY(g) ) transactional=1 row_format=page engine=maria;
 
94
 
 
95
lock tables t1 write concurrent, t1 as t2 write concurrent;
 
96
insert into t1 (fid,g) values (NULL,GeomFromText('LineString(0 0,1 1)'));
 
97
select fid from t1 as t2;
 
98
select count(*) from t1 as t2;
 
99
insert into t1 (fid,g) values (NULL,GeomFromText('LineString(0 0,1 1)'));
 
100
select fid from t1 as t2;
 
101
select count(*) from t1 as t2;
 
102
unlock tables;
 
103
drop table t1;
 
104