summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/innodb/r/innodb-alter.result29
-rw-r--r--mysql-test/suite/innodb/t/innodb-alter.test21
-rw-r--r--mysql-test/suite/innodb_fts/r/basic.result (renamed from mysql-test/suite/innodb_fts/r/innodb-fts-basic.result)34
-rw-r--r--mysql-test/suite/innodb_fts/t/basic.test (renamed from mysql-test/suite/innodb_fts/t/innodb-fts-basic.test)39
-rw-r--r--storage/innobase/row/row0import.cc10
-rw-r--r--storage/xtradb/row/row0import.cc6
-rw-r--r--storage/xtradb/row/row0mysql.cc8
7 files changed, 124 insertions, 23 deletions
diff --git a/mysql-test/suite/innodb/r/innodb-alter.result b/mysql-test/suite/innodb/r/innodb-alter.result
index fadbcce332a..d41df53e5a7 100644
--- a/mysql-test/suite/innodb/r/innodb-alter.result
+++ b/mysql-test/suite/innodb/r/innodb-alter.result
@@ -859,3 +859,32 @@ DROP TABLE dest_db.t1;
DROP TABLE source_db.t1;
DROP DATABASE source_db;
DROP DATABASE dest_db;
+#
+# BUG #26334149 MYSQL CRASHES WHEN FULL TEXT INDEXES IBD FILES ARE
+# ORPHANED DUE TO RENAME TABLE
+#
+CREATE DATABASE db1;
+USE db1;
+CREATE TABLE notes (
+id int(11) NOT NULL AUTO_INCREMENT,
+body text COLLATE utf8_unicode_ci,
+PRIMARY KEY (id)
+) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8
+COLLATE=utf8_unicode_ci
+ROW_FORMAT=COMPRESSED;
+Warnings:
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+ALTER TABLE notes ADD FULLTEXT INDEX index_ft_body (body(255));
+Warnings:
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
+DROP INDEX index_ft_body ON notes;
+Warnings:
+Warning 1478 InnoDB: ROW_FORMAT=COMPRESSED requires innodb_file_format > Antelope.
+Warning 1478 InnoDB: assuming ROW_FORMAT=COMPACT.
+CREATE DATABASE db2;
+RENAME TABLE db1.notes TO db2.notes;
+DROP DATABASE db1;
+DROP DATABASE db2;
diff --git a/mysql-test/suite/innodb/t/innodb-alter.test b/mysql-test/suite/innodb/t/innodb-alter.test
index af75482703c..0d3cc6f1733 100644
--- a/mysql-test/suite/innodb/t/innodb-alter.test
+++ b/mysql-test/suite/innodb/t/innodb-alter.test
@@ -481,3 +481,24 @@ eval ALTER TABLE $source_db.t1 DROP INDEX index2, algorithm=inplace;
eval DROP TABLE $source_db.t1;
eval DROP DATABASE $source_db;
eval DROP DATABASE $dest_db;
+
+--echo #
+--echo # BUG #26334149 MYSQL CRASHES WHEN FULL TEXT INDEXES IBD FILES ARE
+--echo # ORPHANED DUE TO RENAME TABLE
+--echo #
+CREATE DATABASE db1; USE db1;
+CREATE TABLE notes (
+ id int(11) NOT NULL AUTO_INCREMENT,
+ body text COLLATE utf8_unicode_ci,
+ PRIMARY KEY (id)
+ ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8
+COLLATE=utf8_unicode_ci
+ROW_FORMAT=COMPRESSED;
+
+ALTER TABLE notes ADD FULLTEXT INDEX index_ft_body (body(255));
+DROP INDEX index_ft_body ON notes;
+
+CREATE DATABASE db2;
+RENAME TABLE db1.notes TO db2.notes;
+DROP DATABASE db1;
+DROP DATABASE db2;
diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-basic.result b/mysql-test/suite/innodb_fts/r/basic.result
index fe767476fe6..ae23b93dc84 100644
--- a/mysql-test/suite/innodb_fts/r/innodb-fts-basic.result
+++ b/mysql-test/suite/innodb_fts/r/basic.result
@@ -257,3 +257,37 @@ WHERE MATCH (title,body)
AGAINST ('"more test proximity"' IN BOOLEAN MODE);
id title body
drop table articles;
+#
+# Bug #22679185 INVALID INNODB FTS DOC ID DURING INSERT
+#
+create table t1 (f1 int not null primary key, f2 varchar(100),
+FTS_DOC_ID bigint(20) unsigned not null,
+unique key `FTS_DOC_ID_INDEX` (`FTS_DOC_ID`),
+fulltext key (f2))engine=innodb;
+insert into t1 values(1, "This is the first record", 20000);
+insert into t1 values(2, "This is the second record", 40000);
+select FTS_DOC_ID from t1;
+FTS_DOC_ID
+20000
+40000
+drop table t1;
+create table t1 (f1 int not null primary key, f2 varchar(100),
+FTS_DOC_ID bigint(20) unsigned not null auto_increment,
+unique key `FTS_DOC_ID_INDEX` (`FTS_DOC_ID`),
+fulltext key (f2))engine=innodb;
+set auto_increment_increment = 65535;
+insert into t1(f1, f2) values(1, "This is the first record");
+insert into t1(f1, f2) values(2, "This is the second record");
+insert into t1(f1, f2) values(3, "This is the third record");
+select FTS_DOC_ID from t1;
+FTS_DOC_ID
+1
+65536
+131071
+drop table t1;
+call mtr.add_suppression("\\[ERROR\\] InnoDB: Doc ID 20030101000000 is too big. Its difference with largest used Doc ID 0 cannot exceed or equal to 65535");
+CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+title VARCHAR(200), FULLTEXT(title)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (NULL, NULL), (20030101000000, 20030102000000);
+ERROR HY000: Invalid InnoDB FTS Doc ID
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-basic.test b/mysql-test/suite/innodb_fts/t/basic.test
index 095713130f1..58f36be08a5 100644
--- a/mysql-test/suite/innodb_fts/t/innodb-fts-basic.test
+++ b/mysql-test/suite/innodb_fts/t/basic.test
@@ -2,11 +2,6 @@
-- source include/have_innodb.inc
-if (`select plugin_auth_version <= "5.6.10" from information_schema.plugins where plugin_name='innodb'`)
-{
- --skip Not fixed in InnoDB 5.6.10 or earlier
-}
-
# Create FTS table
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
@@ -226,3 +221,37 @@ SELECT * FROM articles
AGAINST ('"more test proximity"' IN BOOLEAN MODE);
drop table articles;
+
+--echo #
+--echo # Bug #22679185 INVALID INNODB FTS DOC ID DURING INSERT
+--echo #
+
+create table t1 (f1 int not null primary key, f2 varchar(100),
+ FTS_DOC_ID bigint(20) unsigned not null,
+ unique key `FTS_DOC_ID_INDEX` (`FTS_DOC_ID`),
+ fulltext key (f2))engine=innodb;
+
+insert into t1 values(1, "This is the first record", 20000);
+insert into t1 values(2, "This is the second record", 40000);
+select FTS_DOC_ID from t1;
+drop table t1;
+
+
+create table t1 (f1 int not null primary key, f2 varchar(100),
+ FTS_DOC_ID bigint(20) unsigned not null auto_increment,
+ unique key `FTS_DOC_ID_INDEX` (`FTS_DOC_ID`),
+ fulltext key (f2))engine=innodb;
+
+set auto_increment_increment = 65535;
+insert into t1(f1, f2) values(1, "This is the first record");
+insert into t1(f1, f2) values(2, "This is the second record");
+insert into t1(f1, f2) values(3, "This is the third record");
+select FTS_DOC_ID from t1;
+drop table t1;
+
+call mtr.add_suppression("\\[ERROR\\] InnoDB: Doc ID 20030101000000 is too big. Its difference with largest used Doc ID 0 cannot exceed or equal to 65535");
+CREATE TABLE t1 (FTS_DOC_ID BIGINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
+ title VARCHAR(200), FULLTEXT(title)) ENGINE=InnoDB;
+--error 182
+INSERT INTO t1 VALUES (NULL, NULL), (20030101000000, 20030102000000);
+DROP TABLE t1;
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 04456043f8a..a9c24a0f8cc 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -1804,10 +1804,6 @@ PageConverter::update_records(
m_rec_iter.open(block);
- if (!page_is_leaf(block->frame)) {
- return DB_SUCCESS;
- }
-
while (!m_rec_iter.end()) {
rec_t* rec = m_rec_iter.current();
@@ -1922,11 +1918,7 @@ PageConverter::update_index_page(
return(DB_SUCCESS);
}
- if (!page_is_leaf(block->frame)) {
- return (DB_SUCCESS);
- }
-
- return(update_records(block));
+ return page_is_leaf(block->frame) ? update_records(block) : DB_SUCCESS;
}
/**
diff --git a/storage/xtradb/row/row0import.cc b/storage/xtradb/row/row0import.cc
index 3e60287a2e4..36ffba68291 100644
--- a/storage/xtradb/row/row0import.cc
+++ b/storage/xtradb/row/row0import.cc
@@ -1804,10 +1804,6 @@ PageConverter::update_records(
m_rec_iter.open(block);
- if (!page_is_leaf(block->frame)) {
- return DB_SUCCESS;
- }
-
while (!m_rec_iter.end()) {
rec_t* rec = m_rec_iter.current();
ibool deleted = rec_get_deleted_flag(rec, comp);
@@ -1921,7 +1917,7 @@ PageConverter::update_index_page(
return(DB_SUCCESS);
}
- return(update_records(block));
+ return page_is_leaf(block->frame) ? update_records(block) : DB_SUCCESS;
}
/**
diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc
index ce4fe7f53ea..1acdfe53e0c 100644
--- a/storage/xtradb/row/row0mysql.cc
+++ b/storage/xtradb/row/row0mysql.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
@@ -1504,8 +1504,7 @@ error_exit:
doc_ids difference should not exceed
FTS_DOC_ID_MAX_STEP value. */
- if (next_doc_id > 1
- && doc_id - next_doc_id >= FTS_DOC_ID_MAX_STEP) {
+ if (doc_id - next_doc_id >= FTS_DOC_ID_MAX_STEP) {
fprintf(stderr,
"InnoDB: Doc ID " UINT64PF " is too"
" big. Its difference with largest"
@@ -5270,7 +5269,8 @@ row_rename_table_for_mysql(
}
}
- if (dict_table_has_fts_index(table)
+ if ((dict_table_has_fts_index(table)
+ || DICT_TF2_FLAG_IS_SET(table, DICT_TF2_FTS_HAS_DOC_ID))
&& !dict_tables_have_same_db(old_name, new_name)) {
err = fts_rename_aux_tables(table, new_name, trx);
if (err != DB_TABLE_NOT_FOUND) {