Debian Codegraph @

mysql-test/suite/ndb/t/ndb_bug31477.test

raw
1 --source include/have_ndb.inc
2
3 --disable_warnings
4 drop table if exists t1;
5 --enable_warnings
6
7 # setup
8
9 connect (con1,localhost,root,,test);
10 connect (con2,localhost,root,,test);
11
12 # unique index
13 connection con1;
14 create table t1(a int primary key, b int, c int, unique(b)) engine = ndb;
15 insert into t1 values (2,2,2);
16 insert into t1 values (3,3,3);
17 insert into t1 values (4,4,4);
18
19 begin;
20 insert into t1 values (1,1,1);
21
22 connection con2;
23 begin;
24 --error 1205
25 update t1 set c = 2 where b = 1;
26 rollback;
27
28 connection con1;
29 rollback;
30 drop table t1;
31 # ordered index
32
33 connection con1;
34 create table t1(a int primary key, b int, c int, key(b)) engine = ndb;
35 insert into t1 values (2,2,2);
36 insert into t1 values (3,3,3);
37 insert into t1 values (4,4,4);
38
39 begin;
40 insert into t1 values (1,1,1);
41
42 connection con2;
43 begin;
44 --error 1205
45 update t1 set c = 2 where b = 1;
46 rollback;
47
48 connection con1;
49 rollback;
50 drop table t1;
51
52 # multiple versions
53
54 --echo --con1
55 connection con1;
56 create table t1(a int primary key, b int, c int, key(b)) engine = ndb;
57 insert into t1 values (1,1,1);
58 insert into t1 values (2,2,2);
59 insert into t1 values (3,3,3);
60 insert into t1 values (4,4,4);
61
62 begin;
63 update t1 set c = 10 where a = 1;
64 update t1 set c = 20 where a = 1;
65 update t1 set c = 30 where a = 1;
66
67 --echo --con1 c=30
68 select * from t1 where b >= 1 order by b;
69 --echo --con2 c=1
70 connection con2;
71 select * from t1 where b >= 1 order by b;
72
73 --echo --con1
74 connection con1;
75 delete from t1 where a = 1;
76
77 --echo --con1 c=none
78 select * from t1 where b >= 1 order by b;
79 --echo --con2 c=1
80 connection con2;
81 select * from t1 where b >= 1 order by b;
82
83 --echo --con1
84 connection con1;
85 commit;
86
87 --echo --con1 c=none
88 select * from t1 where b >= 1 order by b;
89 --echo --con2 c=none
90 connection con2;
91 select * from t1 where b >= 1 order by b;
92
93 --echo --con1
94 connection con1;
95 begin;
96 insert into t1 values (1,1,1);
97 update t1 set c = 10 where a = 1;
98 update t1 set c = 20 where a = 1;
99 update t1 set c = 30 where a = 1;
100
101 --echo --con1 c=30
102 select * from t1 where b >= 1 order by b;
103 --echo --con2 c=none
104 connection con2;
105 select * from t1 where b >= 1 order by b;
106
107 # this fails with "no such table" via con2 ???
108 connection con1;
109 drop table t1;