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 <tvl@lahfa.xyz>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
This commit is contained in:
Florian Klink 2023-09-10 16:36:57 +02:00 committed by flokli
parent 5c32fb8ee2
commit c77c7ae9a5

View file

@ -1,5 +1,7 @@
use std::io; use std::io;
use tracing::{debug, instrument};
use super::BlobReader; use super::BlobReader;
/// This implements [io::Seek] for and [io::Read] by simply skipping over some /// 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> { impl<R: io::Read> io::Seek for DumbSeeker<R> {
#[instrument(skip(self))]
fn seek(&mut self, pos: io::SeekFrom) -> io::Result<u64> { fn seek(&mut self, pos: io::SeekFrom) -> io::Result<u64> {
let absolute_offset: u64 = match pos { let absolute_offset: u64 = match pos {
io::SeekFrom::Start(start_offset) => { 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 // we already know absolute_offset is larger than self.pos
debug_assert!( debug_assert!(
absolute_offset > self.pos, absolute_offset >= self.pos,
"absolute_offset is larger than self.pos" "absolute_offset {} is larger than self.pos {}",
absolute_offset,
self.pos
); );
// calculate bytes to skip // calculate bytes to skip