From c77c7ae9a54740f7fc6036e6491aaecc0f011ae4 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 10 Sep 2023 16:36:57 +0200 Subject: fix(tvix/store/blobservice/seeker): fix debug assert 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 Reviewed-by: Connor Brewster Autosubmit: flokli Tested-by: BuildkiteCI Reviewed-by: flokli --- tvix/store/src/blobservice/dumb_seeker.rs | 11 +++++++++-- 1 file 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 io::Read for DumbSeeker { } impl io::Seek for DumbSeeker { + #[instrument(skip(self))] fn seek(&mut self, pos: io::SeekFrom) -> io::Result { let absolute_offset: u64 = match pos { io::SeekFrom::Start(start_offset) => { @@ -58,10 +61,14 @@ impl io::Seek for DumbSeeker { } }; + 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 -- cgit 1.4.1