diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-11-02 14:58:01 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-11-02 15:45:27 +0100 |
commit | 15de3aa2f5b0fb5404a00f1a3cd5c0291f0ef67d (patch) | |
tree | cfd49996c72f6bbe7117fd950ededb01abc76b76 /mysql-test/suite/federated | |
parent | 6449af6f2d52c7acb483fcfb186c838edaf0424a (diff) | |
parent | e5aa58190fd8697b3858add4b8f86a5fd38e07f8 (diff) | |
download | mariadb-git-15de3aa2f5b0fb5404a00f1a3cd5c0291f0ef67d.tar.gz |
Merge branch '10.6' into 10.7
Diffstat (limited to 'mysql-test/suite/federated')
-rw-r--r-- | mysql-test/suite/federated/federatedx_create_handlers.result | 49 | ||||
-rw-r--r-- | mysql-test/suite/federated/federatedx_create_handlers.test | 48 |
2 files changed, 97 insertions, 0 deletions
diff --git a/mysql-test/suite/federated/federatedx_create_handlers.result b/mysql-test/suite/federated/federatedx_create_handlers.result index 28736515327..bf1df903947 100644 --- a/mysql-test/suite/federated/federatedx_create_handlers.result +++ b/mysql-test/suite/federated/federatedx_create_handlers.result @@ -422,6 +422,55 @@ SELECT * FROM (SELECT * FROM federated.t1 LIMIT 70000) dt; SELECT COUNT(DISTINCT a) FROM federated.t2; COUNT(DISTINCT a) 70000 +# +# MDEV-29640 FederatedX does not properly handle pushdown +# in case of difference in local and remote table names +# +connection master; +# Use tables from the previous test. Make sure pushdown works: +EXPLAIN SELECT COUNT(DISTINCT a) FROM federated.t2; +id select_type table type possible_keys key key_len ref rows Extra +1 PUSHED SELECT NULL NULL NULL NULL NULL NULL NULL NULL +SELECT COUNT(DISTINCT a) FROM federated.t2; +COUNT(DISTINCT a) +70000 +# Link remote table `federated.t1` with the local table named `t1_local` +CREATE TABLE federated.t1_local ENGINE="FEDERATED" +CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; +# No pushdown here due to table names mismatch, retrieve data as usual: +EXPLAIN SELECT COUNT(DISTINCT a) FROM federated.t1_local; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1_local ALL NULL NULL NULL NULL 70000 +SELECT COUNT(DISTINCT a) FROM federated.t1_local; +COUNT(DISTINCT a) +70000 +# +# MDEV-29863 Server crashes in federatedx_txn::acquire after select from +# the Federated table with partitions and federated_pushdown=1 +# in case of difference in local and remote table names +# +connection slave; +CREATE TABLE federated.t3 (a INT); +INSERT INTO federated.t3 VALUES (1),(2),(3); +CREATE TABLE federated.t4 (a INT); +connection master; +CREATE SERVER fedlink FOREIGN DATA WRAPPER mysql +OPTIONS (USER 'root', HOST '127.0.0.1', DATABASE 'federated', +PORT SLAVE_PORT); +CREATE TABLE federated.t3 (a INT) +ENGINE=FEDERATED +CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t3' + PARTITION BY list (a) +(PARTITION p1 VALUES IN (1) CONNECTION='fedlink/t3', +PARTITION p2 VALUES IN (2) CONNECTION='fedlink/t4'); +EXPLAIN SELECT * FROM federated.t3; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 ALL NULL NULL NULL NULL 3 +SELECT * FROM federated.t3; +a +1 +2 +3 set global federated_pushdown=0; connection master; DROP TABLE IF EXISTS federated.t1; diff --git a/mysql-test/suite/federated/federatedx_create_handlers.test b/mysql-test/suite/federated/federatedx_create_handlers.test index 8863a057b47..2d6c2bc4197 100644 --- a/mysql-test/suite/federated/federatedx_create_handlers.test +++ b/mysql-test/suite/federated/federatedx_create_handlers.test @@ -1,6 +1,7 @@ --source have_federatedx.inc --source include/federated.inc --source include/no_valgrind_without_big.inc +--source include/have_partition.inc connection default; @@ -266,6 +267,53 @@ INSERT INTO federated.t2 SELECT * FROM (SELECT * FROM federated.t1 LIMIT 70000) dt; SELECT COUNT(DISTINCT a) FROM federated.t2; + +--echo # +--echo # MDEV-29640 FederatedX does not properly handle pushdown +--echo # in case of difference in local and remote table names +--echo # +connection master; +--echo # Use tables from the previous test. Make sure pushdown works: +EXPLAIN SELECT COUNT(DISTINCT a) FROM federated.t2; +SELECT COUNT(DISTINCT a) FROM federated.t2; + +--echo # Link remote table `federated.t1` with the local table named `t1_local` +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval +CREATE TABLE federated.t1_local ENGINE="FEDERATED" +CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; + +--echo # No pushdown here due to table names mismatch, retrieve data as usual: +EXPLAIN SELECT COUNT(DISTINCT a) FROM federated.t1_local; +SELECT COUNT(DISTINCT a) FROM federated.t1_local; + + +--echo # +--echo # MDEV-29863 Server crashes in federatedx_txn::acquire after select from +--echo # the Federated table with partitions and federated_pushdown=1 +--echo # in case of difference in local and remote table names +--echo # +connection slave; +CREATE TABLE federated.t3 (a INT); +INSERT INTO federated.t3 VALUES (1),(2),(3); +CREATE TABLE federated.t4 (a INT); + +connection master; +--replace_result $SLAVE_MYPORT SLAVE_PORT +eval CREATE SERVER fedlink FOREIGN DATA WRAPPER mysql + OPTIONS (USER 'root', HOST '127.0.0.1', DATABASE 'federated', + PORT $SLAVE_MYPORT); + +CREATE TABLE federated.t3 (a INT) + ENGINE=FEDERATED + CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t3' + PARTITION BY list (a) + (PARTITION p1 VALUES IN (1) CONNECTION='fedlink/t3', + PARTITION p2 VALUES IN (2) CONNECTION='fedlink/t4'); + +EXPLAIN SELECT * FROM federated.t3; +SELECT * FROM federated.t3; + set global federated_pushdown=0; source include/federated_cleanup.inc; |