Skip to content

Commit

Permalink
Merge pull request #23399 from nvartolomei/nv/adjacent-segment-merger…
Browse files Browse the repository at this point in the history
…-better-sizing

archival: use correct segment size in adjacent segment merger
  • Loading branch information
nvartolomei authored Sep 23, 2024
2 parents 4aa39db + 15b43c6 commit c80c354
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
11 changes: 4 additions & 7 deletions src/v/cluster/archival/ntp_archiver_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3239,13 +3239,10 @@ ss::future<bool> ntp_archiver::do_upload_remote(
}

size_t ntp_archiver::get_local_segment_size() const {
auto log_segment_size = config::shard_local_cfg().log_segment_size.value();
const auto& cfg = _parent.raft()->log_config();
if (cfg.has_overrides()) {
log_segment_size = cfg.get_overrides().segment_size.value_or(
log_segment_size);
}
return log_segment_size;
auto& disk_log = dynamic_cast<storage::disk_log_impl&>(
*_parent.raft()->log());

return disk_log.max_segment_size();
}

ss::future<bool>
Expand Down
3 changes: 2 additions & 1 deletion src/v/storage/disk_log_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ class disk_log_impl final : public log {
static ss::future<>
remove_kvstore_state(const model::ntp&, storage::kvstore&);

size_t max_segment_size() const;

private:
friend class disk_log_appender; // for multi-term appends
friend class disk_log_builder; // for tests
Expand Down Expand Up @@ -352,7 +354,6 @@ class disk_log_impl final : public log {
size_t get_log_truncation_counter() const noexcept override;

private:
size_t max_segment_size() const;
// Computes the segment size based on the latest max_segment_size
// configuration. This takes into consideration any segment size
// overrides since the last time it was called.
Expand Down

0 comments on commit c80c354

Please sign in to comment.