Skip to content

Commit 6f3baec

Browse files
MDEV-32627 Spider: add tests for connection param overriding
When connection parameters are specified in COMMENT, CONNECTION and SERVER, they are overriden in the following order: COMMENT > CONNECTION > SERVER
1 parent 62dfd0c commit 6f3baec

File tree

3 files changed

+89
-0
lines changed

3 files changed

+89
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
for master_1
2+
for child2
3+
for child3
4+
set spider_same_server_link= 1;
5+
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
6+
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'invalid',user 'root');
7+
create table t2 (c int);
8+
create table t1 (c int) ENGINE=Spider
9+
COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", database "test"';
10+
insert into t1 values (1), (2), (3);
11+
select * from t1;
12+
c
13+
1
14+
2
15+
3
16+
drop table t1, t2;
17+
drop server srv;
18+
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
19+
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'invalid',user 'root');
20+
create table t2 (c int);
21+
create table t1 (c int) ENGINE=Spider
22+
CONNECTION='WRAPPER "mysql", srv "srv",TABLE "t2", database "test"';
23+
insert into t1 values (1), (2), (3);
24+
select * from t1;
25+
c
26+
1
27+
2
28+
3
29+
drop table t1, t2;
30+
drop server srv;
31+
create table t2 (c int);
32+
create table t1 (c int) ENGINE=Spider
33+
CONNECTION='user "root", database "invalid"'
34+
COMMENT='WRAPPER "mysql", SOCKET "$MASTER_1_MYSOCK",TABLE "t2", database "test"';
35+
insert into t1 values (1), (2), (3);
36+
select * from t1;
37+
c
38+
1
39+
2
40+
3
41+
drop table t1, t2;
42+
for master_1
43+
for child2
44+
for child3
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
!include include/default_mysqld.cnf
2+
!include ../my_1_1.cnf
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
--disable_query_log
2+
--disable_result_log
3+
--source test_init.inc
4+
--enable_result_log
5+
--enable_query_log
6+
set spider_same_server_link= 1;
7+
8+
# COMMENT overrides SERVER
9+
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
10+
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'invalid',user 'root');
11+
create table t2 (c int);
12+
create table t1 (c int) ENGINE=Spider
13+
COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", database "test"';
14+
insert into t1 values (1), (2), (3);
15+
select * from t1;
16+
drop table t1, t2;
17+
drop server srv;
18+
19+
# CONNECTION overrides SERVER
20+
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
21+
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'invalid',user 'root');
22+
create table t2 (c int);
23+
create table t1 (c int) ENGINE=Spider
24+
CONNECTION='WRAPPER "mysql", srv "srv",TABLE "t2", database "test"';
25+
insert into t1 values (1), (2), (3);
26+
select * from t1;
27+
drop table t1, t2;
28+
drop server srv;
29+
30+
# COMMENT overrides CONNECTION
31+
create table t2 (c int);
32+
evalp create table t1 (c int) ENGINE=Spider
33+
CONNECTION='user "root", database "invalid"'
34+
COMMENT='WRAPPER "mysql", SOCKET "$MASTER_1_MYSOCK",TABLE "t2", database "test"';
35+
insert into t1 values (1), (2), (3);
36+
select * from t1;
37+
drop table t1, t2;
38+
39+
--disable_query_log
40+
--disable_result_log
41+
--source test_deinit.inc
42+
--enable_result_log
43+
--enable_query_log

0 commit comments

Comments
 (0)