Skip to content

Commit

Permalink
Merge pull request #19790 from ztlpn/fix-empty-seg-prefix-truncate
Browse files Browse the repository at this point in the history
s/disk_log_impl: don't prefix-truncate empty segments
  • Loading branch information
mmaslankaprv authored Jun 12, 2024
2 parents 0ca0de7 + 963ff23 commit 229c8dd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/v/storage/disk_log_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2511,7 +2511,12 @@ ss::future<>
disk_log_impl::remove_prefix_full_segments(truncate_prefix_config cfg) {
return ss::do_until(
[this, cfg] {
// base_offset check is for the case of an empty segment
// (where dirty = base - 1). We don't want to remove it because
// batches may be concurrently appended to it and we should keep them.
return _segs.empty()
|| _segs.front()->offsets().get_base_offset()
>= cfg.start_offset
|| _segs.front()->offsets().get_dirty_offset()
>= cfg.start_offset;
},
Expand Down

0 comments on commit 229c8dd

Please sign in to comment.