Skip to content

Commit d58064e

Browse files
Merge branch 'mysql-5.6' into mysql-5.7
2 parents d3ec326 + 3c98704 commit d58064e

File tree

3 files changed

+46
-3
lines changed

3 files changed

+46
-3
lines changed

mysql-test/suite/innodb/r/innodb-alter.result

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,3 +825,24 @@ ALTER TABLE t1 DROP KEY idx, ADD UNIQUE KEY uidx (col1);
825825
ERROR 23000: Duplicate entry '2' for key 'uidx'
826826
DELETE FROM t1 WHERE col1 = 2;
827827
DROP TABLE t1;
828+
#
829+
# BUG #26334149 MYSQL CRASHES WHEN FULL TEXT INDEXES IBD FILES ARE
830+
# ORPHANED DUE TO RENAME TABLE
831+
#
832+
CREATE DATABASE db1;
833+
USE db1;
834+
CREATE TABLE `notes` (
835+
`id` int(11) NOT NULL AUTO_INCREMENT,
836+
`body` text COLLATE utf8_unicode_ci,
837+
PRIMARY KEY (`id`)
838+
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8
839+
COLLATE=utf8_unicode_ci
840+
ROW_FORMAT=COMPRESSED;
841+
ALTER TABLE notes ADD FULLTEXT INDEX `index_ft_body` (body(255));
842+
Warnings:
843+
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
844+
DROP INDEX index_ft_body ON notes;
845+
CREATE DATABASE db2;
846+
RENAME TABLE db1.notes TO db2.notes;
847+
DROP DATABASE db1;
848+
DROP DATABASE db2;

mysql-test/suite/innodb/t/innodb-alter.test

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,3 +464,24 @@ INSERT INTO t1 (col1, col2) VALUES (2 , 'A');
464464
ALTER TABLE t1 DROP KEY idx, ADD UNIQUE KEY uidx (col1);
465465
DELETE FROM t1 WHERE col1 = 2;
466466
DROP TABLE t1;
467+
468+
--echo #
469+
--echo # BUG #26334149 MYSQL CRASHES WHEN FULL TEXT INDEXES IBD FILES ARE
470+
--echo # ORPHANED DUE TO RENAME TABLE
471+
--echo #
472+
CREATE DATABASE db1; USE db1;
473+
CREATE TABLE notes (
474+
id int(11) NOT NULL AUTO_INCREMENT,
475+
body text COLLATE utf8_unicode_ci,
476+
PRIMARY KEY (`id`)
477+
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8
478+
COLLATE=utf8_unicode_ci
479+
ROW_FORMAT=COMPRESSED;
480+
481+
ALTER TABLE notes ADD FULLTEXT INDEX index_ft_body (body(255));
482+
DROP INDEX index_ft_body ON notes;
483+
484+
CREATE DATABASE db2;
485+
RENAME TABLE db1.notes TO db2.notes;
486+
DROP DATABASE db1;
487+
DROP DATABASE db2;

storage/innobase/row/row0mysql.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved.
44
55
This program is free software; you can redistribute it and/or modify it under
66
the terms of the GNU General Public License as published by the Free Software
@@ -5506,8 +5506,9 @@ row_rename_table_for_mysql(
55065506
}
55075507
}
55085508

5509-
if (dict_table_has_fts_index(table)
5510-
&& !dict_tables_have_same_db(old_name, new_name)) {
5509+
if ((dict_table_has_fts_index(table)
5510+
|| DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID))
5511+
&& !dict_tables_have_same_db(old_name, new_name)) {
55115512
err = fts_rename_aux_tables(table, new_name, trx);
55125513
if (err != DB_TABLE_NOT_FOUND) {
55135514
aux_fts_rename = true;

0 commit comments

Comments
 (0)