Skip to content

Commit d3a9513

Browse files
committed
Force backup_threads and restore_threads to be non zero
1 parent 7286d0e commit d3a9513

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/Core/ServerSettings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ namespace DB
139139
A value of `0` (default) means unlimited.
140140
:::
141141
)", 0) \
142-
DECLARE(UInt64, backup_threads, 16, R"(The maximum number of threads to execute `BACKUP` requests.)", 0) \
142+
DECLARE(NonZeroUInt64, backup_threads, 16, R"(The maximum number of threads to execute `BACKUP` requests.)", 0) \
143143
DECLARE(UInt64, max_backup_bandwidth_for_server, 0, R"(The maximum read speed in bytes per second for all backups on server. Zero means unlimited.)", 0) \
144-
DECLARE(UInt64, restore_threads, 16, R"(The maximum number of threads to execute RESTORE requests.)", 0) \
144+
DECLARE(NonZeroUInt64, restore_threads, 16, R"(The maximum number of threads to execute RESTORE requests.)", 0) \
145145
DECLARE(Bool, shutdown_wait_backups_and_restores, true, R"(If set to true ClickHouse will wait for running backups and restores to finish before shutdown.)", 0) \
146146
DECLARE(Double, cannot_allocate_thread_fault_injection_probability, 0, R"(For testing purposes.)", 0) \
147147
DECLARE(Int32, max_connections, 4096, R"(Max server connections.)", 0) \

src/Core/ServerSettings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct ServerSettingsImpl;
2121
M(CLASS_NAME, Double) \
2222
M(CLASS_NAME, GroupArrayActionWhenLimitReached) \
2323
M(CLASS_NAME, Float) \
24+
M(CLASS_NAME, NonZeroUInt64) \
2425
M(CLASS_NAME, Int32) \
2526
M(CLASS_NAME, Seconds) \
2627
M(CLASS_NAME, String) \

src/Interpreters/Context.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ namespace Setting
196196
extern const SettingsUInt64 allow_experimental_parallel_reading_from_replicas;
197197
extern const SettingsMilliseconds async_insert_poll_timeout_ms;
198198
extern const SettingsBool azure_allow_parallel_part_upload;
199-
extern const SettingsUInt64 backup_threads;
200199
extern const SettingsString cluster_for_parallel_replicas;
201200
extern const SettingsBool enable_filesystem_cache;
202201
extern const SettingsBool enable_filesystem_cache_log;
@@ -244,7 +243,6 @@ namespace Setting
244243
extern const SettingsUInt64 page_cache_block_size;
245244
extern const SettingsUInt64 page_cache_lookahead_blocks;
246245
extern const SettingsInt64 read_priority;
247-
extern const SettingsUInt64 restore_threads;
248246
extern const SettingsString remote_filesystem_read_method;
249247
extern const SettingsBool remote_filesystem_read_prefetch;
250248
extern const SettingsUInt64 remote_fs_read_max_backoff_ms;
@@ -3249,9 +3247,8 @@ BackupsWorker & Context::getBackupsWorker() const
32493247
{
32503248
callOnce(shared->backups_worker_initialized, [&] {
32513249
const auto & config = getConfigRef();
3252-
const auto & settings_ref = getSettingsRef();
3253-
UInt64 backup_threads = config.getUInt64("backup_threads", settings_ref[Setting::backup_threads]);
3254-
UInt64 restore_threads = config.getUInt64("restore_threads", settings_ref[Setting::restore_threads]);
3250+
UInt64 backup_threads = std::max(UInt64{1}, config.getUInt64("backup_threads", 16));
3251+
UInt64 restore_threads = std::max(UInt64{1}, config.getUInt64("restore_threads", 16));
32553252

32563253
shared->backups_worker.emplace(getGlobalContext(), backup_threads, restore_threads);
32573254
});

0 commit comments

Comments
 (0)