[MDEV-26040] os_file_set_size() may not work on O_DIRECT files Created: 2021-06-29  Updated: 2021-09-10  Resolved: 2021-06-29

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6
Fix Version/s: 10.2.40, 10.3.31, 10.4.21, 10.5.12, 10.6.3

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Problem/Incident
causes MDEV-26537 InnoDB corrupts files due to incorrec... Closed
Relates
relates to MDEV-24854 Change innodb_flush_method=O_DIRECT b... Closed
relates to MDEV-25121 innodb_flush_method=O_DIRECT fails on... Closed

 Description   

The test innodb.log_data_file_size would fail on a block device where the block size is 4096 bytes:

10.6 63e9a05440953bf451ebe1cd808ca445e4c7634e

innodb.log_data_file_size '16k,innodb'   w6 [ fail ]  Found warnings/errors in server log file!
        Test ended at 2021-06-29 06:49:46
line
2021-06-29  6:49:45 0 [Warning] InnoDB: Retry attempts for writing partial data failed.
2021-06-29  6:49:45 0 [ERROR] InnoDB: Write to file ./test/ibd4f.ibd failed at offset 66770, 47918 bytes should have been written, only 0 were written. Operating system error number 22. Check that your OS and file system support files of this size. Check also that the disk is not full or a disk quota exceeded.
2021-06-29  6:49:45 0 [ERROR] InnoDB: Error number 22 means 'Invalid argument'
2021-06-29  6:49:45 0 [ERROR] InnoDB: Cannot apply log to [page id: space=6, page number=0] of corrupted file './test/ibd4f.ibd'
2021-06-29  6:49:45 0 [ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption
2021-06-29  6:49:45 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-06-29  6:49:45 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

The reason is that we fail to round the current file size down to a multiple of the file system block size.

Arguably, this is a corner case where the file size has been doctored by the environment. In MariaDB Server 10.6 this is more prominent, because MDEV-24854 set innodb_flush_method=O_DIRECT by default.


Generated at Thu Feb 08 09:42:17 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.