@@ -75,10 +75,11 @@ Status BetaRowset::init() {
7575namespace {
7676Status load_segment_rows_from_footer (BetaRowsetSharedPtr rowset,
7777 std::vector<uint32_t >* segment_rows, bool enable_segment_cache,
78- OlapReaderStatistics* read_stats) {
78+ OlapReaderStatistics* read_stats,
79+ const io::IOContext* io_ctx) {
7980 SegmentCacheHandle segment_cache_handle;
8081 RETURN_IF_ERROR (SegmentLoader::instance ()->load_segments (
81- rowset, &segment_cache_handle, enable_segment_cache, false , read_stats));
82+ rowset, &segment_cache_handle, enable_segment_cache, false , read_stats, io_ctx ));
8283 for (const auto & segment : segment_cache_handle.get_segments ()) {
8384 segment_rows->emplace_back (segment->num_rows ());
8485 }
@@ -106,14 +107,14 @@ Status check_segment_rows_consistency(const std::vector<uint32_t>& rows_from_met
106107} // namespace
107108
108109Status BetaRowset::get_segment_num_rows (std::vector<uint32_t >* segment_rows,
109- bool enable_segment_cache,
110- OlapReaderStatistics* read_stats ) {
110+ bool enable_segment_cache, OlapReaderStatistics* read_stats,
111+ const io::IOContext* io_ctx ) {
111112#ifndef BE_TEST
112113 // `ROWSET_UNLOADING` is state for closed() called but owned by some readers.
113114 // So here `ROWSET_UNLOADING` is allowed.
114115 DCHECK_NE (_rowset_state_machine.rowset_state (), ROWSET_UNLOADED );
115116#endif
116- RETURN_IF_ERROR (_load_segment_rows_once.call ([this , enable_segment_cache, read_stats] {
117+ RETURN_IF_ERROR (_load_segment_rows_once.call ([this , enable_segment_cache, read_stats, io_ctx ] {
117118 auto segment_count = num_segments ();
118119 if (segment_count == 0 ) {
119120 return Status::OK ();
@@ -130,7 +131,7 @@ Status BetaRowset::get_segment_num_rows(std::vector<uint32_t>* segment_rows,
130131 std::vector<uint32_t > rows_from_footer;
131132 auto self = std::dynamic_pointer_cast<BetaRowset>(shared_from_this ());
132133 auto load_status = load_segment_rows_from_footer (
133- self, &rows_from_footer, enable_segment_cache, read_stats);
134+ self, &rows_from_footer, enable_segment_cache, read_stats, io_ctx );
134135 if (load_status.ok ()) {
135136 return check_segment_rows_consistency (
136137 _segments_rows, rows_from_footer, _rowset_meta->tablet_id (),
@@ -162,7 +163,7 @@ Status BetaRowset::get_segment_num_rows(std::vector<uint32_t>* segment_rows,
162163 TEST_SYNC_POINT (" BetaRowset::get_segment_num_rows:load_from_segment_footer" );
163164 auto self = std::dynamic_pointer_cast<BetaRowset>(shared_from_this ());
164165 return load_segment_rows_from_footer (self, &_segments_rows, enable_segment_cache,
165- read_stats);
166+ read_stats, io_ctx );
166167 }));
167168 segment_rows->assign (_segments_rows.cbegin (), _segments_rows.cend ());
168169 return Status::OK ();
@@ -258,7 +259,8 @@ Status BetaRowset::load_segments(int64_t seg_id_begin, int64_t seg_id_end,
258259}
259260
260261Status BetaRowset::load_segment (int64_t seg_id, OlapReaderStatistics* stats,
261- segment_v2::SegmentSharedPtr* segment) {
262+ segment_v2::SegmentSharedPtr* segment,
263+ const io::IOContext* io_ctx) {
262264 auto fs = _rowset_meta->fs ();
263265 if (!fs) {
264266 return Status::Error<INIT_FAILED >(" get fs failed" );
@@ -278,7 +280,7 @@ Status BetaRowset::load_segment(int64_t seg_id, OlapReaderStatistics* stats,
278280 auto s = segment_v2::Segment::open (
279281 fs, seg_path, _rowset_meta->tablet_id (), static_cast <uint32_t >(seg_id), rowset_id (),
280282 _schema, reader_options, segment,
281- _rowset_meta->inverted_index_file_info (static_cast <int >(seg_id)), stats);
283+ _rowset_meta->inverted_index_file_info (static_cast <int >(seg_id)), stats, io_ctx );
282284 if (!s.ok ()) {
283285 LOG (WARNING ) << " failed to open segment. " << seg_path << " under rowset " << rowset_id ()
284286 << " : " << s.to_string ();
0 commit comments