Commit 0c3908ff authored by Yuchen Pei's avatar Yuchen Pei

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
parent a6e270ab
for master_1
for child2
for child3
set spider_same_server_link= 1;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'invalid',user 'root');
create table t2 (c int);
create table t1 (c int) ENGINE=Spider
COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", database "test"';
Warnings:
Warning 138 Spider table params in COMMENT or CONNECTION strings have been deprecated and will be removed in a future release. Please use table options instead.
insert into t1 values (1), (2), (3);
select * from t1;
c
1
2
3
drop table t1, t2;
drop server srv;
CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'invalid',user 'root');
create table t2 (c int);
create table t1 (c int) ENGINE=Spider
CONNECTION='WRAPPER "mysql", srv "srv",TABLE "t2", database "test"';
Warnings:
Warning 138 Spider table params in COMMENT or CONNECTION strings have been deprecated and will be removed in a future release. Please use table options instead.
insert into t1 values (1), (2), (3);
select * from t1;
c
1
2
3
drop table t1, t2;
drop server srv;
create table t2 (c int);
create table t1 (c int) ENGINE=Spider
CONNECTION='user "root", database "invalid"'
COMMENT='WRAPPER "mysql", SOCKET "$MASTER_1_MYSOCK",TABLE "t2", database "test"';
Warnings:
Warning 138 Spider table params in COMMENT or CONNECTION strings have been deprecated and will be removed in a future release. Please use table options instead.
Warning 138 Spider table params in COMMENT or CONNECTION strings have been deprecated and will be removed in a future release. Please use table options instead.
insert into t1 values (1), (2), (3);
select * from t1;
c
1
2
3
drop table t1, t2;
for master_1
for child2
for child3
!include include/default_mysqld.cnf
!include ../my_1_1.cnf
--disable_query_log
--disable_result_log
--source test_init.inc
--enable_result_log
--enable_query_log
set spider_same_server_link= 1;
# COMMENT overrides SERVER
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'invalid',user 'root');
create table t2 (c int);
create table t1 (c int) ENGINE=Spider
COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2", database "test"';
insert into t1 values (1), (2), (3);
select * from t1;
drop table t1, t2;
drop server srv;
# CONNECTION overrides SERVER
evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'invalid',user 'root');
create table t2 (c int);
create table t1 (c int) ENGINE=Spider
CONNECTION='WRAPPER "mysql", srv "srv",TABLE "t2", database "test"';
insert into t1 values (1), (2), (3);
select * from t1;
drop table t1, t2;
drop server srv;
# COMMENT overrides CONNECTION
create table t2 (c int);
evalp create table t1 (c int) ENGINE=Spider
CONNECTION='user "root", database "invalid"'
COMMENT='WRAPPER "mysql", SOCKET "$MASTER_1_MYSOCK",TABLE "t2", database "test"';
insert into t1 values (1), (2), (3);
select * from t1;
drop table t1, t2;
--disable_query_log
--disable_result_log
--source test_deinit.inc
--enable_result_log
--enable_query_log
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment