1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-03 05:41:09 +03:00

Merge pull request #973 from tempesta-tech/tt-10.0-MDEV-16499-virtual-innodb

MDEV-16499 ER_NO_SUCH_TABLE_IN_ENGINE followed by "Please drop the table and recreate" upon adding FULLTEXT key to table with virtual column
This commit is contained in:
Marko Mäkelä
2019-01-14 14:06:26 +02:00
committed by GitHub
4 changed files with 44 additions and 14 deletions

View File

@@ -320,3 +320,18 @@ term uw_id plan wdraw_rsn admit_term
1035 2 CSM ACAD 1009
drop table grad_degree;
drop table gso_grad_supr;
CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL, FULLTEXT KEY(b)) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1,'foo');
SELECT * FROM t1;
a b c
1 foo 1
DROP TABLE t1;
CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1,'foo');
ALTER TABLE t1 ADD FULLTEXT KEY(b);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
SELECT * FROM t1;
a b c
1 foo 1
DROP TABLE t1;

View File

@@ -300,3 +300,14 @@ select * from gso_grad_supr;
drop table grad_degree;
drop table gso_grad_supr;
CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL, FULLTEXT KEY(b)) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1,'foo');
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1,'foo');
ALTER TABLE t1 ADD FULLTEXT KEY(b);
SELECT * FROM t1;
DROP TABLE t1;

View File

@@ -5312,19 +5312,21 @@ ha_innobase::open(
ib_table = dict_table_open_on_name(norm_name, FALSE, TRUE, ignore_err);
if (ib_table
&& ((!DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID)
&& table->s->stored_fields != dict_table_get_n_user_cols(ib_table))
|| (DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID)
&& (table->s->fields
!= dict_table_get_n_user_cols(ib_table) - 1)))) {
&& (table->s->stored_fields != dict_table_get_n_user_cols(ib_table)
- (DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID)
? 1 : 0))) {
ib_logf(IB_LOG_LEVEL_WARN,
"table %s contains %lu user defined columns "
"in InnoDB, but %lu columns in MySQL. Please "
"check INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and "
REFMAN "innodb-troubleshooting.html "
"for how to resolve it",
norm_name, (ulong) dict_table_get_n_user_cols(ib_table),
(ulong) table->s->fields);
norm_name,
(ulong) (dict_table_get_n_user_cols(ib_table)
- DICT_TF2_FLAG_IS_SET(ib_table,
DICT_TF2_FTS_HAS_DOC_ID)
? 1 : 0),
(ulong) table->s->stored_fields);
/* Mark this table as corrupted, so the drop table
or force recovery can still use it, but not others. */

View File

@@ -5984,19 +5984,21 @@ ha_innobase::open(
ib_table = dict_table_open_on_name(norm_name, FALSE, TRUE, ignore_err);
if (ib_table
&& ((!DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID)
&& table->s->stored_fields != dict_table_get_n_user_cols(ib_table))
|| (DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID)
&& (table->s->fields
!= dict_table_get_n_user_cols(ib_table) - 1)))) {
&& (table->s->stored_fields != dict_table_get_n_user_cols(ib_table)
- (DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID)
? 1 : 0))) {
ib_logf(IB_LOG_LEVEL_WARN,
"table %s contains %lu user defined columns "
"in InnoDB, but %lu columns in MySQL. Please "
"check INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and "
REFMAN "innodb-troubleshooting.html "
"for how to resolve it",
norm_name, (ulong) dict_table_get_n_user_cols(ib_table),
(ulong) table->s->fields);
norm_name,
(ulong) (dict_table_get_n_user_cols(ib_table)
- DICT_TF2_FLAG_IS_SET(ib_table,
DICT_TF2_FTS_HAS_DOC_ID)
? 1 : 0),
(ulong) table->s->stored_fields);
/* Mark this table as corrupted, so the drop table
or force recovery can still use it, but not others. */