MDEV-30649 Adding a spider testcase showing copying from a remote to a local table

Also deleted some trailing whitespace in mdev_30191.test.
This commit is contained in:
Yuchen Pei 2024-11-27 10:25:09 +11:00
parent a8cc40d9a4
commit 5be859d52c
No known key found for this signature in database
GPG key ID: 3DD1B35105743563
3 changed files with 95 additions and 0 deletions

View file

@ -0,0 +1,45 @@
for master_1
for child2
child2_1
child2_2
child2_3
for child3
connection child2_1;
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
CREATE TABLE src (c INT, d DATE, PRIMARY KEY(c));
INSERT INTO src VALUES (42, '2024-08-27'), (73, '2024-07-12');
connection master_1;
CREATE DATABASE auto_test_local;
USE auto_test_local;
SET spider_same_server_link=1;
CREATE TABLE dst (c INT, d DATE, PRIMARY KEY(c)) ENGINE=INNODB;
INSERT INTO dst VALUES (555, '1999-12-12');
CREATE TABLE t (c INT, d DATE, PRIMARY KEY(c)) ENGINE=SPIDER
COMMENT='table "src dst", srv "s_2_1 s_1"';
SELECT spider_copy_tables('t', '0', '1');
spider_copy_tables('t', '0', '1')
1
SELECT * FROM dst;
c d
42 2024-08-27
73 2024-07-12
555 1999-12-12
connection child2_1;
DROP TABLE src;
DROP DATABASE auto_test_remote;
connection master_1;
DROP TABLE t;
SELECT * FROM dst;
c d
42 2024-08-27
73 2024-07-12
555 1999-12-12
DROP TABLE dst;
DROP DATABASE auto_test_local;
for master_1
for child2
child2_1
child2_2
child2_3
for child3

View file

@ -0,0 +1,3 @@
!include include/default_mysqld.cnf
!include ../my_1_1.cnf
!include ../my_2_1.cnf

View file

@ -0,0 +1,47 @@
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
--connection child2_1
CREATE DATABASE auto_test_remote;
USE auto_test_remote;
# works without primary key
CREATE TABLE src (c INT, d DATE, PRIMARY KEY(c));
INSERT INTO src VALUES (42, '2024-08-27'), (73, '2024-07-12');
--connection master_1
CREATE DATABASE auto_test_local;
USE auto_test_local;
SET spider_same_server_link=1;
# works without primary key
CREATE TABLE dst (c INT, d DATE, PRIMARY KEY(c)) ENGINE=INNODB;
INSERT INTO dst VALUES (555, '1999-12-12');
# requires primary key, but it is ok if the data node tables have no
# primary key and the corresponding column has duplicate values.
# possibly a bug, e.g. an unnecessary requirement.
evalp CREATE TABLE t (c INT, d DATE, PRIMARY KEY(c)) ENGINE=SPIDER
COMMENT='table "src dst", srv "s_2_1 s_1"';
SELECT spider_copy_tables('t', '0', '1');
SELECT * FROM dst;
--connection child2_1
DROP TABLE src;
DROP DATABASE auto_test_remote;
--connection master_1
DROP TABLE t;
SELECT * FROM dst;
DROP TABLE dst;
DROP DATABASE auto_test_local;
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log