@@ -58,7 +58,7 @@ DMFilePackFilterResultPtr DMFilePackFilter::load()
5858 auto read_all_packs = (rowkey_ranges.size () == 1 && rowkey_ranges[0 ].all ()) || rowkey_ranges.empty ();
5959 if (!read_all_packs)
6060 {
61- tryLoadIndex (result.param , MutSup::extra_handle_id);
61+ tryLoadIndex (result.param , MutSup::extra_handle_id, block_wait );
6262 std::vector<RSOperatorPtr> handle_filters;
6363 for (auto & rowkey_range : rowkey_ranges)
6464 handle_filters.emplace_back (toFilter (rowkey_range));
@@ -129,7 +129,7 @@ DMFilePackFilterResultPtr DMFilePackFilter::load()
129129 ColIds ids = filter->getColumnIDs ();
130130 for (const auto & id : ids)
131131 {
132- tryLoadIndex (result.param , id);
132+ tryLoadIndex (result.param , id, block_wait );
133133 }
134134
135135 const auto check_results = filter->roughCheck (0 , pack_count, result.param );
@@ -189,13 +189,21 @@ void DMFilePackFilter::loadIndex(
189189 const DMFilePtr & dmfile,
190190 const FileProviderPtr & file_provider,
191191 const MinMaxIndexCachePtr & index_cache,
192+ bool block_wait,
192193 bool set_cache_if_miss,
193194 ColId col_id,
194195 const ReadLimiterPtr & read_limiter,
195196 const ScanContextPtr & scan_context)
196197{
197- auto [type, minmax_index]
198- = loadIndex (*dmfile, file_provider, index_cache, set_cache_if_miss, col_id, read_limiter, scan_context);
198+ auto [type, minmax_index] = loadIndex (
199+ *dmfile,
200+ file_provider,
201+ index_cache,
202+ block_wait,
203+ set_cache_if_miss,
204+ col_id,
205+ read_limiter,
206+ scan_context);
199207 indexes.emplace (col_id, RSIndex (type, minmax_index));
200208}
201209
@@ -214,6 +222,7 @@ class MinMaxIndexLoader
214222 auto index_guard = S3::S3RandomAccessFile::setReadFileInfo ({
215223 .size = dmfile.getReadFileSize (col_id, colIndexFileName (file_name_base)),
216224 .scan_context = scan_context,
225+ .block_wait = block_wait,
217226 });
218227
219228 if (likely (dmfile.useMetaV2 ()))
@@ -238,6 +247,7 @@ class MinMaxIndexLoader
238247 const DMFile & dmfile_,
239248 const FileProviderPtr & file_provider_,
240249 ColId col_id_,
250+ bool block_wait_,
241251 const ReadLimiterPtr & read_limiter_,
242252 const ScanContextPtr & scan_context_)
243253 : dmfile(dmfile_)
@@ -246,6 +256,7 @@ class MinMaxIndexLoader
246256 , file_provider(file_provider_)
247257 , read_limiter(read_limiter_)
248258 , scan_context(scan_context_)
259+ , block_wait(block_wait_)
249260 {}
250261
251262 const DMFile & dmfile;
@@ -254,6 +265,7 @@ class MinMaxIndexLoader
254265 FileProviderPtr file_provider;
255266 ReadLimiterPtr read_limiter;
256267 ScanContextPtr scan_context;
268+ bool block_wait = false ;
257269
258270private:
259271 MinMaxIndexPtr loadRawMinMaxIndex (const DataTypePtr & type, size_t index_file_size) const
@@ -339,6 +351,7 @@ std::pair<DataTypePtr, MinMaxIndexPtr> DMFilePackFilter::loadIndex(
339351 const DMFile & dmfile,
340352 const FileProviderPtr & file_provider,
341353 const MinMaxIndexCachePtr & index_cache,
354+ bool block_wait,
342355 bool set_cache_if_miss,
343356 ColId col_id,
344357 const ReadLimiterPtr & read_limiter,
@@ -350,7 +363,7 @@ std::pair<DataTypePtr, MinMaxIndexPtr> DMFilePackFilter::loadIndex(
350363 MinMaxIndexPtr minmax_index;
351364 if (index_cache && set_cache_if_miss)
352365 {
353- auto loader = MinMaxIndexLoader (dmfile, file_provider, col_id, read_limiter, scan_context);
366+ auto loader = MinMaxIndexLoader (dmfile, file_provider, col_id, block_wait, read_limiter, scan_context);
354367 minmax_index = index_cache->getOrSet (dmfile.colIndexCacheKey (file_name_base), loader);
355368 }
356369 else
@@ -359,12 +372,12 @@ std::pair<DataTypePtr, MinMaxIndexPtr> DMFilePackFilter::loadIndex(
359372 if (index_cache)
360373 minmax_index = index_cache->get (dmfile.colIndexCacheKey (file_name_base));
361374 if (minmax_index == nullptr )
362- minmax_index = MinMaxIndexLoader (dmfile, file_provider, col_id, read_limiter, scan_context)();
375+ minmax_index = MinMaxIndexLoader (dmfile, file_provider, col_id, block_wait, read_limiter, scan_context)();
363376 }
364377 return {type, minmax_index};
365378}
366379
367- void DMFilePackFilter::tryLoadIndex (RSCheckParam & param, ColId col_id)
380+ void DMFilePackFilter::tryLoadIndex (RSCheckParam & param, ColId col_id, bool block_wait )
368381{
369382 if (param.indexes .count (col_id))
370383 return ;
@@ -373,7 +386,16 @@ void DMFilePackFilter::tryLoadIndex(RSCheckParam & param, ColId col_id)
373386 return ;
374387
375388 Stopwatch watch;
376- loadIndex (param.indexes , dmfile, file_provider, index_cache, set_cache_if_miss, col_id, read_limiter, scan_context);
389+ loadIndex (
390+ param.indexes ,
391+ dmfile,
392+ file_provider,
393+ index_cache,
394+ block_wait,
395+ set_cache_if_miss,
396+ col_id,
397+ read_limiter,
398+ scan_context);
377399}
378400
379401std::pair<std::vector<DMFilePackFilter::Range>, DMFilePackFilterResults> DMFilePackFilter::getSkippedRangeAndFilter (
0 commit comments