Skip to content

Commit b508a1d

Browse files
committed
Add sanity check and support Darwin
1 parent d3a9513 commit b508a1d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Interpreters/Context.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3247,8 +3247,9 @@ BackupsWorker & Context::getBackupsWorker() const
32473247
{
32483248
callOnce(shared->backups_worker_initialized, [&] {
32493249
const auto & config = getConfigRef();
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));
3250+
Poco::UInt64 max_threads_max_value = 256 * getNumberOfCPUCoresToUse(); /// Limit to something unreasonable
3251+
size_t backup_threads = std::min(max_threads_max_value, std::max(Poco::UInt64{1}, config.getUInt64("backup_threads", 16)));
3252+
size_t restore_threads = std::min(max_threads_max_value, std::max(Poco::UInt64{1}, config.getUInt64("restore_threads", 16)));
32523253

32533254
shared->backups_worker.emplace(getGlobalContext(), backup_threads, restore_threads);
32543255
});

0 commit comments

Comments
 (0)