Skip to content

Commit

Permalink
Bug #27493633: REGRESSION IN FEDERATED STORAGE ENGINE AFTER GCC 7 FIXES
Browse files Browse the repository at this point in the history
Fix a regression after Bug#25943754: FIX GCC 7 COMPILE WARNINGS.
The federated storage engine had a few fall-throughs that were
intentional, but that we assumed were not.

The test case is a contribution from Percona.

Change-Id: Iefffdd7d8d0f578d00a626da01a487543f2034a6
(cherry picked from commit 96faee6db07d4421697cd04f5934a88a574a2f85)
  • Loading branch information
Steinar H. Gunderson authored and Tor Didriksen committed Jul 12, 2018
1 parent aee91b1 commit b15b4ac
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 2 deletions.
44 changes: 44 additions & 0 deletions mysql-test/suite/federated/r/percona_bug1739734.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#
# Bug lp1739734 "Federated table returns error 1430 from storage engine"
#
# This is a bug introduced in the artful/gcc7 compilation fixes, caused by
# a moved break statement.
CREATE DATABASE federated;
CREATE DATABASE federated;
CREATE DATABASE lp1739734;
use lp1739734;
CREATE SERVER local_server
FOREIGN DATA WRAPPER mysql
OPTIONS (
HOST '127.0.0.1',
PORT MASTER_PORT,
USER 'root',
PASSWORD '',
DATABASE 'lp1739734'
);
CREATE TABLE remote_table (
a INT,
b INT,
KEY ab (a,b),
KEY ba (b,a)
);
CREATE TABLE local_table (
a INT,
b INT,
KEY ab (a,b),
KEY ba (b,a)
) ENGINE=federated CONNECTION='local_server/remote_table';
SELECT * FROM local_table;
a b
SELECT * FROM local_table USE INDEX (ab)
WHERE a<1 AND b=0;
a b
SELECT * FROM local_table USE INDEX (ba)
WHERE a<1 AND b=0;
a b
DROP DATABASE lp1739734;
DROP SERVER local_server;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE federated;
DROP TABLE IF EXISTS federated.t1;
DROP DATABASE federated;
50 changes: 50 additions & 0 deletions mysql-test/suite/federated/t/percona_bug1739734.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
--echo #
--echo # Bug lp1739734 "Federated table returns error 1430 from storage engine"
--echo #
--echo # This is a bug introduced in the artful/gcc7 compilation fixes, caused by
--echo # a moved break statement.

--source suite/federated/include/federated.inc

connection master;
CREATE DATABASE lp1739734;
use lp1739734;

--replace_result $MASTER_MYPORT MASTER_PORT
eval CREATE SERVER local_server
FOREIGN DATA WRAPPER mysql
OPTIONS (
HOST '127.0.0.1',
PORT $MASTER_MYPORT,
USER 'root',
PASSWORD '',
DATABASE 'lp1739734'
);

CREATE TABLE remote_table (
a INT,
b INT,
KEY ab (a,b),
KEY ba (b,a)
);


CREATE TABLE local_table (
a INT,
b INT,
KEY ab (a,b),
KEY ba (b,a)
) ENGINE=federated CONNECTION='local_server/remote_table';

SELECT * FROM local_table;

SELECT * FROM local_table USE INDEX (ab)
WHERE a<1 AND b=0;

SELECT * FROM local_table USE INDEX (ba)
WHERE a<1 AND b=0;

DROP DATABASE lp1739734;
DROP SERVER local_server;

--source suite/federated/include/federated_cleanup.inc
6 changes: 4 additions & 2 deletions storage/federated/ha_federated.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1425,8 +1425,9 @@ bool ha_federated::create_where_from_key(String *to,
{
goto err;
}
break;
}
break;
// Fall through
case HA_READ_KEY_OR_NEXT:
DBUG_PRINT("info", ("federated HA_READ_KEY_OR_NEXT %d", i));
if (emit_key_part_name(&tmp, key_part) ||
Expand All @@ -1444,8 +1445,9 @@ bool ha_federated::create_where_from_key(String *to,
emit_key_part_element(&tmp, key_part, needs_quotes, 0, ptr,
part_length))
goto err;
break;
}
break;
// Fall through
case HA_READ_KEY_OR_PREV:
DBUG_PRINT("info", ("federated HA_READ_KEY_OR_PREV %d", i));
if (emit_key_part_name(&tmp, key_part) ||
Expand Down

0 comments on commit b15b4ac

Please sign in to comment.