feat: check VortexReadAt::read_at results in the I/O driver#7783
feat: check VortexReadAt::read_at results in the I/O driver#7783
Conversation
This ensures misbehaving VortexReadAt implementations cannot trigger later bad behavior by the I/O driver. Instead, the driver raises an error as close as possible to the badly behaving VortexReadAt implementation. Signed-off-by: Daniel King <dan@spiraldb.com>
Merging this PR will improve performance by 17.98%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | WallTime | cuda/bitpacked_u8/unpack/3bw[100M] |
352.3 µs | 298.6 µs | +17.98% |
Comparing dk/verify-bytes-from-read-at-implementation (a7c4640) with develop (f307edc)
Signed-off-by: Daniel King <dan@spiraldb.com>
Signed-off-by: Daniel King <dan@spiraldb.com>
Signed-off-by: Daniel King <dan@spiraldb.com>
Signed-off-by: Daniel King <dan@spiraldb.com>
| } | ||
|
|
||
| impl CoalescedRequest { | ||
| pub fn try_new( |
There was a problem hiding this comment.
i would also be ok with this panicking since passing a request that is outside of the coalescing window is an implementer error. but this is fine
| if req.offset < range.start { | ||
| vortex_bail!( | ||
| "CoalescedRequest: sub-request for length {} at file offset {} precedes coalesced range: {}..{}. {:?}", | ||
| req.length, | ||
| req.offset, | ||
| range.start, | ||
| range.end, | ||
| req, | ||
| ) | ||
| } |
There was a problem hiding this comment.
nit: there's the vortex_ensure! macro for this pattern
There was a problem hiding this comment.
my how times have changed https://spiraldb.slack.com/archives/C066263CX0Q/p1747837979403279
a10y
left a comment
There was a problem hiding this comment.
optional nit, i think you probably need to regen lockfiles as well
| pub fn requests(&self) -> &[ReadRequest] { | ||
| &self.requests | ||
| } |
There was a problem hiding this comment.
it's the only way to have read-only public fields so I can enforce my invariants.
This ensures misbehaving VortexReadAt implementations cannot trigger later bad behavior by the I/O driver. Instead, the driver raises an error as close as possible to the badly behaving VortexReadAt implementation.