v.21.9Improvement
Remove Complicated Linux AIO in Favor of Simple Synchronous IO with O_DIRECT
Remove complicated usage of Linux AIO with one block readahead and replace it with plain simple synchronous IO with O_DIRECT. In previous versions, the settingmin_bytes_to_use_direct_iomay not work correctly ifmax_threadsis greater than one. Reading with direct IO (that is disabled by default for queries and enabled by default for large merges) will work in less efficient way. This closes #25997. #26003 (alexey-milovidov).
Why it matters
This change resolves issues with themin_bytes_to_use_direct_io setting not functioning correctly when max_threads is greater than one, and improves the efficiency and reliability of direct IO reads by removing complicated Linux AIO usage and one block readahead. It ensures more consistent and predictable behavior for direct IO, which is used by default for large merges and optionally for queries.How to use it
The feature is applied internally by replacing the direct IO mechanism; users can benefit from this fix by configuring themin_bytes_to_use_direct_io and max_threads settings as usual. Direct IO is disabled by default for queries and enabled by default for large merges, so no additional user action is needed unless customizing those settings.