Skip to content

Commit

Permalink
Bug #27041445 SERVER ABORTS IF FTS_DOC_ID EXCEEDS FTS_DOC_ID_MAX_STEP
Browse files Browse the repository at this point in the history
Problem:
=======
Multiple insert statement in table contains FULLTEXT KEY and a
FTS_DOC_ID column aborts the server if the FTS_DOC_ID exceeds
FTS_DOC_ID_MAX_STEP.

Solution:
========
Remove the exception for first committed insert statement.

Reviewed-by: Jimmy Yang<jimmy.yang@oracle.com>
RB: 18023
  • Loading branch information
Thirunarayanan authored and dr-m committed May 11, 2018
1 parent c70fc6b commit 9c03ba8
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
3 changes: 1 addition & 2 deletions storage/xtradb/row/row0mysql.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1442,8 +1442,7 @@ row_insert_for_mysql(
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"
Expand Down

0 comments on commit 9c03ba8

Please sign in to comment.