Skip to content

Commit be14b43

Browse files
authored
Merge pull request ClickHouse#80572 from rschu1ze/zero-prefetch-setting
Complain earlier about `filesystem_prefetch_max_memory_usage = 0`
2 parents 989af66 + 8122663 commit be14b43

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

src/Core/Settings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5649,7 +5649,7 @@ Prefetch step in bytes. Zero means `auto` - approximately the best prefetch step
56495649
DECLARE(UInt64, filesystem_prefetch_step_marks, 0, R"(
56505650
Prefetch step in marks. Zero means `auto` - approximately the best prefetch step will be auto deduced, but might not be 100% the best. The actual value might be different because of setting filesystem_prefetch_min_bytes_for_single_read_task
56515651
)", 0) \
5652-
DECLARE(UInt64, filesystem_prefetch_max_memory_usage, "1Gi", R"(
5652+
DECLARE(NonZeroUInt64, filesystem_prefetch_max_memory_usage, "1Gi", R"(
56535653
Maximum memory usage for prefetches.
56545654
)", 0) \
56555655
DECLARE(UInt64, filesystem_prefetches_limit, 200, R"(

src/Storages/MergeTree/MergeTreePrefetchedReadPool.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ namespace DB
2727
{
2828
namespace Setting
2929
{
30-
extern const SettingsUInt64 filesystem_prefetches_limit;
31-
extern const SettingsUInt64 filesystem_prefetch_max_memory_usage;
32-
extern const SettingsUInt64 filesystem_prefetch_step_marks;
33-
extern const SettingsUInt64 filesystem_prefetch_step_bytes;
30+
extern const SettingsNonZeroUInt64 filesystem_prefetch_max_memory_usage;
3431
extern const SettingsBool merge_tree_determine_task_size_by_prewhere_columns;
32+
extern const SettingsUInt64 filesystem_prefetch_step_bytes;
33+
extern const SettingsUInt64 filesystem_prefetch_step_marks;
34+
extern const SettingsUInt64 filesystem_prefetches_limit;
3535
extern const SettingsUInt64 prefetch_buffer_size;
3636
}
3737

@@ -420,8 +420,6 @@ void MergeTreePrefetchedReadPool::fillPerThreadTasks(size_t threads, size_t sum_
420420
total_size_approx);
421421

422422
size_t allowed_memory_usage = settings[Setting::filesystem_prefetch_max_memory_usage];
423-
if (!allowed_memory_usage)
424-
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Setting `filesystem_prefetch_max_memory_usage` must be non-zero");
425423

426424
std::optional<size_t> allowed_prefetches_num
427425
= settings[Setting::filesystem_prefetches_limit] ? std::optional<size_t>(settings[Setting::filesystem_prefetches_limit]) : std::nullopt;

tests/queries/0_stateless/01293_show_settings.reference

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ connect_timeout_with_failover_secure_ms Milliseconds 3000
55
external_storage_connect_timeout_sec UInt64 10
66
parallel_replicas_connect_timeout_ms Milliseconds 300
77
s3_connect_timeout_ms UInt64 1000
8-
filesystem_prefetch_max_memory_usage UInt64 1073741824
8+
filesystem_prefetch_max_memory_usage NonZeroUInt64 1073741824
99
max_memory_usage UInt64 5000000000
1010
max_memory_usage_for_user UInt64 32000000000
1111
max_untracked_memory UInt64 1048576

tests/queries/0_stateless/03519_zero_filesystem_prefetch_max_memory_usage.reference

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-- Checks that session setting 'filesystem_prefetch_max_memory_usage' must not be 0
2+
3+
SET filesystem_prefetch_max_memory_usage = 0; -- { serverError BAD_ARGUMENTS }

0 commit comments

Comments
 (0)