Bug #115124 The sort file cache is not fully controlled by innodb_disable_sort_file_cache
Submitted: 25 May 2024 15:47 Modified: 27 May 2024 9:42
Reporter: Ke Yu (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[25 May 2024 15:47] Ke Yu
Description:
As we konw, innodb_disable_sort_file_cache is used to disable the operating system file system cache for merge-sort temporary files. Although innodb_disable_sort_file_cache is enabled, temporary files for merge-sort still use caches.

How to repeat:
We can find this problem from the code.

In function Merge_file_sort::sort(), the tmpfd is created in ddl0merge.cc line 503.
However, the tmpfd is not controlled by innodb_disable_sort_file_cache. It means that
the os_file_set_nocache function is not used to tmpfd. But another file m_merge_ctx->m_file
is created by Builder::create_file(), which is controlled by innodb_disable_sort_file_cache.

Although innodb_disable_sort_file_cache is enabled, the tmpfd for merge-sort still use caches.

Suggested fix:
The tmpfd should also be controlled by innodb_disable_sort_file_cache.
[27 May 2024 9:42] MySQL Verification Team
Hi Mr . Yu,

Thank you for your bug report.

We have analysed the code in question and we agree with you.

Verified as reported for 8.0 and higher.
[29 May 2024 5:35] Ke Yu
This is my fix code, based on 8.0.37.

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

Contribution: 115124.bug (application/octet-stream, text), 1.22 KiB.

[29 May 2024 10:26] MySQL Verification Team
Thank you, Mr. Yu,

Your patch has been sent to our Development team.