Bug #100860 Insert a table with large auto_increment full text index
Submitted: 16 Sep 2020 7:00 Modified: 16 Sep 2020 7:43
Reporter: Zhang JiYang Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: FULLTEXT search Severity:S3 (Non-critical)
Version:8.0.21, 5.7.31 OS:Any
Assigned to: CPU Architecture:Any

[16 Sep 2020 7:00] Zhang JiYang
Description:
If creating a table with fulltext index, and set it as auto_increment = #Large Number#, then inserting such a table will get an error:

ERROR 182 (HY000): Invalid InnoDB FTS Doc ID.

How to repeat:
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, auto_increment = 1000000;
set auto_increment_increment = 1;
insert into t1(f1, f2) values(1, "This is the first record");

Suggested fix:
It seems that table->fts->cache->next_doc_id is not inited as an appropriate value when being specified with a large auto_increment.
[16 Sep 2020 7:43] MySQL Verification Team
Hello zanye zjy,

Thank you for the report and test case.

regards,
Umesh