DirectIO WAL Write does not honor DBOptions.use_fsync
- Dominant language
- C++
- Stars
- 32.1k
- Forks
- 6.9k
- Avg merge
- 32m
- Merged PRs (30d)
- 1
Description
In my test using direct io for WAL write (with ext4 in the kernel), I noticed direct io WAL writes do not do metadata sync even when I have DBOptions.use_fsync = true. I understand that the actual data is persistent with direct IO, but the metadata is not flushed. I think we may be exposed to metadata loss in the case of sudden power outage? Please correct me if otherwise.
In the code, the function WritableFileWriter::Sync(bool use_fsync) is excluding SyncInternal for directio.
> Note: Please use Issues only for bug reports. For questions, discussions, feature requests, etc. post to dev group: https://groups.google.com/forum/#!forum/rocksdb or https://www.facebook.com/groups/rocksdb.dev
### Expected behavior
### Actual behavior
### Steps to reproduce the behavior
Contributor guide
Research direction
Start at WritableFileWriter::Sync(bool use_fsync) and trace why direct I/O excludes SyncInternal. Compare the expected metadata-sync behavior with the existing direct-I/O WAL path, then define regression coverage showing that DBOptions.use_fsync is honored during WAL writes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100