Permalink
Browse files

Bug #20590013 IF YOU HAVE A FULLTEXT INDEX AND DROP IT

		YOU CAN NO LONGER PERFORM ONLINE DDL

Problem:
=======
After dropping all FTS indexes, FTS_DOC_ID and FTS_DOC_ID_INDEX will
be part of the table. Online DDL is not allowed when FTS_DOC_ID and
FTS_DOC_ID_INDEX is a part of the table.

Solution:
========

InnoDB allows the online DDL to happen when there is only hidden
FTS_DOC_ID and FTS_DOC_ID_INDEX are present.  Hidden column FTS_DOC_Id
and FTS_DOC_ID_INDEX will be part of the table till the
rebuild DDL invokes.

Reviewed-by: Marko Mäkelä <marko.makela@oracle.com>
Reviewed-by: Jimmy Yang <jimmy.yang@oracle.com>
RB: 9149
  • Loading branch information...
Thirunarayanan committed Jun 15, 2015
1 parent 8fd710e commit 5610e5354a8be6609b2fc2a37902961be26af3cf
@@ -1719,8 +1719,8 @@ ALTER TABLE tm1 DROP INDEX im3;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0
ALTER TABLE ti1 DROP COLUMN d2;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE tm1 DROP COLUMN d2;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0
@@ -662,6 +662,15 @@ ID FOR_COL_NAME REF_COL_NAME POS
DROP TABLE tt, t1o, sys_tables, sys_indexes, sys_foreign;
CREATE TABLE t (t TEXT, FULLTEXT(t)) ENGINE=InnoDB;
DROP INDEX t ON t;
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
FTS_0 test/FTS_AUX_BEING_DELETED
FTS_0 test/FTS_AUX_BEING_DELETED_CACHE
FTS_0 test/FTS_AUX_CONFIG
FTS_0 test/FTS_AUX_DELETED
FTS_0 test/FTS_AUX_DELETED_CACHE
SELECT sc.pos, sc.NAME FROM information_schema.innodb_sys_columns sc
INNER JOIN information_schema.innodb_sys_tables st
ON sc.TABLE_ID=st.TABLE_ID
@@ -670,14 +679,20 @@ pos NAME
0 t
1 FTS_DOC_ID
ALTER TABLE t ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY.
ALTER TABLE t ROW_FORMAT=REDUNDANT;
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
prefix name
ALTER TABLE t ADD FULLTEXT INDEX(t);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
SELECT sc.pos, sc.NAME FROM information_schema.innodb_sys_columns sc
INNER JOIN information_schema.innodb_sys_tables st
ON sc.TABLE_ID=st.TABLE_ID
WHERE st.NAME='test/t';
pos NAME
0 t
1 FTS_DOC_ID
DROP TABLE t;
#
# Bug #19465984 INNODB DATA DICTIONARY IS NOT UPDATED WHILE
@@ -379,14 +379,25 @@ DROP TABLE tt, t1o, sys_tables, sys_indexes, sys_foreign;
CREATE TABLE t (t TEXT, FULLTEXT(t)) ENGINE=InnoDB;
DROP INDEX t ON t;
LET $regexp=/FTS_([0-9a-f_]+)([A-Z_]+)/FTS_AUX_\2/;
--replace_regex $regexp
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
SELECT sc.pos, sc.NAME FROM information_schema.innodb_sys_columns sc
INNER JOIN information_schema.innodb_sys_tables st
ON sc.TABLE_ID=st.TABLE_ID
WHERE st.NAME='test/t';
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t ROW_FORMAT=REDUNDANT, ALGORITHM=INPLACE;
ALTER TABLE t ROW_FORMAT=REDUNDANT;
--replace_regex $regexp
SELECT SUBSTRING(name, LOCATE('_', name) - 3, 5) AS prefix, name
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE '%FTS_%' ORDER BY 1, 2;
ALTER TABLE t ADD FULLTEXT INDEX(t);
SELECT sc.pos, sc.NAME FROM information_schema.innodb_sys_columns sc
INNER JOIN information_schema.innodb_sys_tables st
@@ -465,12 +465,9 @@ ha_innobase::check_if_supported_inplace_alter(
} else if (((ha_alter_info->handler_flags
& Alter_inplace_info::ADD_PK_INDEX)
|| innobase_need_rebuild(ha_alter_info))
&& (innobase_fulltext_exist(altered_table)
|| (prebuilt->table->flags2
& DICT_TF2_FTS_HAS_DOC_ID))) {
&& (innobase_fulltext_exist(altered_table))) {
/* Refuse to rebuild the table online, if
fulltext indexes are to survive the rebuild,
or if the table contains a hidden FTS_DOC_ID column. */
fulltext indexes are to survive the rebuild. */
online = false;
/* If the table already contains fulltext indexes,
refuse to rebuild the table natively altogether. */

0 comments on commit 5610e53

Please sign in to comment.