MDEV-36454 MDEV-35452 Fix spider view protocol test failures caused by tampering of order by items
With view protocol, a SELECT statement is transformed into two statements: 1. CREATE OR REPLACE VIEW mysqltest_tmp_v AS SELECT ... 2. SELECT * FROM mysqltest_tmp_v The first statement reconstructed the query, which is executed in the second statement. The reconstruction often replaces aliases in ORDER BY by the original item. For example, in the test spider/bugfix.mdev_29008 the query SELECT MIN(t2.a) AS f1, t1.b AS f2 FROM tbl_a AS t1 JOIN tbl_a AS t2 GROUP BY f2 ORDER BY f1, f2; is transformed to "select min(`t2`.`a`) AS `f1`,`t1`.`b` AS `f2` from (`auto_test_local`.`tbl_a` `t1` join `auto_test_local`.`tbl_a` `t2`) group by `t1`.`b` order by min(`t2`.`a`),`t1`.`b`" In such cases, spider constructs different queries to execute at the data node. So we disable view protocol for such queries.
This commit is contained in:
parent
8866fba00a
commit
b6392c292e
@ -71,7 +71,9 @@ TRUNCATE TABLE mysql.general_log;
|
||||
set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
|
||||
set spider_direct_aggregate=1;
|
||||
SHOW STATUS LIKE 'Spider_direct_aggregate';
|
||||
--disable_view_protocol
|
||||
SELECT skey, count(*) cnt FROM tbl_a GROUP BY skey ORDER BY cnt DESC, skey DESC LIMIT 5;
|
||||
--enable_view_protocol
|
||||
SHOW STATUS LIKE 'Spider_direct_aggregate';
|
||||
set spider_direct_aggregate=@old_spider_direct_aggregate;
|
||||
|
||||
|
@ -31,8 +31,10 @@ eval CREATE TABLE tbl_a (
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a", srv "s_2_1"';
|
||||
|
||||
--disable_ps2_protocol
|
||||
--disable_view_protocol
|
||||
SELECT MIN(t2.a) AS f1, t1.b AS f2 FROM tbl_a AS t1 JOIN tbl_a AS t2 GROUP BY f2 ORDER BY f1, f2;
|
||||
SELECT MIN(t2.a) AS f1, t1.b AS f2 FROM tbl_a AS t1 JOIN tbl_a AS t2 GROUP BY f2 ORDER BY MIN(t2.a), MAX(t2.a), f2;
|
||||
--enable_view_protocol
|
||||
--enable_ps2_protocol
|
||||
|
||||
--connection master_1
|
||||
|
@ -71,7 +71,9 @@ TRUNCATE TABLE mysql.general_log;
|
||||
set @old_spider_direct_aggregate=@@session.spider_direct_aggregate;
|
||||
set spider_direct_aggregate=1;
|
||||
SHOW STATUS LIKE 'Spider_direct_aggregate';
|
||||
--disable_view_protocol
|
||||
SELECT skey, count(*) cnt FROM tbl_a GROUP BY skey ORDER BY cnt DESC, skey DESC LIMIT 5;
|
||||
--enable_view_protocol
|
||||
SHOW STATUS LIKE 'Spider_direct_aggregate';
|
||||
set spider_direct_aggregate=@old_spider_direct_aggregate;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user