-
Type:
Bug
-
Status: Done
-
Priority:
High
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 5.5.59-38.11, 5.6.39-83.1, 5.7.21-20
-
Component/s: None
-
Labels:
-
Launchpad URL:
-
Upstream Bug URL:
**Reported in Launchpad by Wolfgang Walther last update 04-01-2018 08:58:37
This is a bug introduced in 5.6.38-83.0. It was not there in 5.6.37-82.2. It seems to be percona specific (not mysql) and probably related to this commit:
https://github.com/percona/percona-server/commit/59eff2e4e870f3a87ade9d4b55dea5d47a2ba62b
which changes
storage/federated/ha_federated.cc
The cases in this switch were probably designed as conditionally fall-through on purpose - this change breaks this behaviour and leads to a wrong SQL query built to access the remote server.
Test case:
– use this server as remote and local server for test-case
– bug behaviour is the same with 'real' remote server
DROP SERVER IF EXISTS local_server;
CREATE SERVER local_server
FOREIGN DATA WRAPPER mysql
OPTIONS (
HOST '127.0.0.1',
PORT 3306,
USER 'USER',
PASSWORD 'PASS',
DATABASE 'test'
);
– create sample table
DROP TABLE IF EXISTS test.remote_table;
CREATE TABLE test.remote_table (
a INT,
b INT,
KEY ab (a,b),
KEY ba (b,a)
);
– create federated table pointing to table above
DROP TABLE IF EXISTS test.local_table;
CREATE TABLE test.local_table (
a INT,
b INT,
KEY ab (a,b),
KEY ba (b,a)
) ENGINE=federated CONNECTION='local_server/remote_table';
– ok
SELECT * FROM test.local_table;
– ok
SELECT * FROM test.local_table USE INDEX (ab)
WHERE a<1 AND b=0;
– returns: Error Code: 1030. Got error 1430 from storage engine
SELECT * FROM test.local_table USE INDEX (ba)
WHERE a<1 AND b=0;