summaryrefslogtreecommitdiff
path: root/storage/spider/mysql-test/spider/r/spider_fixes_part.result
blob: 571af94c1f2f10e9f4f7a2f61ad390b604be1970 (plain)
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3
for slave1_1

drop and create databases
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
connection slave1_1;
DROP DATABASE IF EXISTS auto_test_local;
CREATE DATABASE auto_test_local;
USE auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
connection child2_2;
DROP DATABASE IF EXISTS auto_test_remote2;
CREATE DATABASE auto_test_remote2;
USE auto_test_remote2;

test select 1
connection master_1;
SELECT 1;
1
1
connection master_1;
DROP TABLE IF EXISTS tb_l;
CREATE TABLE tb_l (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE2 MASTER_1_CHARSET2
INSERT INTO tb_l (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
(3, 'e', '2007-06-04 20:03:11'),
(4, 'd', '2003-11-30 05:01:03'),
(5, 'c', '2001-12-31 23:59:59');

2.17
partition with sort
connection master_1;
CREATE TABLE ta_l2 (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2 WHERE a > 1
ORDER BY a;
a	b	date_format(c, '%Y-%m-%d %H:%i:%s')
2	b	2000-01-01 00:00:00
3	e	2007-06-04 20:03:11
4	d	2003-11-30 05:01:03
5	c	2001-12-31 23:59:59

2.23
partition update with moving partition
connection master_1;
DROP TABLE IF EXISTS ta_l2;
connection master_1;
CREATE TABLE ta_l2 (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
INSERT INTO ta_l2 (a, b, c) VALUES (3, 'B', '2010-09-26 00:00:00');
UPDATE ta_l2 SET a = 4 WHERE a = 3;
SELECT a, b, date_format(c, '%Y-%m-%d %H:%i:%s') FROM ta_l2;
a	b	date_format(c, '%Y-%m-%d %H:%i:%s')
4	B	2010-09-26 00:00:00
index merge with partition
connection master_1;
DROP TABLE IF EXISTS ta_l_int;
connection master_1;
CREATE TABLE ta_l_int (
a INT AUTO_INCREMENT,
b INT DEFAULT 10,
c INT DEFAULT 11,
PRIMARY KEY(a),
KEY idx1(b),
KEY idx2(c)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT3_P_2_1
INSERT INTO ta_l_int (a, b, c) VALUES (1, 2, 3);
INSERT INTO ta_l_int (a, b, c) SELECT a + 1, b + 1, c + 1 FROM ta_l_int;
INSERT INTO ta_l_int (a, b, c) SELECT a + 2, b + 2, c + 2 FROM ta_l_int;
INSERT INTO ta_l_int (a, b, c) SELECT a + 4, b + 4, c + 4 FROM ta_l_int;
INSERT INTO ta_l_int (a, b, c) SELECT a + 8, b + 8, c + 8 FROM ta_l_int;
connection master_1;
SELECT a, b, c FROM ta_l_int force index(primary, idx1, idx2)
WHERE a = 5 OR b = 5 OR c = 5 ORDER BY a;
a	b	c
3	4	5
4	5	6
5	6	7

2.26
auto_increment with partition
connection master_1;
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_INCREMENT1_P_1
MASTER_1_AUTO_INCREMENT_INCREMENT2
MASTER_1_AUTO_INCREMENT_OFFSET2
spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
'srv "s_2_1"')
1
spider_direct_sql('SET SESSION AUTO_INCREMENT_INCREMENT = 4', '',
'srv "s_2_2"')
1
spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 2', '',
'srv "s_2_1"')
1
spider_bg_direct_sql('SET SESSION AUTO_INCREMENT_OFFSET = 3', '',
'srv "s_2_2"')
1
CREATE TABLE t1 (
id int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id)
) SLAVE1_1_ENGINE SLAVE1_1_CHARSET SLAVE1_1_COMMENT_INCREMENT1_P_1
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
777
SELECT MAX(id) FROM t1;
MAX(id)
777
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1554
SELECT MAX(id) FROM t1;
MAX(id)
1554
INSERT INTO t1 (id) VALUES (null);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
2331
SELECT MAX(id) FROM t1;
MAX(id)
2331
INSERT INTO t1 (id) VALUES (null);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
3108
SELECT MAX(id) FROM t1;
MAX(id)
3108
INSERT INTO t1 () VALUES (),(),(),();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
3885
SELECT id FROM t1 ORDER BY id;
id
777
1554
2331
3108
3885
4662
5439
6216
SET INSERT_ID=5000;
INSERT INTO t1 () VALUES ();
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5000
SELECT MAX(id) FROM t1;
MAX(id)
6216
INSERT INTO t1 (id) VALUES (10000);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5000
SELECT MAX(id) FROM t1;
MAX(id)
10000
INSERT INTO t1 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
5000
SELECT MAX(id) FROM t1;
MAX(id)
10000
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
777
1000
1554
2331
3108
3885
4662
5000
5439
6216
10000
connection master_1;

Test ORDER BY with LIMIT and OFFSET
connection master_1;
CREATE TABLE ta_ob (
a VARCHAR(50) NOT NULL,
b VARCHAR(50) NULL DEFAULT NULL,
c VARCHAR(100) NULL DEFAULT NULL,
d DATETIME(0) NULL DEFAULT NULL,
e INT(11) NOT NULL,
f INT(10) NULL DEFAULT NULL,
PRIMARY KEY (a, e)
) ENGINE=Spider COMMENT='database "auto_test_remote", table "ta_ob"'
  PARTITION BY LIST COLUMNS (e) PARTITIONS 1
(PARTITION pt1 values in (510411) COMMENT = 'srv "s_2_1"')
INSERT INTO ta_ob VALUES ('0B95CD65DF994BC9A09A6AABE53A2733',
'6CFED89FF6A84C7AA55C3C432663D094',
'51041110620304', '2018-08-02 13:41:13',
510411, 1);
INSERT INTO ta_ob VALUES ('15E8D55EF099443BAEE639E60A4650BD',
'879DC2A0B6AC46D9A62E8EA47E2970F2',
'51041110620301', NULL,
510411, 0);
INSERT INTO ta_ob VALUES ('51ECF2C0CD3C48D99C91792E99D3C1A0',
'017B8A460DBC444682B791305EF75356',
'51041110620308', '2018-08-02 13:48:29',
510411, 0);
INSERT INTO ta_ob VALUES ('093B37A93A534DF883787AF5F6799674',
'996C7F14989D480589A553717D735E3E',
'51041110620302', '2018-08-02 13:48:30',
510411, 0);
INSERT INTO ta_ob VALUES ('53F5266FB069499AB6234755CACA2583',
'017B8A460DBC444682B791305EF75356',
'51041110620308', '2018-08-02 13:48:28',
510411, 0);
INSERT INTO ta_ob VALUES ('56E59BC4BDC143868D4A219C2D07A24B',
'821E71E6ABB4404EBAA349BB681089F8',
'51041110620310', '2018-08-02 13:48:27',
510411, 0);
INSERT INTO ta_ob VALUES ('56B68DA68D6D4A04A08B453D09AD7B70',
'821E71E6ABB4404EBAA349BB681089F8',
'51041110620310', '2018-08-02 13:48:28',
510411, 0);
SELECT * FROM ta_ob WHERE c LIKE "%510411106%" AND e = 510411 AND f != 1 ORDER BY d,c LIMIT 5 OFFSET 1;
a	b	c	d	e	f
56E59BC4BDC143868D4A219C2D07A24B	821E71E6ABB4404EBAA349BB681089F8	51041110620310	2018-08-02 13:48:27	510411	0
53F5266FB069499AB6234755CACA2583	017B8A460DBC444682B791305EF75356	51041110620308	2018-08-02 13:48:28	510411	0
56B68DA68D6D4A04A08B453D09AD7B70	821E71E6ABB4404EBAA349BB681089F8	51041110620310	2018-08-02 13:48:28	510411	0
51ECF2C0CD3C48D99C91792E99D3C1A0	017B8A460DBC444682B791305EF75356	51041110620308	2018-08-02 13:48:29	510411	0
093B37A93A534DF883787AF5F6799674	996C7F14989D480589A553717D735E3E	51041110620302	2018-08-02 13:48:30	510411	0
#
# MDEV-25985 Spider handle ">=" as ">" in some cases
#
connection child2_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
a int,
b int,
c int,
PRIMARY KEY (a),
KEY (b,c)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES (1, 1, 1), (2, 2, 1);
connection master_1;
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
a int,
b int,
c int,
PRIMARY KEY (a),
KEY (b,c)
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "t1"'
  PARTITION BY LIST COLUMNS(`a`) (
PARTITION `pt1` DEFAULT COMMENT = 'srv "s_2_1"'
  );
connection master_1;
SELECT * FROM t1 WHERE c > 0 AND b >= 1 AND b <= 2;
a	b	c
1	1	1
2	2	1
SELECT * FROM t1 WHERE c < 3 AND b <= 2;
a	b	c
1	1	1
2	2	1

Crash from b4a2baffa82e5c07b96a1c752228560dcac1359b (MDEV-11084)
Fixed with 4968049799193394d442f26b4e3a8d95b185be72
Spider crashed if the first partition was not used first
connection master_1;
CREATE TABLE ta_l2 (
a INT,
b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_COMMENT2_P_2_1
INSERT INTO ta_l2 SELECT a, b, c FROM tb_l;
Query a Spider table only using the second partition
SELECT a,b,c FROM ta_l2 PARTITION (pt2);
a	b	c
4	d	2003-11-30 05:01:03
5	c	2001-12-31 23:59:59
Query a Spider table only using the first partition
SELECT a,b,c FROM ta_l2 PARTITION (pt1);
a	b	c
1	a	2008-08-01 10:21:39
2	b	2000-01-01 00:00:00
3	e	2007-06-04 20:03:11
Query a Spider table by all paritions, then the second partition
SELECT min(a), max(a), min(b), max(b) FROM ta_l2;
min(a)	max(a)	min(b)	max(b)
1	5	a	e
SELECT a,b,c FROM ta_l2 PARTITION (pt2);
a	b	c
4	d	2003-11-30 05:01:03
5	c	2001-12-31 23:59:59

deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
connection slave1_1;
DROP DATABASE IF EXISTS auto_test_local;
connection child2_1;
DROP DATABASE IF EXISTS auto_test_remote;
connection child2_2;
DROP DATABASE IF EXISTS auto_test_remote2;
for slave1_1
for master_1
for child2
child2_1
child2_2
child2_3
for child3
child3_1
child3_2
child3_3

end of test