diff options
author | Florian Klink <flokli@flokli.de> | 2023-09-10T14·36+0200 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2023-09-12T12·15+0000 |
commit | c77c7ae9a54740f7fc6036e6491aaecc0f011ae4 (patch) | |
tree | 1799bf36addccf2de6965a9d1a784ac3a86eb0ea | |
parent | 5c32fb8ee2878673f3dffa6728960cf14150902b (diff) |
fix(tvix/store/blobservice/seeker): fix debug assert r/6581
We were asserting absolute_offset > self.pos, but that's not true for both being zero. Ramp up the tracing bits a bit, so we actually can see this in the debug logs. Change-Id: I21693bcafab227549b19cd6f1215d2f8dee77ecc Reviewed-on: https://cl.tvl.fyi/c/depot/+/9292 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Reviewed-by: Connor Brewster <cbrewster@hey.com> Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
-rw-r--r-- | tvix/store/src/blobservice/dumb_seeker.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tvix/store/src/blobservice/dumb_seeker.rs b/tvix/store/src/blobservice/dumb_seeker.rs index 8629394d21bc..6df4eb57f5f1 100644 --- a/tvix/store/src/blobservice/dumb_seeker.rs +++ b/tvix/store/src/blobservice/dumb_seeker.rs @@ -1,5 +1,7 @@ use std::io; +use tracing::{debug, instrument}; + use super::BlobReader; /// This implements [io::Seek] for and [io::Read] by simply skipping over some @@ -27,6 +29,7 @@ impl<R: io::Read> io::Read for DumbSeeker<R> { } impl<R: io::Read> io::Seek for DumbSeeker<R> { + #[instrument(skip(self))] fn seek(&mut self, pos: io::SeekFrom) -> io::Result<u64> { let absolute_offset: u64 = match pos { io::SeekFrom::Start(start_offset) => { @@ -58,10 +61,14 @@ impl<R: io::Read> io::Seek for DumbSeeker<R> { } }; + debug!(absolute_offset=?absolute_offset, "seek"); + // we already know absolute_offset is larger than self.pos debug_assert!( - absolute_offset > self.pos, - "absolute_offset is larger than self.pos" + absolute_offset >= self.pos, + "absolute_offset {} is larger than self.pos {}", + absolute_offset, + self.pos ); // calculate bytes to skip |