Skip to content

Commit

Permalink
storage: refresh cached usage/reclaim stats after truncation
Browse files Browse the repository at this point in the history
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
  • Loading branch information
dotnwat committed Aug 11, 2023
1 parent 4738a9a commit 2888c16
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/v/storage/disk_log_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,26 @@ ss::future<> disk_log_impl::truncate_prefix(truncate_prefix_config cfg) {
vassert(!_closed, "truncate_prefix() on closed log - {}", *this);
return _failure_probes.truncate_prefix().then([this, cfg]() mutable {
// dispatch the actual truncation
return do_truncate_prefix(cfg);
return do_truncate_prefix(cfg)
.then([this] {
/*
* after truncation do a quick refresh of cached variables that
* are computed during disk usage calculation. this is useful for
* providing more timely updates of reclaimable space through the
* health report.
*/
model::timestamp collection_threshold;
if (!_manager.config().delete_retention()) {
collection_threshold = model::timestamp(0);
} else {
collection_threshold = model::timestamp(
model::timestamp::now().value()
- _manager.config().delete_retention()->count());
}
return disk_usage_and_reclaimable_space(gc_config(
collection_threshold, _manager.config().retention_bytes()));
})
.discard_result();
});
}

Expand Down

0 comments on commit 2888c16

Please sign in to comment.