diff --git a/src/v/cloud_storage/segment_meta_cstore.cc b/src/v/cloud_storage/segment_meta_cstore.cc index e2da451d654e..e94d3987438e 100644 --- a/src/v/cloud_storage/segment_meta_cstore.cc +++ b/src/v/cloud_storage/segment_meta_cstore.cc @@ -567,18 +567,19 @@ class column_store } auto& hint_vec = hint_it->second.value(); - auto hint_threshold = base_offset_iter.get_frame_initial_value(); - auto hint_initial - = hint_vec.at(static_cast(segment_meta_ix::base_offset)) - .initial; + auto hint_bo = hint_vec.at( + static_cast(segment_meta_ix::base_offset)); // The hint can only be applied within the same column_store_frame // instance. If the hint belongs to the previous frame we need to // materialize without optimization. - if (hint_initial < hint_threshold) { - return std::nullopt; + if (_base_offset + .get_frame_iterator_by_element_index(base_offset_iter.index()) + ->is_applicable(hint_bo)) { + return hint_vec; } - return hint_vec; + + return std::nullopt; }(); if (!maybe_hint) { diff --git a/src/v/cloud_storage/segment_meta_cstore.h b/src/v/cloud_storage/segment_meta_cstore.h index 45a06cf6d052..25acd528a48a 100644 --- a/src/v/cloud_storage/segment_meta_cstore.h +++ b/src/v/cloud_storage/segment_meta_cstore.h @@ -809,7 +809,7 @@ class segment_meta_column_impl } protected: - auto get_frame_iterator_by_element_index(size_t ix) { + auto get_frame_iterator_by_element_index(size_t ix) const { return std::find_if( _frames.begin(), _frames.end(), [ix](frame_t const& f) mutable { if (f.size() > ix) {