Skip to content

Commit

Permalink
cloud_storage: Clean up segment hydration
Browse files Browse the repository at this point in the history
When segment is hydrated, we are guaranteed to be in legacy mode, which
means that we were not able to download an index from cloud storage.
The change cleans up the code path in segment hydration, so that if a
segment is downloaded, an index is always created on the fly from the
segment data.
  • Loading branch information
abhijat committed Jun 29, 2023
1 parent fc95469 commit 158061e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/v/cloud_storage/remote_segment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -495,13 +495,11 @@ ss::future<> remote_segment::do_hydrate_segment() {
_bucket,
_path,
[this, &reservation](uint64_t size_bytes, ss::input_stream<char> s) {
if (is_legacy_mode_engaged()) {
return put_segment_in_cache_and_create_index(
size_bytes, reservation, std::move(s));
} else {
return put_segment_in_cache(
size_bytes, reservation, std::move(s));
}
// Always create the index because we are in legacy mode if we ended
// up hydrating the segment. Legacy mode indicates a missing index, so
// we create it here on the fly using the downloaded segment.
return put_segment_in_cache_and_create_index(
size_bytes, reservation, std::move(s));
},
local_rtc);

Expand Down

0 comments on commit 158061e

Please sign in to comment.