mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-35059 ALTER TABLE...IMPORT TABLESPACE with FULLTEXT SEARCH may corrupt the adaptive hash index
build_fts_hidden_table(): Correct a mistake that had been made in
commit 903ae30069
(MDEV-30655).
This commit is contained in:
@ -1,3 +1,5 @@
|
|||||||
|
SET @save_adaptive=@@GLOBAL.innodb_adaptive_hash_index;
|
||||||
|
SET GLOBAL innodb_adaptive_hash_index=ON;
|
||||||
call mtr.add_suppression("InnoDB: Added system generated FTS_DOC_ID and FTS_DOC_ID_INDEX while importing the tablespace");
|
call mtr.add_suppression("InnoDB: Added system generated FTS_DOC_ID and FTS_DOC_ID_INDEX while importing the tablespace");
|
||||||
CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY,
|
CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY,
|
||||||
f2 CHAR(2) not null, fulltext f_idx(f2),
|
f2 CHAR(2) not null, fulltext f_idx(f2),
|
||||||
@ -9,7 +11,7 @@ INSERT INTO t1(f1, f2) SELECT seq, "si" FROM seq_2_to_256;
|
|||||||
ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL;
|
ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL;
|
||||||
ALTER TABLE t1 DROP COLUMN f6;
|
ALTER TABLE t1 DROP COLUMN f6;
|
||||||
ALTER TABLE t1 DROP INDEX f_idx;
|
ALTER TABLE t1 DROP INDEX f_idx;
|
||||||
connect con1,localhost,root,,;
|
connect block_purge,localhost,root,,;
|
||||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||||
connection default;
|
connection default;
|
||||||
DELETE FROM t1 WHERE f1 > 1;
|
DELETE FROM t1 WHERE f1 > 1;
|
||||||
@ -22,6 +24,7 @@ UNLOCK TABLES;
|
|||||||
Warnings:
|
Warnings:
|
||||||
Warning 1235 This version of MariaDB doesn't yet support 'FLUSH TABLES on a table that had an FTS index, created on a hidden column, the auxiliary tables haven't been dropped as yet. FTS auxiliary tables will not be flushed.'
|
Warning 1235 This version of MariaDB doesn't yet support 'FLUSH TABLES on a table that had an FTS index, created on a hidden column, the auxiliary tables haven't been dropped as yet. FTS auxiliary tables will not be flushed.'
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
disconnect block_purge;
|
||||||
CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY,
|
CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY,
|
||||||
f2 CHAR(2) not null,
|
f2 CHAR(2) not null,
|
||||||
f3 INT as (f1) VIRTUAL, INDEX(f3),
|
f3 INT as (f1) VIRTUAL, INDEX(f3),
|
||||||
@ -43,3 +46,4 @@ t1 CREATE TABLE `t1` (
|
|||||||
KEY `f4` (`f4`)
|
KEY `f4` (`f4`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
SET GLOBAL innodb_adaptive_hash_index=@save_adaptive;
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
--source include/have_innodb.inc
|
--source include/have_innodb.inc
|
||||||
--source include/have_sequence.inc
|
--source include/have_sequence.inc
|
||||||
|
|
||||||
|
--error 0,ER_UNKNOWN_SYSTEM_VARIABLE
|
||||||
|
SET @save_adaptive=@@GLOBAL.innodb_adaptive_hash_index;
|
||||||
|
--error 0,ER_UNKNOWN_SYSTEM_VARIABLE
|
||||||
|
SET GLOBAL innodb_adaptive_hash_index=ON;
|
||||||
|
|
||||||
# Table with virtual, fulltext, instant add, instant drop column
|
# Table with virtual, fulltext, instant add, instant drop column
|
||||||
# and purgeable rows
|
# and purgeable rows
|
||||||
call mtr.add_suppression("InnoDB: Added system generated FTS_DOC_ID and FTS_DOC_ID_INDEX while importing the tablespace");
|
call mtr.add_suppression("InnoDB: Added system generated FTS_DOC_ID and FTS_DOC_ID_INDEX while importing the tablespace");
|
||||||
@ -13,7 +19,7 @@ INSERT INTO t1(f1, f2) SELECT seq, "si" FROM seq_2_to_256;
|
|||||||
ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL;
|
ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL;
|
||||||
ALTER TABLE t1 DROP COLUMN f6;
|
ALTER TABLE t1 DROP COLUMN f6;
|
||||||
ALTER TABLE t1 DROP INDEX f_idx;
|
ALTER TABLE t1 DROP INDEX f_idx;
|
||||||
connect(con1,localhost,root,,);
|
connect(block_purge,localhost,root,,);
|
||||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||||
|
|
||||||
connection default;
|
connection default;
|
||||||
@ -26,6 +32,7 @@ ib_backup_tablespaces("test", "t1");
|
|||||||
EOF
|
EOF
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
disconnect block_purge;
|
||||||
|
|
||||||
CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY,
|
CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY,
|
||||||
f2 CHAR(2) not null,
|
f2 CHAR(2) not null,
|
||||||
@ -44,3 +51,5 @@ ALTER TABLE t1 IMPORT TABLESPACE;
|
|||||||
--enable_warnings
|
--enable_warnings
|
||||||
SHOW CREATE TABLE t1;
|
SHOW CREATE TABLE t1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
--error 0,ER_UNKNOWN_SYSTEM_VARIABLE
|
||||||
|
SET GLOBAL innodb_adaptive_hash_index=@save_adaptive;
|
||||||
|
@ -3335,7 +3335,9 @@ static dict_table_t *build_fts_hidden_table(
|
|||||||
new_index->fields[old_index->n_fields].fixed_len= sizeof(doc_id_t);
|
new_index->fields[old_index->n_fields].fixed_len= sizeof(doc_id_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
new_index->search_info= old_index->search_info;
|
#ifdef BTR_CUR_HASH_ADAPT
|
||||||
|
new_index->search_info= btr_search_info_create(new_index->heap);
|
||||||
|
#endif /* BTR_CUR_HASH_ADAPT */
|
||||||
UT_LIST_ADD_LAST(new_index->table->indexes, new_index);
|
UT_LIST_ADD_LAST(new_index->table->indexes, new_index);
|
||||||
old_index= UT_LIST_GET_NEXT(indexes, old_index);
|
old_index= UT_LIST_GET_NEXT(indexes, old_index);
|
||||||
if (UT_LIST_GET_LEN(new_table->indexes)
|
if (UT_LIST_GET_LEN(new_table->indexes)
|
||||||
|
Reference in New Issue
Block a user