mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
c18896f9c1
Federated and Federatex cannot be used with ROR scans Federated::position() and Federatex::position() is storing in 'ref' a pointer into a local result set buffer. This means that one cannot compare 'ref' from different handler instances to see if they point to the same physical record. This bug caused federated.federatedx to return wrong results when the optimizer tried to use index_merge to resolve some queries. Fixed by introducing table flag HA_NON_COMPARABLE_ROWID and using this with the above handlers. Todo: - Fix multi_delete(), multi_update and read_records() to use primary key instead of 'ref' if case HA_NON_COMPARABLE_ROWID is set. The current code only works if we have only one range (like table scan) for the tables that will be updated in the second pass. - Enable DBUG_ASSERT() in ha_federated::cmp_ref() and ha_federatedx::cmp_ref().
39 lines
1.3 KiB
Text
39 lines
1.3 KiB
Text
#
|
|
#Test optimizer flags related to federated tables
|
|
#
|
|
|
|
--source have_federatedx.inc
|
|
--source include/federated.inc
|
|
|
|
connection default;
|
|
|
|
--echo #
|
|
--echo # MDEV-14907 FEDERATEDX doesn't respect DISTINCT
|
|
--echo #
|
|
|
|
CREATE TABLE t1 (
|
|
`foo_id` bigint(20) unsigned NOT NULL,
|
|
`foo_name` varchar(255) DEFAULT NULL,
|
|
`parent_foo_id` bigint(20) unsigned DEFAULT NULL,
|
|
PRIMARY KEY (`foo_id`),
|
|
KEY `foo_name` (`foo_name`),
|
|
KEY `parent_foo_id` (`parent_foo_id`)
|
|
) DEFAULT CHARSET=utf8;
|
|
|
|
--replace_result $MASTER_MYPORT MASTER_PORT
|
|
eval CREATE TABLE `fed_t1` ENGINE=FEDERATED DEFAULT CHARSET=utf8 CONNECTION='mysql://root@127.0.0.1:$MASTER_MYPORT/test/t1';
|
|
INSERT INTO t1 VALUES (968903, 'STRING - 0', 822857);
|
|
INSERT INTO t1 VALUES (968953, 'STRING - 1', 822857);
|
|
INSERT INTO t1 VALUES (971603, 'STRING - 2', 822857);
|
|
INSERT INTO t1 VALUES (971803, 'STRING - 3', 822857);
|
|
INSERT INTO t1 VALUES (975103, 'STRING - 4', 822857);
|
|
INSERT INTO t1 VALUES (822857, 'STRING', NULL);
|
|
|
|
select foo_id,parent_foo_id,foo_name from t1 where parent_foo_id = 822857 or foo_name like 'STRING%';
|
|
|
|
explain
|
|
select foo_id,parent_foo_id,foo_name from fed_t1 where parent_foo_id = 822857 or foo_name like 'STRING%';
|
|
select foo_id,parent_foo_id,foo_name from fed_t1 where parent_foo_id = 822857 or foo_name like 'STRING%';
|
|
DROP TABLE fed_t1, t1;
|
|
|
|
source include/federated_cleanup.inc;
|