Repository navigation
IoUringFile based on universal I/O interface - #8292
Conversation
IoUringFile based on universal I/O interfaceIoUringFile based on universal I/O interface
`impl UniversalReadFileOps for IoUringFile`
Fix `completed` for write ops
Fix clippy
This comment was marked as resolved.
This comment was marked as resolved.
| impl<'a> Drop for IoUringRuntime<'a> { | ||
| fn drop(&mut self) { | ||
| while self.in_progress > 0 { | ||
| // TODO: Cancel operations with `io_uring::Submitter::register_sync_cancel` | ||
|
|
||
| self.submit_and_wait(self.in_progress) | ||
| .expect("operations submitted"); | ||
|
|
||
| for result in self.completed() { | ||
| match result { | ||
| Ok(_) => (), | ||
| Err(err) => log::debug!("{err}"), | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
So, the interesting part, that is different from our existing IoUringReader, is this.
We want to ensure, that if we, e.g., throw an error in the middle of IoUringFile::read_multi, we complete or cancel all pending operations. Because if we don't, and we just propagate the error and return from read_multi, then we would deallocate our BufferStore, but kernel will still hold pointers into these buffers and write into deallocated memory.
And it does not matter that much, if we put BufferStore inside TLS next to IoUring, because we would have the same problem: if we exit the thread, TLS would be dropped, but kernel might still have pointers into deallocated BufferStore. 🤷♀️
| } | ||
|
|
||
| impl UniversalRead<u8> for IoUringFile { | ||
| fn open(path: impl AsRef<Path>, _options: OpenOptions) -> Result<Self> |
There was a problem hiding this comment.
Proposal for handling of unsupported IO_URING:
- on open, check that io_uring is either already created or actually create it.
- if creation errors out, return error in the open result
Assume user will choose different storage backend if this happens
There was a problem hiding this comment.
We need a custom error for this as well
generall
left a comment
There was a problem hiding this comment.
For follow-up PR:
- use Hashmap -> Vec
- handle errors without panic
- multi-file
- handle unsupported on open
- Implement for T
- implement clear_ram_cache
- (*) implement populate (how?)
Stupid ass lint 🙄
Introduce a universal I/O abstraction layer (following upstream qdrant/qdrant PRs qdrant#8196, qdrant#8251, qdrant#8292) that decouples data access from storage backends. Key components: - UniversalRead<T> / UniversalWrite<T> traits for backend-agnostic I/O - MmapUniversal<T>: mmap-based implementation with optional sequential read mmap - BitSliceReader<S>: storage-agnostic bitslice reader that works over any UniversalRead<u8> backend, supporting: - read_bitslice(): read entire storage as a BitSlice (zero-copy for mmap) - get_bit(): single-bit access translating bit offset to a 1-byte read - read_bit_range(): partial bit range reads with byte-aligned backend access https://claude.ai/code/session_01X9Bnj9Gooxh5bxkhbFmnGx
Initial implementation of
IoUringFilefor universal I/O.Few caveats:
UniversalRead<u8>/UniversalWrite<u8>instead ofUR<T>/UW<T>u8, so I started with this for simplicity, I'll tweak it intoTin a follow-up PRread_multi/write_multi, yetTODO:
handle partial reads/writes 😭IoUringFile#8300All Submissions:
devbranch. Did you create your branch fromdev?New Feature Submissions:
cargo +nightly fmt --allcommand prior to submission?cargo clippy --workspace --all-featurescommand?Changes to Core Features: