summaryrefslogtreecommitdiff
path: root/storage/spider/mysql-test
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-09-07 08:08:59 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-09-07 08:08:59 +0300
commitc7ba2377936be2a3c84080359d87f7486ce682a0 (patch)
treed5baefb80899dabbe5d3fcac421727409ba15c12 /storage/spider/mysql-test
parent2917bd0d2cf417cbf9c83b64ae2b7806bdb2f34e (diff)
parentac49b7a845f5b5de30d1266879a4c584f9d7c914 (diff)
downloadmariadb-git-c7ba2377936be2a3c84080359d87f7486ce682a0.tar.gz
Merge 10.3 into 10.4
Diffstat (limited to 'storage/spider/mysql-test')
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/mdev_27172.result84
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27172.cnf3
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/mdev_27172.test92
3 files changed, 179 insertions, 0 deletions
diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_27172.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_27172.result
new file mode 100644
index 00000000000..d4c8c7e8ec2
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_27172.result
@@ -0,0 +1,84 @@
+#
+# MDEV-27172 Prefix indices on Spider tables may lead to wrong query results
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+connection child2_1;
+SET @general_log_backup = @@global.general_log;
+SET @log_output_backup = @@global.log_output;
+SET @@global.general_log = 1;
+SET @@global.log_output = "TABLE";
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+CREATE TABLE tbl_a (
+id int NOT NULL,
+greeting VARCHAR(255),
+KEY(greeting)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE tbl_b (
+id int NOT NULL,
+greeting VARCHAR(255),
+KEY k (greeting(5))
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+CREATE TABLE tbl_c (
+id int NOT NULL,
+greeting TEXT,
+KEY k (greeting(5))
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+TRUNCATE TABLE mysql.general_log;
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+CREATE TABLE tbl_a (
+id int NOT NULL,
+greeting VARCHAR(255),
+KEY k (greeting)
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a", srv "s_2_1"';
+INSERT INTO tbl_a VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
+SELECT * FROM tbl_a WHERE greeting = "Aloha!"
+ AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one";
+id greeting
+2 Aloha!
+CREATE TABLE tbl_b (
+id int NOT NULL,
+greeting VARCHAR(255),
+KEY k (greeting(5))
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_b", srv "s_2_1"';
+INSERT INTO tbl_b VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
+SELECT * FROM tbl_b WHERE greeting = "Aloha!"
+ AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one";
+id greeting
+2 Aloha!
+CREATE TABLE tbl_c (
+id int NOT NULL,
+greeting TEXT,
+KEY k (greeting(5))
+) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_c", srv "s_2_1"';
+INSERT INTO tbl_c VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
+SELECT * FROM tbl_c WHERE greeting = "Aloha!"
+ AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one";
+id greeting
+2 Aloha!
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE 'select %';
+argument
+select `id`,`greeting` from `auto_test_remote`.`tbl_a` where `greeting` = 'Aloha!' and ((`greeting` = 'Aloha!'))
+select `id`,`greeting` from `auto_test_remote`.`tbl_b` where `greeting` like 'Aloha%' and ((`greeting` = 'Aloha!'))
+select `id`,`greeting` from `auto_test_remote`.`tbl_c` where `greeting` like 'Aloha%' and ((`greeting` = 'Aloha!'))
+SELECT argument FROM mysql.general_log WHERE argument LIKE 'select %'
+connection child2_1;
+SET @@global.general_log = @general_log_backup;
+SET @@global.log_output = @log_output_backup;
+DROP DATABASE auto_test_remote;
+connection master_1;
+DROP DATABASE auto_test_local;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27172.cnf b/storage/spider/mysql-test/spider/bugfix/t/mdev_27172.cnf
new file mode 100644
index 00000000000..05dfd8a0bce
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27172.cnf
@@ -0,0 +1,3 @@
+!include include/default_mysqld.cnf
+!include ../my_1_1.cnf
+!include ../my_2_1.cnf
diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_27172.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_27172.test
new file mode 100644
index 00000000000..d544a0b400e
--- /dev/null
+++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_27172.test
@@ -0,0 +1,92 @@
+--echo #
+--echo # MDEV-27172 Prefix indices on Spider tables may lead to wrong query results
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+SET @general_log_backup = @@global.general_log;
+SET @log_output_backup = @@global.log_output;
+SET @@global.general_log = 1;
+SET @@global.log_output = "TABLE";
+
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+eval CREATE TABLE tbl_a (
+ id int NOT NULL,
+ greeting VARCHAR(255),
+ KEY(greeting)
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+eval CREATE TABLE tbl_b (
+ id int NOT NULL,
+ greeting VARCHAR(255),
+ KEY k (greeting(5))
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+eval CREATE TABLE tbl_c (
+ id int NOT NULL,
+ greeting TEXT,
+ KEY k (greeting(5))
+) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
+
+TRUNCATE TABLE mysql.general_log;
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+# = (equality)
+eval CREATE TABLE tbl_a (
+ id int NOT NULL,
+ greeting VARCHAR(255),
+ KEY k (greeting)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
+
+INSERT INTO tbl_a VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
+SELECT * FROM tbl_a WHERE greeting = "Aloha!"
+ AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one"; # hack to disable GBH
+
+# LIKE
+eval CREATE TABLE tbl_b (
+ id int NOT NULL,
+ greeting VARCHAR(255),
+ KEY k (greeting(5))
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_b", srv "s_2_1"';
+
+INSERT INTO tbl_b VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
+SELECT * FROM tbl_b WHERE greeting = "Aloha!"
+ AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one"; # hack to disable GBH
+
+# LIKE
+eval CREATE TABLE tbl_c (
+ id int NOT NULL,
+ greeting TEXT,
+ KEY k (greeting(5))
+) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_c", srv "s_2_1"';
+
+INSERT INTO tbl_c VALUES (1, "Hi!"),(2, "Aloha!"),(3, "Aloha!!!");
+SELECT * FROM tbl_c WHERE greeting = "Aloha!"
+ AND CASE greeting WHEN "Aloha!" THEN "one" ELSE 'more' END = "one"; # hack to disable GBH
+
+--connection child2_1
+SELECT argument FROM mysql.general_log WHERE argument LIKE 'select %';
+
+--connection child2_1
+SET @@global.general_log = @general_log_backup;
+SET @@global.log_output = @log_output_backup;
+DROP DATABASE auto_test_remote;
+
+--connection master_1
+DROP DATABASE auto_test_local;
+
+--disable_query_log
+--disable_result_log
+--source ../../t/test_deinit.inc
+--enable_result_log
+--enable_query_log