Bug #110569 Contribution by Tencent: Clone plugin sometimes failed, errno 22

Submitted: 30 Mar 2023 12:53 Modified: 8 Jan 2024 9:04
Reporter: Yin Peng (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Clone Plugin Severity:S3 (Non-critical)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[30 Mar 2023 12:53] Yin Peng
Description:
On a platform with disk sector size of 4k, clone plugin sometimes failed to write redo log file, error: Error writing file 'xxxx/ib_logfile0.#clone' (errno: 22 - Invalid argument)

How to repeat:
Start an instance (with innodb_flush_method=O_DIRECT) on a platform with disk sector size of 4k and clone data from a remote server, sometimes this operation fails.

And read the code of function 'Clone_Snapshot::extend_and_flush_files', you can see the argument 'type' of function 'os_file_create_func' is always 'OS_CLONE_DATA_FILE', which can disable the os caching of redo files when innodb_flush_method=O_DIRECT and may lead to failure in function 'os_file_set_size'.

Suggested fix:
Set the correct file type when calling 'os_file_create' in function 'Clone_Snapshot::extend_and_flush_files'.
[30 Mar 2023 12:54] Yin Peng
Set the correct file type when calling 'os_file_create'.

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

Contribution: patch.txt (text/plain), 891 bytes.

[30 Mar 2023 13:20] MySQL Verification Team
Hi Mr. Peng,

Thank you for your bug report.

We have managed to repeat the problem.

We are also thanking you for your contribution.

Verified as reported.
[30 Mar 2023 13:21] MySQL Verification Team
A change of the couple of flags.
[4 Aug 2023 22:27] Jon Stephens
Documented fix as follows in the MySQL 8.0.35 and 8.2.0 changelogs:

    Clone_Snapshot::extend_and_flush_files() always created files of
    type OS_CLONE_DATA_FILE. This function uses flush_redo() to
    handle redo log files, which must be of type OS_CLONE_LOG_FILE,
    which could sometimes lead to errors in os_file_set_size().

    This problem is now fixed by ensuring that the type is set
    correctly when creating the new file.

    Our thanks to Tencent for the contribution.

Closed.
[7 Aug 2023 12:48] MySQL Verification Team
Thank you, Jon.
[8 Jan 2024 9:09] MySQL Verification Team
Bug #113548 marked as duplicate of this one
[8 Jan 2024 11:29] MySQL Verification Team
Hi,

Since the internally filed bug report is closed, so this bug report is closed as well.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.062 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.