Bug #110557 When innodb_disable_sort_file_cache=ON, create a full-text index will fail
Submitted: 30 Mar 2023 3:20 Modified: 24 Apr 2024 15:18
Reporter: linkang zhang Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: FULLTEXT search Severity:S3 (Non-critical)
Version:8.0.28, 8.0.32 OS:Linux
Assigned to: CPU Architecture:Any
Tags: Contribution, full text index, innodb_sort_file_cache

[30 Mar 2023 3:20] linkang zhang
Description:
When starting mysqld and using innodb_disable_sort_file_cache=ON, we will fail to create a full-text index on the table.

The error message: Temporary file write failure

When this error occurs, the disk still has a lot of space.

The reason for this error is that when innodb_disable_sort_file_cache=ON, during the process of parsing DDL, fail to write 25 bytes to temporary file.

How to repeat:

// 1. start mysqld with innodb_disable_sort_file_cache=ON 

// 2. show innodb_disable_sort_file_cache

mysql> show variables like 'innodb_disable_sort_file_cache';

+--------------------------------+-------+
| Variable_name                  | Value |
+--------------------------------+-------+
| innodb_disable_sort_file_cache | ON    |
+--------------------------------+-------+
1 row in set (0.00 sec)

// 3. create a table

mysql> CREATE TABLE test (
mysql> `id` int(0) NOT NULL AUTO_INCREMENT,
mysql> `name` varchar(255),
mysql> `img` varchar(255),
mysql> PRIMARY KEY (`id`) USING BTREE,
mysql> FULLTEXT INDEX `testfulltext`(`img`) WITH PARSER `ngram`
mysql> ) ENGINE = InnoDB;

// 4. insert some data into the table

mysql> INSERT INTO test (name) VALUE ("hey");

Query OK, 1 row affected (0.00 sec)

// 5. create full-test index 

mysql> ALTER TABLE test ADD FULLTEXT INDEX IDX_NAME(name) WITH PARSER ngram;

ERROR 1878 (HY000): Temporary file write failure.
[30 Mar 2023 6:13] MySQL Verification Team
Hello linkang zhang,

Thank you for the report and test case.

regards,
Umesh
[10 Aug 2023 2:33] Shaohua Wang
Contributed patch

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: bug110557_fts_create_index_fail.patch (application/octet-stream, text), 5.41 KiB.

[10 Aug 2023 4:52] MySQL Verification Team
Thank you, Shaohua Wang for the contribution.

regards,
Umesh
[7 Nov 2023 9:00] Shaohua Wang
Contributed patch

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: bug110557_fts_create_index_fail_v2.patch (application/octet-stream, text), 6.59 KiB.

[7 Nov 2023 9:03] Shaohua Wang
The new patch is modified according new commit in 8.0.34, in which we got heap buffer overflow in ascan test.

ascan test failures:
innodb_fts.large_records innodb.innodb_bulk_create_index_flush

commit 11f7d6dfc55fc0a45ce0139ca04d0615d6fc21ec
Author: Marcin Babij <marcin.babij@oracle.com>
Date:   Wed Apr 5 09:24:03 2023 +0200

    Bug#35194732    InnoDB: DDL should not use large pages nor direct memory like mmap
[24 Apr 2024 15:18] Edward Gilmore
Posted by developer:
 
Contribution highlighted other issues, addressing which also fixed this issue. Helpful as it was, we did not use the contribution.

Thank you for the bug report.