diff --git a/src/v/storage/segment.cc b/src/v/storage/segment.cc index cb96c14b3211..bcac7ae3d00e 100644 --- a/src/v/storage/segment.cc +++ b/src/v/storage/segment.cc @@ -429,7 +429,7 @@ ss::future<> segment::do_truncate( ss::future segment::materialize_index() { vassert( - _tracker.base_offset == _tracker.dirty_offset, + _tracker.base_offset == model::next_offset(_tracker.dirty_offset), "Materializing the index must happen before tracking any data. {}", *this); return _idx.materialize_index().then([this](bool yn) { diff --git a/src/v/storage/segment.h b/src/v/storage/segment.h index abf704288864..32b577bcce21 100644 --- a/src/v/storage/segment.h +++ b/src/v/storage/segment.h @@ -45,9 +45,9 @@ class segment { offset_tracker(model::term_id t, model::offset base) : term(t) , base_offset(base) - , committed_offset(base) - , dirty_offset(base) - , stable_offset(base) {} + , committed_offset(model::prev_offset(base)) + , dirty_offset(model::prev_offset(base)) + , stable_offset(model::prev_offset(base)) {} model::term_id term; model::offset base_offset;