ClickHouse/src/IO/ReadSettings.h

111 lines
3.2 KiB
C++
Raw Normal View History

2021-08-16 00:00:32 +00:00
#pragma once
#include <cstddef>
2021-08-27 00:35:04 +00:00
#include <string>
2021-08-16 00:00:32 +00:00
#include <Core/Defines.h>
2022-01-13 11:57:56 +00:00
#include <Common/FileCache_fwd.h>
#include <Common/Throttler_fwd.h>
2021-08-16 00:00:32 +00:00
namespace DB
{
2021-09-20 13:59:44 +00:00
enum class LocalFSReadMethod
2021-08-16 00:00:32 +00:00
{
2021-09-06 15:59:46 +00:00
/**
* Simple synchronous reads with 'read'.
* Can use direct IO after specified size.
* Can use prefetch by asking OS to perform readahead.
*/
read,
/**
* Simple synchronous reads with 'pread'.
* In contrast to 'read', shares single file descriptor from multiple threads.
* Can use direct IO after specified size.
* Can use prefetch by asking OS to perform readahead.
*/
pread,
/**
* Use mmap after specified size or simple synchronous reads with 'pread'.
* Can use prefetch by asking OS to perform readahead.
*/
mmap,
/**
* Checks if data is in page cache with 'preadv2' on modern Linux kernels.
* If data is in page cache, read from the same thread.
* If not, offload IO to separate threadpool.
* Can do prefetch with double buffering.
* Can use specified priorities and limit the number of concurrent reads.
*/
pread_threadpool,
/// Use asynchronous reader with fake backend that in fact synchronous.
/// @attention Use only for testing purposes.
pread_fake_async
2021-08-16 00:00:32 +00:00
};
2021-09-20 13:59:44 +00:00
enum class RemoteFSReadMethod
{
read,
2021-11-10 07:46:18 +00:00
threadpool,
2021-09-20 13:59:44 +00:00
};
2021-08-16 00:00:32 +00:00
class MMappedFileCache;
struct ReadSettings
{
/// Method to use reading from local filesystem.
2021-09-20 13:59:44 +00:00
LocalFSReadMethod local_fs_method = LocalFSReadMethod::pread;
/// Method to use reading from remote filesystem.
2022-05-11 16:32:31 +00:00
RemoteFSReadMethod remote_fs_method = RemoteFSReadMethod::threadpool;
2021-08-16 00:00:32 +00:00
size_t local_fs_buffer_size = DBMS_DEFAULT_BUFFER_SIZE;
size_t remote_fs_buffer_size = DBMS_DEFAULT_BUFFER_SIZE;
bool local_fs_prefetch = false;
bool remote_fs_prefetch = false;
/// For 'read', 'pread' and 'pread_threadpool' methods.
size_t direct_io_threshold = 0;
/// For 'mmap' method.
size_t mmap_threshold = 0;
MMappedFileCache * mmap_cache = nullptr;
/// For 'pread_threadpool' method. Lower is more priority.
size_t priority = 0;
2021-08-24 21:45:58 +00:00
2021-10-07 13:39:54 +00:00
size_t remote_fs_read_max_backoff_ms = 10000;
size_t remote_fs_read_backoff_max_tries = 4;
2022-03-30 11:47:44 +00:00
bool enable_filesystem_cache = true;
size_t filesystem_cache_max_wait_sec = 1;
bool read_from_filesystem_cache_if_exists_otherwise_bypass_cache = false;
bool enable_filesystem_cache_log = false;
size_t max_query_cache_size = (128UL * 1024 * 1024 * 1024);
bool skip_download_if_exceeds_query_cache = true;
2021-10-07 13:39:54 +00:00
2021-10-31 19:53:24 +00:00
size_t remote_read_min_bytes_for_seek = DBMS_DEFAULT_BUFFER_SIZE;
2022-01-13 11:57:56 +00:00
FileCachePtr remote_fs_cache;
/// Bandwidth throttler to use during reading
2022-07-14 15:33:22 +00:00
ThrottlerPtr remote_throttler;
Squashed commit of the following: commit a1acc7ed3485bd158cf42f26b2d2a1bca84b7269 Author: kssenii <sumarokovakseniia@mail.ru> Date: Sun Oct 31 14:47:25 2021 +0000 Fix commit 12a27d445b1a9e054a4d3d3874702bb950e32918 Author: kssenii <sumarokovakseniia@mail.ru> Date: Fri Oct 29 09:24:53 2021 +0000 Adjutments after merge with master commit f17e321a7352b546fbcd8a7a39e6978bab40e6d3 Merge: 55f1ba857d2 11b70a285c0 Author: kssenii <sumarokovakseniia@mail.ru> Date: Fri Oct 29 08:03:25 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http commit 55f1ba857d248932422697c61f26a05ef2b98e56 Author: kssenii <sumarokovakseniia@mail.ru> Date: Fri Oct 29 07:38:42 2021 +0000 Small fixes commit aeba8104d1e3f027e540deedbbcdecac0abd4686 Author: kssenii <sumarokovakseniia@mail.ru> Date: Thu Oct 28 10:28:05 2021 +0000 Some more fixes commit 82f3754b8a462c32a7a6b0d7bc8fa31752ee06dd Author: kssenii <sumarokovakseniia@mail.ru> Date: Wed Oct 27 20:20:15 2021 +0000 Slightly better commit 2647b88a665dfc0c2ee549c9d900d2a03d70653c Merge: 7024f51b55d 2bb586bed36 Author: kssenii <sumarokovakseniia@mail.ru> Date: Wed Oct 27 19:38:19 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http commit 7024f51b55d39aad7d6ef48ebc32ed1872278743 Author: kssenii <sumarokovakseniia@mail.ru> Date: Wed Oct 27 18:30:25 2021 +0000 Review fixes and add test commit 7de5fca07564487434196fc55d0e4fcb94a82c22 Merge: 1ecb6ad05d0 855b10261c8 Author: kssenii <sumarokovakseniia@mail.ru> Date: Sun Oct 24 17:04:24 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http commit 1ecb6ad05d0c50a67e1d6fdd0492965e6ecd043b Author: kssenii <sumarokovakseniia@mail.ru> Date: Sat Oct 23 18:53:59 2021 +0000 Better commit 710ee96878f66562da4e62413a11eef1bdc446f7 Merge: 28d2485716c 158b4c26b72 Author: kssenii <sumarokovakseniia@mail.ru> Date: Mon Oct 18 08:31:25 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http commit 28d2485716c1653e360d823ebddac2446ebe9c75 Author: kssenii <sumarokovakseniia@mail.ru> Date: Fri Oct 15 17:27:26 2021 +0000 Some fixes commit 7c20ca07b77fc7fa4d510e53d19c14a32b92f276 Author: kssenii <sumarokovakseniia@mail.ru> Date: Fri Oct 15 12:59:24 2021 +0000 Fix style check commit ccb02cac560b1514b416ce7ebe00de676d50d9b8 Merge: 9e4fe0f3c8a d1138a8a259 Author: kssenii <sumarokovakseniia@mail.ru> Date: Fri Oct 15 12:36:30 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http commit 9e4fe0f3c8aab60593da8f215a8e9bc15284cb7e Merge: 9814cb1b45c daed77038bd Author: kssenii <sumarokovakseniia@mail.ru> Date: Tue Oct 12 09:58:15 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http commit 9814cb1b45c5499ce6bf17047ebbb3136140b996 Merge: 1c8b1b1133e 969999ff10c Author: kssenii <sumarokovakseniia@mail.ru> Date: Tue Oct 12 09:49:08 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http commit 1c8b1b1133e0cb49c5407d4c8ebb39e70b6c305c Author: kssenii <sumarokovakseniia@mail.ru> Date: Tue Oct 12 09:33:07 2021 +0000 Better commit e7dbfff5d2a093ecc872f6028fdb93e3c1a0df76 Merge: 3329b668d6f 198adc7ecd2 Author: kssenii <sumarokovakseniia@mail.ru> Date: Tue Oct 12 06:19:15 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http
2021-10-31 14:53:08 +00:00
size_t http_max_tries = 1;
size_t http_retry_initial_backoff_ms = 100;
size_t http_retry_max_backoff_ms = 1600;
2022-02-07 19:40:47 +00:00
bool http_skip_not_found_url_for_globs = true;
Squashed commit of the following: commit a1acc7ed3485bd158cf42f26b2d2a1bca84b7269 Author: kssenii <sumarokovakseniia@mail.ru> Date: Sun Oct 31 14:47:25 2021 +0000 Fix commit 12a27d445b1a9e054a4d3d3874702bb950e32918 Author: kssenii <sumarokovakseniia@mail.ru> Date: Fri Oct 29 09:24:53 2021 +0000 Adjutments after merge with master commit f17e321a7352b546fbcd8a7a39e6978bab40e6d3 Merge: 55f1ba857d2 11b70a285c0 Author: kssenii <sumarokovakseniia@mail.ru> Date: Fri Oct 29 08:03:25 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http commit 55f1ba857d248932422697c61f26a05ef2b98e56 Author: kssenii <sumarokovakseniia@mail.ru> Date: Fri Oct 29 07:38:42 2021 +0000 Small fixes commit aeba8104d1e3f027e540deedbbcdecac0abd4686 Author: kssenii <sumarokovakseniia@mail.ru> Date: Thu Oct 28 10:28:05 2021 +0000 Some more fixes commit 82f3754b8a462c32a7a6b0d7bc8fa31752ee06dd Author: kssenii <sumarokovakseniia@mail.ru> Date: Wed Oct 27 20:20:15 2021 +0000 Slightly better commit 2647b88a665dfc0c2ee549c9d900d2a03d70653c Merge: 7024f51b55d 2bb586bed36 Author: kssenii <sumarokovakseniia@mail.ru> Date: Wed Oct 27 19:38:19 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http commit 7024f51b55d39aad7d6ef48ebc32ed1872278743 Author: kssenii <sumarokovakseniia@mail.ru> Date: Wed Oct 27 18:30:25 2021 +0000 Review fixes and add test commit 7de5fca07564487434196fc55d0e4fcb94a82c22 Merge: 1ecb6ad05d0 855b10261c8 Author: kssenii <sumarokovakseniia@mail.ru> Date: Sun Oct 24 17:04:24 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http commit 1ecb6ad05d0c50a67e1d6fdd0492965e6ecd043b Author: kssenii <sumarokovakseniia@mail.ru> Date: Sat Oct 23 18:53:59 2021 +0000 Better commit 710ee96878f66562da4e62413a11eef1bdc446f7 Merge: 28d2485716c 158b4c26b72 Author: kssenii <sumarokovakseniia@mail.ru> Date: Mon Oct 18 08:31:25 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http commit 28d2485716c1653e360d823ebddac2446ebe9c75 Author: kssenii <sumarokovakseniia@mail.ru> Date: Fri Oct 15 17:27:26 2021 +0000 Some fixes commit 7c20ca07b77fc7fa4d510e53d19c14a32b92f276 Author: kssenii <sumarokovakseniia@mail.ru> Date: Fri Oct 15 12:59:24 2021 +0000 Fix style check commit ccb02cac560b1514b416ce7ebe00de676d50d9b8 Merge: 9e4fe0f3c8a d1138a8a259 Author: kssenii <sumarokovakseniia@mail.ru> Date: Fri Oct 15 12:36:30 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http commit 9e4fe0f3c8aab60593da8f215a8e9bc15284cb7e Merge: 9814cb1b45c daed77038bd Author: kssenii <sumarokovakseniia@mail.ru> Date: Tue Oct 12 09:58:15 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http commit 9814cb1b45c5499ce6bf17047ebbb3136140b996 Merge: 1c8b1b1133e 969999ff10c Author: kssenii <sumarokovakseniia@mail.ru> Date: Tue Oct 12 09:49:08 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http commit 1c8b1b1133e0cb49c5407d4c8ebb39e70b6c305c Author: kssenii <sumarokovakseniia@mail.ru> Date: Tue Oct 12 09:33:07 2021 +0000 Better commit e7dbfff5d2a093ecc872f6028fdb93e3c1a0df76 Merge: 3329b668d6f 198adc7ecd2 Author: kssenii <sumarokovakseniia@mail.ru> Date: Tue Oct 12 06:19:15 2021 +0000 Merge branch 'master' of https://github.com/ClickHouse/ClickHouse into retriable-http
2021-10-31 14:53:08 +00:00
2021-08-24 21:45:58 +00:00
ReadSettings adjustBufferSize(size_t file_size) const
{
ReadSettings res = *this;
res.local_fs_buffer_size = std::min(file_size, local_fs_buffer_size);
res.remote_fs_buffer_size = std::min(file_size, remote_fs_buffer_size);
return res;
}
2021-08-16 00:00:32 +00:00
};
2021-09-10 21:28:43 +00:00
2021-08-16 00:00:32 +00:00
}