This commit is contained in:
kssenii 2024-11-11 21:24:18 +01:00
parent 386e16bee2
commit 5f9506cc7d
4 changed files with 4 additions and 10 deletions

View File

@ -87,6 +87,7 @@ FileCache::FileCache(const std::string & cache_name, const FileCacheSettings & s
: max_file_segment_size(settings.max_file_segment_size)
, bypass_cache_threshold(settings.enable_bypass_cache_with_threshold ? settings.bypass_cache_threshold : 0)
, boundary_alignment(settings.boundary_alignment)
, background_download_max_file_segment_size(settings.background_download_max_file_segment_size)
, load_metadata_threads(settings.load_metadata_threads)
, load_metadata_asynchronously(settings.load_metadata_asynchronously)
, write_cache_per_user_directory(settings.write_cache_per_user_id_directory)
@ -97,7 +98,6 @@ FileCache::FileCache(const std::string & cache_name, const FileCacheSettings & s
, metadata(settings.base_path,
settings.background_download_queue_size_limit,
settings.background_download_threads,
settings.background_download_max_file_segment_size,
write_cache_per_user_directory)
{
if (settings.cache_policy == "LRU")
@ -1597,7 +1597,7 @@ void FileCache::applySettingsIfPossible(const FileCacheSettings & new_settings,
if (new_settings.background_download_max_file_segment_size != actual_settings.background_download_max_file_segment_size)
{
metadata.setBackgroundDownloadMaxFileSegmentSize(new_settings.background_download_max_file_segment_size);
background_download_max_file_segment_size = new_settings.background_download_max_file_segment_size;
LOG_INFO(log, "Changed background_download_max_file_segment_size from {} to {}",
actual_settings.background_download_max_file_segment_size,

View File

@ -161,7 +161,7 @@ public:
size_t getMaxFileSegmentSize() const { return max_file_segment_size; }
size_t getBackgroundDownloadMaxFileSegmentSize() const { return metadata.getBackgroundDownloadMaxFileSegmentSize(); }
size_t getBackgroundDownloadMaxFileSegmentSize() const { return background_download_max_file_segment_size.load(); }
size_t getBoundaryAlignment() const { return boundary_alignment; }
@ -203,6 +203,7 @@ private:
std::atomic<size_t> max_file_segment_size;
const size_t bypass_cache_threshold;
const size_t boundary_alignment;
std::atomic<size_t> background_download_max_file_segment_size;
size_t load_metadata_threads;
const bool load_metadata_asynchronously;
std::atomic<bool> stop_loading_metadata = false;

View File

@ -168,7 +168,6 @@ CacheMetadata::CacheMetadata(
const std::string & path_,
size_t background_download_queue_size_limit_,
size_t background_download_threads_,
size_t background_download_max_file_segment_size_,
bool write_cache_per_user_directory_)
: path(path_)
, cleanup_queue(std::make_shared<CleanupQueue>())
@ -176,7 +175,6 @@ CacheMetadata::CacheMetadata(
, write_cache_per_user_directory(write_cache_per_user_directory_)
, log(getLogger("CacheMetadata"))
, download_threads_num(background_download_threads_)
, download_max_file_segment_size(background_download_max_file_segment_size_)
{
}

View File

@ -165,7 +165,6 @@ public:
const std::string & path_,
size_t background_download_queue_size_limit_,
size_t background_download_threads_,
size_t background_download_max_file_segment_size_,
bool write_cache_per_user_directory_);
void startup();
@ -212,9 +211,6 @@ public:
bool setBackgroundDownloadThreads(size_t threads_num);
size_t getBackgroundDownloadThreads() const { return download_threads.size(); }
void setBackgroundDownloadMaxFileSegmentSize(size_t max_file_segment_size) { download_max_file_segment_size = max_file_segment_size; }
size_t getBackgroundDownloadMaxFileSegmentSize() const { return download_max_file_segment_size; }
bool setBackgroundDownloadQueueSizeLimit(size_t size);
bool isBackgroundDownloadEnabled();
@ -246,7 +242,6 @@ private:
};
std::atomic<size_t> download_threads_num;
std::atomic<size_t> download_max_file_segment_size;
std::vector<std::shared_ptr<DownloadThread>> download_threads;
std::unique_ptr<ThreadFromGlobalPool> cleanup_thread;