mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-16499 [10.1] ER_NO_SUCH_TABLE_IN_ENGINE followed by "Please drop the table and recreate" upon adding FULLTEXT key to table with virtual column
There was an incorrect check for MariaDB and InnoDB tables fields count. Corruption was reported when there was no corruption. Also, a warning message had incorrect field numbers for both MariaDB and InnoDB tables. ha_innobase::open(): fixed check and message
This commit is contained in:
@ -320,3 +320,18 @@ term uw_id plan wdraw_rsn admit_term
|
|||||||
1035 2 CSM ACAD 1009
|
1035 2 CSM ACAD 1009
|
||||||
drop table grad_degree;
|
drop table grad_degree;
|
||||||
drop table gso_grad_supr;
|
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;
|
||||||
|
@ -300,3 +300,14 @@ select * from gso_grad_supr;
|
|||||||
|
|
||||||
drop table grad_degree;
|
drop table grad_degree;
|
||||||
drop table gso_grad_supr;
|
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;
|
||||||
|
@ -5312,19 +5312,21 @@ ha_innobase::open(
|
|||||||
ib_table = dict_table_open_on_name(norm_name, FALSE, TRUE, ignore_err);
|
ib_table = dict_table_open_on_name(norm_name, FALSE, TRUE, ignore_err);
|
||||||
|
|
||||||
if (ib_table
|
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)
|
||||||
&& 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)
|
||||||
|| (DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID)
|
? 1 : 0))) {
|
||||||
&& (table->s->fields
|
|
||||||
!= dict_table_get_n_user_cols(ib_table) - 1)))) {
|
|
||||||
ib_logf(IB_LOG_LEVEL_WARN,
|
ib_logf(IB_LOG_LEVEL_WARN,
|
||||||
"table %s contains %lu user defined columns "
|
"table %s contains %lu user defined columns "
|
||||||
"in InnoDB, but %lu columns in MySQL. Please "
|
"in InnoDB, but %lu columns in MySQL. Please "
|
||||||
"check INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and "
|
"check INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and "
|
||||||
REFMAN "innodb-troubleshooting.html "
|
REFMAN "innodb-troubleshooting.html "
|
||||||
"for how to resolve it",
|
"for how to resolve it",
|
||||||
norm_name, (ulong) dict_table_get_n_user_cols(ib_table),
|
norm_name,
|
||||||
(ulong) table->s->fields);
|
(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
|
/* Mark this table as corrupted, so the drop table
|
||||||
or force recovery can still use it, but not others. */
|
or force recovery can still use it, but not others. */
|
||||||
|
@ -5984,19 +5984,21 @@ ha_innobase::open(
|
|||||||
ib_table = dict_table_open_on_name(norm_name, FALSE, TRUE, ignore_err);
|
ib_table = dict_table_open_on_name(norm_name, FALSE, TRUE, ignore_err);
|
||||||
|
|
||||||
if (ib_table
|
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)
|
||||||
&& 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)
|
||||||
|| (DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID)
|
? 1 : 0))) {
|
||||||
&& (table->s->fields
|
|
||||||
!= dict_table_get_n_user_cols(ib_table) - 1)))) {
|
|
||||||
ib_logf(IB_LOG_LEVEL_WARN,
|
ib_logf(IB_LOG_LEVEL_WARN,
|
||||||
"table %s contains %lu user defined columns "
|
"table %s contains %lu user defined columns "
|
||||||
"in InnoDB, but %lu columns in MySQL. Please "
|
"in InnoDB, but %lu columns in MySQL. Please "
|
||||||
"check INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and "
|
"check INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and "
|
||||||
REFMAN "innodb-troubleshooting.html "
|
REFMAN "innodb-troubleshooting.html "
|
||||||
"for how to resolve it",
|
"for how to resolve it",
|
||||||
norm_name, (ulong) dict_table_get_n_user_cols(ib_table),
|
norm_name,
|
||||||
(ulong) table->s->fields);
|
(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
|
/* Mark this table as corrupted, so the drop table
|
||||||
or force recovery can still use it, but not others. */
|
or force recovery can still use it, but not others. */
|
||||||
|
Reference in New Issue
Block a user