1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,;
connection master;
CREATE DATABASE connect;
connection slave;
CREATE DATABASE connect;
connection default;
#
# Checking thread TBL tables
#
CREATE TABLE t1 (a int, b char(10));
INSERT INTO t1 VALUES (0,'test00'),(1,'test01'),(2,'test02'),(3,'test03');
SELECT * FROM t1;
a b
0 test00
1 test01
2 test02
3 test03
connection master;
CREATE TABLE rt2 (a int, b char(10));
INSERT INTO rt2 VALUES (4,'test04'),(5,'test05'),(6,'test06'),(7,'test07');
SELECT * FROM rt2;
a b
4 test04
5 test05
6 test06
7 test07
connection slave;
USE test;
CREATE TABLE rt3 (a int, b char(10));
INSERT INTO rt3 VALUES (8,'test08'),(9,'test09'),(10,'test10'),(11,'test11');
SELECT * FROM rt3;
a b
8 test08
9 test09
10 test10
11 test11
CREATE TABLE rt4 (a int, b char(10));
INSERT INTO rt4 VALUES (12,'test12'),(13,'test13'),(14,'test14'),(15,'test15');
SELECT * FROM rt4;
a b
12 test12
13 test13
14 test14
15 test15
CREATE TABLE rt5 (a int, b char(10));
INSERT INTO rt5 VALUES (16,'test16'),(17,'test17'),(18,'test18'),(19,'test19');
SELECT * FROM rt5;
a b
16 test16
17 test17
18 test18
19 test19
connection default;
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:MASTER_PORT/test/rt2';
SELECT * FROM t2;
a b
4 test04
5 test05
6 test06
7 test07
CREATE TABLE t3 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/rt3';
SELECT * FROM t3;
a b
8 test08
9 test09
10 test10
11 test11
CREATE TABLE t4 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/rt4';
SELECT * FROM t4;
a b
12 test12
13 test13
14 test14
15 test15
CREATE TABLE t5 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/rt5';
SELECT * FROM t5;
a b
16 test16
17 test17
18 test18
19 test19
CREATE TABLE total (a int, b char(10))
ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4,t5'
OPTION_LIST='thread=yes,port=PORT';
set connect_xtrace=1;
SELECT * FROM total order by a desc;
a b
19 test19
18 test18
17 test17
16 test16
15 test15
14 test14
13 test13
12 test12
11 test11
10 test10
9 test09
8 test08
7 test07
6 test06
5 test05
4 test04
3 test03
2 test02
1 test01
0 test00
set connect_xtrace=0;
connection master;
DROP TABLE rt2;
connection slave;
DROP TABLE rt3,rt4,rt5;
connection default;
DROP TABLE t1,t2,t3,t4,t5,total;
#
# Old thread TBL tables test modified
#
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 11 as v' OPTION_LIST='port=MASTER_PORT';
SELECT * FROM t1;
v
11
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 22 as v' OPTION_LIST='port=SLAVE_PORT';
SELECT * FROM t2;
v
22
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
set connect_xtrace=1;
SELECT * FROM total order by v desc;
v
22
11
set connect_xtrace=0;
DROP TABLE t1,t2,total;
#
# Old thread TBL tables test not modified (suppressed until MDEV-10179 is fixed)
#
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 11 as v';
SELECT * FROM t1;
v
11
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 22 as v';
SELECT * FROM t2;
v
22
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
set connect_xtrace=1;
SELECT * FROM total order by v desc;
v
22
11
set connect_xtrace=0;
DROP TABLE total;
DROP TABLE t1;
DROP TABLE t2;
connection master;
DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect;
connection slave;
DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect;
|