Merge pull request #73281 from ClickHouse/update-settings

Add a setting
This commit is contained in:
Kseniia Sumarokova 2024-12-16 23:31:50 +00:00 committed by GitHub
commit 2a7c6492f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 13 additions and 3 deletions

View File

@ -5217,7 +5217,7 @@ Only in ClickHouse Cloud. Wait time in milliseconds to receive connection from c
DECLARE(Bool, distributed_cache_bypass_connection_pool, false, R"( DECLARE(Bool, distributed_cache_bypass_connection_pool, false, R"(
Only in ClickHouse Cloud. Allow to bypass distributed cache connection pool Only in ClickHouse Cloud. Allow to bypass distributed cache connection pool
)", 0) \ )", 0) \
DECLARE(DistributedCachePoolBehaviourOnLimit, distributed_cache_pool_behaviour_on_limit, DistributedCachePoolBehaviourOnLimit::ALLOCATE_NEW_BYPASSING_POOL, R"( DECLARE(DistributedCachePoolBehaviourOnLimit, distributed_cache_pool_behaviour_on_limit, DistributedCachePoolBehaviourOnLimit::WAIT, R"(
Only in ClickHouse Cloud. Identifies behaviour of distributed cache connection on pool limit reached Only in ClickHouse Cloud. Identifies behaviour of distributed cache connection on pool limit reached
)", 0) \ )", 0) \
DECLARE(UInt64, distributed_cache_read_alignment, 0, R"( DECLARE(UInt64, distributed_cache_read_alignment, 0, R"(
@ -5231,6 +5231,9 @@ Only in ClickHouse Cloud. A window for sending ACK for DataPacket sequence in a
)", 0) \ )", 0) \
DECLARE(Bool, distributed_cache_discard_connection_if_unread_data, true, R"( DECLARE(Bool, distributed_cache_discard_connection_if_unread_data, true, R"(
Only in ClickHouse Cloud. Discard connection if some data is unread. Only in ClickHouse Cloud. Discard connection if some data is unread.
)", 0) \
DECLARE(Bool, distributed_cache_min_bytes_for_seek, 0, R"(
Only in ClickHouse Cloud. Minimum number of bytes to do seek in distributed cache.
)", 0) \ )", 0) \
DECLARE(Bool, filesystem_cache_enable_background_download_for_metadata_files_in_packed_storage, true, R"( DECLARE(Bool, filesystem_cache_enable_background_download_for_metadata_files_in_packed_storage, true, R"(
Only in ClickHouse Cloud. Wait time to lock cache for space reservation in filesystem cache Only in ClickHouse Cloud. Wait time to lock cache for space reservation in filesystem cache

View File

@ -60,6 +60,7 @@ static std::initializer_list<std::pair<ClickHouseVersion, SettingsChangesHistory
{ {
{"25.1", {"25.1",
{ {
{"distributed_cache_min_bytes_for_seek", false, false, "New private setting."},
} }
}, },

View File

@ -47,12 +47,14 @@ AsynchronousBoundedReadBuffer::AsynchronousBoundedReadBuffer(
IAsynchronousReader & reader_, IAsynchronousReader & reader_,
const ReadSettings & settings_, const ReadSettings & settings_,
size_t buffer_size_, size_t buffer_size_,
size_t min_bytes_for_seek_,
AsyncReadCountersPtr async_read_counters_, AsyncReadCountersPtr async_read_counters_,
FilesystemReadPrefetchesLogPtr prefetches_log_) FilesystemReadPrefetchesLogPtr prefetches_log_)
: ReadBufferFromFileBase(0, nullptr, 0) : ReadBufferFromFileBase(0, nullptr, 0)
, impl(std::move(impl_)) , impl(std::move(impl_))
, read_settings(settings_) , read_settings(settings_)
, buffer_size(buffer_size_) , buffer_size(buffer_size_)
, min_bytes_for_seek(min_bytes_for_seek_)
, reader(reader_) , reader(reader_)
, query_id(CurrentThread::isInitialized() && CurrentThread::get().getQueryContext() != nullptr ? CurrentThread::getQueryId() : "") , query_id(CurrentThread::isInitialized() && CurrentThread::get().getQueryContext() != nullptr ? CurrentThread::getQueryId() : "")
, current_reader_id(getRandomASCIIString(8)) , current_reader_id(getRandomASCIIString(8))
@ -337,7 +339,7 @@ off_t AsynchronousBoundedReadBuffer::seek(off_t offset, int whence)
* Note: we read in range [file_offset_of_buffer_end, read_until_position). * Note: we read in range [file_offset_of_buffer_end, read_until_position).
*/ */
if (!impl->isSeekCheap() && file_offset_of_buffer_end && read_until_position && new_pos < *read_until_position if (!impl->isSeekCheap() && file_offset_of_buffer_end && read_until_position && new_pos < *read_until_position
&& new_pos > file_offset_of_buffer_end && new_pos < file_offset_of_buffer_end + read_settings.remote_read_min_bytes_for_seek) && new_pos > file_offset_of_buffer_end && new_pos < file_offset_of_buffer_end + min_bytes_for_seek)
{ {
ProfileEvents::increment(ProfileEvents::RemoteFSLazySeeks); ProfileEvents::increment(ProfileEvents::RemoteFSLazySeeks);
bytes_to_ignore = new_pos - file_offset_of_buffer_end; bytes_to_ignore = new_pos - file_offset_of_buffer_end;

View File

@ -28,6 +28,7 @@ public:
IAsynchronousReader & reader_, IAsynchronousReader & reader_,
const ReadSettings & settings_, const ReadSettings & settings_,
size_t buffer_size_, size_t buffer_size_,
size_t min_bytes_for_seek_,
AsyncReadCountersPtr async_read_counters_ = nullptr, AsyncReadCountersPtr async_read_counters_ = nullptr,
FilesystemReadPrefetchesLogPtr prefetches_log_ = nullptr); FilesystemReadPrefetchesLogPtr prefetches_log_ = nullptr);
@ -55,6 +56,7 @@ private:
const ImplPtr impl; const ImplPtr impl;
const ReadSettings read_settings; const ReadSettings read_settings;
const size_t buffer_size; const size_t buffer_size;
const size_t min_bytes_for_seek;
IAsynchronousReader & reader; IAsynchronousReader & reader;
size_t file_offset_of_buffer_end = 0; size_t file_offset_of_buffer_end = 0;

View File

@ -732,6 +732,7 @@ std::unique_ptr<ReadBufferFromFileBase> DiskObjectStorage::readFile(
reader, reader,
read_settings, read_settings,
buffer_size, buffer_size,
read_settings.remote_read_min_bytes_for_seek, /// Modified in private repo.
global_context->getAsyncReadCounters(), global_context->getAsyncReadCounters(),
global_context->getFilesystemReadPrefetchesLog()); global_context->getFilesystemReadPrefetchesLog());

View File

@ -51,7 +51,7 @@ TEST_F(AsynchronousBoundedReadBufferTest, setReadUntilPosition)
for (bool with_prefetch : {false, true}) for (bool with_prefetch : {false, true})
{ {
AsynchronousBoundedReadBuffer read_buffer(createReadBufferFromFileBase(file_path, {}), remote_fs_reader, {}, DBMS_DEFAULT_BUFFER_SIZE); AsynchronousBoundedReadBuffer read_buffer(createReadBufferFromFileBase(file_path, {}), remote_fs_reader, {}, DBMS_DEFAULT_BUFFER_SIZE, 0);
read_buffer.setReadUntilPosition(20); read_buffer.setReadUntilPosition(20);
auto try_read = [&](size_t count) auto try_read = [&](size_t count)

View File

@ -572,6 +572,7 @@ std::unique_ptr<ReadBufferFromFileBase> StorageObjectStorageSource::createReadBu
reader, reader,
modified_read_settings, modified_read_settings,
buffer_size, buffer_size,
modified_read_settings.remote_read_min_bytes_for_seek,
context_->getAsyncReadCounters(), context_->getAsyncReadCounters(),
context_->getFilesystemReadPrefetchesLog()); context_->getFilesystemReadPrefetchesLog());