Skip to content

Commit

Permalink
Merge pull request #19838 from ztlpn/v23.3.x-bp
Browse files Browse the repository at this point in the history
[v23.3.x] s/disk_log_impl: don't prefix-truncate empty segments
  • Loading branch information
ztlpn authored Jun 13, 2024
2 parents b71b6a5 + 1bd8de8 commit 45bf162
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/v/storage/disk_log_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1932,7 +1932,11 @@ 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().base_offset >= cfg.start_offset
|| _segs.front()->offsets().dirty_offset >= cfg.start_offset;
},
[this] {
Expand Down

0 comments on commit 45bf162

Please sign in to comment.