| 1372 | } |
| 1373 | |
| 1374 | StorageFileSource::StorageFileSource( |
| 1375 | const ReadFromFormatInfo & info, |
| 1376 | std::shared_ptr<StorageFile> storage_, |
| 1377 | const ContextPtr & context_, |
| 1378 | UInt64 max_block_size_, |
| 1379 | FilesIteratorPtr files_iterator_, |
| 1380 | std::unique_ptr<ReadBuffer> read_buf_, |
| 1381 | bool need_only_count_, |
| 1382 | FormatParserSharedResourcesPtr parser_shared_resources_, |
| 1383 | FormatFilterInfoPtr format_filter_info_) |
| 1384 | : ISource(std::make_shared<const Block>(info.source_header), false) |
| 1385 | , WithContext(context_) |
| 1386 | , storage(std::move(storage_)) |
| 1387 | , files_iterator(std::move(files_iterator_)) |
| 1388 | , read_buf(std::move(read_buf_)) |
| 1389 | , parser_shared_resources(std::move(parser_shared_resources_)) |
| 1390 | , format_filter_info(std::move(format_filter_info_)) |
| 1391 | , columns_description(info.columns_description) |
| 1392 | , requested_columns(info.requested_columns) |
| 1393 | , requested_virtual_columns(info.requested_virtual_columns) |
| 1394 | , block_for_format(info.format_header) |
| 1395 | , serialization_hints(info.serialization_hints) |
| 1396 | , hive_partition_columns_to_read_from_file_path(info.hive_partition_columns_to_read_from_file_path) |
| 1397 | , max_block_size(max_block_size_) |
| 1398 | , need_only_count(need_only_count_) |
| 1399 | { |
| 1400 | if (!storage->use_table_fd) |
| 1401 | { |
| 1402 | shared_lock = std::shared_lock(storage->rwlock, getLockTimeout(getContext())); |
| 1403 | if (!shared_lock) |
| 1404 | throw Exception(ErrorCodes::TIMEOUT_EXCEEDED, "Lock timeout exceeded"); |
| 1405 | storage->readers_counter.fetch_add(1, std::memory_order_release); |
| 1406 | } |
| 1407 | } |
| 1408 | |
| 1409 | void StorageFileSource::beforeDestroy() |
| 1410 | { |
nothing calls this directly
no test coverage detected