mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Allow to disable background cache download for reading metadata files
This commit is contained in:
parent
29713dc3f7
commit
66bbf11e07
@ -546,6 +546,7 @@ The server successfully detected this situation and will download merged part fr
|
||||
M(FilesystemCacheLoadMetadataMicroseconds, "Time spent loading filesystem cache metadata", ValueType::Microseconds) \
|
||||
M(FilesystemCacheEvictedBytes, "Number of bytes evicted from filesystem cache", ValueType::Bytes) \
|
||||
M(FilesystemCacheEvictedFileSegments, "Number of file segments evicted from filesystem cache", ValueType::Number) \
|
||||
M(FilesystemCacheBackgroundDownloadQueuePush, "Number of file segments sent for background download in filesystem cache", ValueType::Number) \
|
||||
M(FilesystemCacheEvictionSkippedFileSegments, "Number of file segments skipped for eviction because of being in unreleasable state", ValueType::Number) \
|
||||
M(FilesystemCacheEvictionSkippedEvictingFileSegments, "Number of file segments skipped for eviction because of being in evicting state", ValueType::Number) \
|
||||
M(FilesystemCacheEvictionTries, "Number of filesystem cache eviction attempts", ValueType::Number) \
|
||||
|
@ -4842,6 +4842,9 @@ Limit on size of a single batch of file segments that a read buffer can request
|
||||
)", 0) \
|
||||
M(UInt64, filesystem_cache_reserve_space_wait_lock_timeout_milliseconds, 1000, R"(
|
||||
Wait time to lock cache for space reservation in filesystem cache
|
||||
)", 0) \
|
||||
M(Bool, filesystem_cache_enable_background_download_for_metadata_files, true, R"(
|
||||
Enable background download for metadata files in filesystem cache (related to background_download_threads cache settings)
|
||||
)", 0) \
|
||||
M(UInt64, temporary_data_in_cache_reserve_space_wait_lock_timeout_milliseconds, (10 * 60 * 1000), R"(
|
||||
Wait time to lock cache for space reservation for temporary data in filesystem cache
|
||||
|
@ -104,6 +104,7 @@ static std::initializer_list<std::pair<ClickHouseVersion, SettingsChangesHistory
|
||||
{"allow_reorder_prewhere_conditions", false, true, "New setting"},
|
||||
{"input_format_parquet_bloom_filter_push_down", false, true, "When reading Parquet files, skip whole row groups based on the WHERE/PREWHERE expressions and bloom filter in the Parquet metadata."},
|
||||
{"date_time_64_output_format_cut_trailing_zeros_align_to_groups_of_thousands", false, false, "Dynamically trim the trailing zeros of datetime64 values to adjust the output scale to (0, 3, 6), corresponding to 'seconds', 'milliseconds', and 'microseconds'."}
|
||||
{"filesystem_cache_enable_background_download_for_metadata_files", true, true, "New setting"},
|
||||
}
|
||||
},
|
||||
{"24.9",
|
||||
|
@ -535,7 +535,7 @@ bool CachedOnDiskReadBufferFromFile::completeFileSegmentAndGetNext()
|
||||
chassert(file_offset_of_buffer_end > completed_range.right);
|
||||
cache_file_reader.reset();
|
||||
|
||||
file_segments->popFront();
|
||||
file_segments->completeAndPopFront(settings.filesystem_cache_allow_background_download);
|
||||
if (file_segments->empty() && !nextFileSegmentsBatch())
|
||||
return false;
|
||||
|
||||
|
@ -196,7 +196,7 @@ void FileSegmentRangeWriter::completeFileSegment()
|
||||
if (file_segment.isDetached() || file_segment.isCompleted())
|
||||
return;
|
||||
|
||||
file_segment.complete();
|
||||
file_segment.complete(false);
|
||||
appendFilesystemCacheLog(file_segment);
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ void FileSegmentRangeWriter::jumpToPosition(size_t position)
|
||||
if (position < current_write_offset)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Cannot jump backwards: {} < {}", position, current_write_offset);
|
||||
|
||||
file_segment.complete();
|
||||
file_segment.complete(false);
|
||||
file_segments.reset();
|
||||
}
|
||||
expected_write_offset = position;
|
||||
|
@ -106,6 +106,7 @@ struct ReadSettings
|
||||
bool enable_filesystem_cache_log = false;
|
||||
size_t filesystem_cache_segments_batch_size = 20;
|
||||
size_t filesystem_cache_reserve_space_wait_lock_timeout_milliseconds = 1000;
|
||||
bool filesystem_cache_allow_background_download = true;
|
||||
|
||||
bool use_page_cache_for_disks_without_file_cache = false;
|
||||
bool read_from_page_cache_if_exists_otherwise_bypass_cache = false;
|
||||
|
@ -627,7 +627,7 @@ void FileSegment::completePartAndResetDownloader()
|
||||
LOG_TEST(log, "Complete batch. ({})", getInfoForLogUnlocked(lk));
|
||||
}
|
||||
|
||||
void FileSegment::complete()
|
||||
void FileSegment::complete(bool allow_background_download)
|
||||
{
|
||||
ProfileEventTimeIncrement<Microseconds> watch(ProfileEvents::FileSegmentCompleteMicroseconds);
|
||||
|
||||
@ -704,7 +704,7 @@ void FileSegment::complete()
|
||||
if (is_last_holder)
|
||||
{
|
||||
bool added_to_download_queue = false;
|
||||
if (background_download_enabled && remote_file_reader)
|
||||
if (allow_background_download && background_download_enabled && remote_file_reader)
|
||||
{
|
||||
added_to_download_queue = locked_key->addToDownloadQueue(offset(), segment_lock); /// Finish download in background.
|
||||
}
|
||||
@ -1001,7 +1001,7 @@ void FileSegmentsHolder::reset()
|
||||
|
||||
ProfileEvents::increment(ProfileEvents::FilesystemCacheUnusedHoldFileSegments, file_segments.size());
|
||||
for (auto file_segment_it = file_segments.begin(); file_segment_it != file_segments.end();)
|
||||
file_segment_it = completeAndPopFrontImpl();
|
||||
file_segment_it = completeAndPopFrontImpl(false);
|
||||
file_segments.clear();
|
||||
}
|
||||
|
||||
@ -1010,9 +1010,9 @@ FileSegmentsHolder::~FileSegmentsHolder()
|
||||
reset();
|
||||
}
|
||||
|
||||
FileSegments::iterator FileSegmentsHolder::completeAndPopFrontImpl()
|
||||
FileSegments::iterator FileSegmentsHolder::completeAndPopFrontImpl(bool allow_background_download)
|
||||
{
|
||||
front().complete();
|
||||
front().complete(allow_background_download);
|
||||
CurrentMetrics::sub(CurrentMetrics::FilesystemCacheHoldFileSegments);
|
||||
return file_segments.erase(file_segments.begin());
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ public:
|
||||
* ========== Methods that must do cv.notify() ==================
|
||||
*/
|
||||
|
||||
void complete();
|
||||
void complete(bool allow_background_download);
|
||||
|
||||
void completePartAndResetDownloader();
|
||||
|
||||
@ -297,7 +297,7 @@ struct FileSegmentsHolder final : private boost::noncopyable
|
||||
|
||||
String toString(bool with_state = false) const;
|
||||
|
||||
void popFront() { completeAndPopFrontImpl(); }
|
||||
void completeAndPopFront(bool allow_background_download) { completeAndPopFrontImpl(allow_background_download); }
|
||||
|
||||
FileSegment & front() { return *file_segments.front(); }
|
||||
const FileSegment & front() const { return *file_segments.front(); }
|
||||
@ -319,7 +319,7 @@ struct FileSegmentsHolder final : private boost::noncopyable
|
||||
private:
|
||||
FileSegments file_segments{};
|
||||
|
||||
FileSegments::iterator completeAndPopFrontImpl();
|
||||
FileSegments::iterator completeAndPopFrontImpl(bool allow_background_download);
|
||||
};
|
||||
|
||||
using FileSegmentsHolderPtr = std::unique_ptr<FileSegmentsHolder>;
|
||||
|
@ -239,6 +239,7 @@ namespace Setting
|
||||
extern const SettingsUInt64 use_structure_from_insertion_table_in_table_functions;
|
||||
extern const SettingsString workload;
|
||||
extern const SettingsString compatibility;
|
||||
extern const SettingsBool filesystem_cache_enable_background_download_for_metadata_files;
|
||||
}
|
||||
|
||||
namespace MergeTreeSetting
|
||||
@ -5687,6 +5688,7 @@ ReadSettings Context::getReadSettings() const
|
||||
res.filesystem_cache_segments_batch_size = settings_ref[Setting::filesystem_cache_segments_batch_size];
|
||||
res.filesystem_cache_reserve_space_wait_lock_timeout_milliseconds
|
||||
= settings_ref[Setting::filesystem_cache_reserve_space_wait_lock_timeout_milliseconds];
|
||||
res.filesystem_cache_allow_background_download = settings_ref[Setting::filesystem_cache_enable_background_download_for_metadata_files];
|
||||
|
||||
res.filesystem_cache_max_download_size = settings_ref[Setting::filesystem_cache_max_download_size];
|
||||
res.skip_download_if_exceeds_query_cache = settings_ref[Setting::skip_download_if_exceeds_query_cache];
|
||||
|
Loading…
Reference in New Issue
Block a user