Increase log level to warning if the setting was changed by user

This commit is contained in:
kssenii 2024-09-26 13:31:30 +02:00
parent f0a49e4b64
commit d52502a2b6
2 changed files with 15 additions and 6 deletions

View File

@ -51,7 +51,8 @@ ObjectStorageQueueTableMetadata::ObjectStorageQueueTableMetadata(
, last_processed_path(engine_settings.last_processed_path) , last_processed_path(engine_settings.last_processed_path)
, loading_retries(engine_settings.loading_retries) , loading_retries(engine_settings.loading_retries)
{ {
if (!engine_settings.processing_threads_num.changed && engine_settings.processing_threads_num <= 1) processing_threads_num_changed = engine_settings.processing_threads_num.changed;
if (!processing_threads_num_changed && engine_settings.processing_threads_num <= 1)
processing_threads_num = std::max<uint32_t>(getNumberOfPhysicalCPUCores(), 16); processing_threads_num = std::max<uint32_t>(getNumberOfPhysicalCPUCores(), 16);
else else
processing_threads_num = engine_settings.processing_threads_num; processing_threads_num = engine_settings.processing_threads_num;
@ -106,9 +107,9 @@ ObjectStorageQueueTableMetadata::ObjectStorageQueueTableMetadata(const Poco::JSO
, tracked_files_limit(getOrDefault(json, "tracked_files_limit", "s3queue_", 0)) , tracked_files_limit(getOrDefault(json, "tracked_files_limit", "s3queue_", 0))
, tracked_files_ttl_sec(getOrDefault(json, "tracked_files_ttl_sec", "", getOrDefault(json, "tracked_file_ttl_sec", "s3queue_", 0))) , tracked_files_ttl_sec(getOrDefault(json, "tracked_files_ttl_sec", "", getOrDefault(json, "tracked_file_ttl_sec", "s3queue_", 0)))
, buckets(getOrDefault(json, "buckets", "", 0)) , buckets(getOrDefault(json, "buckets", "", 0))
, processing_threads_num(getOrDefault(json, "processing_threads_num", "s3queue_", 1))
, last_processed_path(getOrDefault<String>(json, "last_processed_file", "s3queue_", "")) , last_processed_path(getOrDefault<String>(json, "last_processed_file", "s3queue_", ""))
, loading_retries(getOrDefault(json, "loading_retries", "", 10)) , loading_retries(getOrDefault(json, "loading_retries", "", 10))
, processing_threads_num(getOrDefault(json, "processing_threads_num", "s3queue_", 1))
{ {
validateMode(mode); validateMode(mode);
} }
@ -124,9 +125,15 @@ void ObjectStorageQueueTableMetadata::adjustFromKeeper(const ObjectStorageQueueT
{ {
if (processing_threads_num != from_zk.processing_threads_num) if (processing_threads_num != from_zk.processing_threads_num)
{ {
LOG_TRACE(getLogger("ObjectStorageQueueTableMetadata"), auto log = getLogger("ObjectStorageQueueTableMetadata");
"Using `processing_threads_num` from keeper: {} (local: {})", const std::string message = fmt::format(
from_zk.processing_threads_num, processing_threads_num); "Using `processing_threads_num` from keeper: {} (local: {})",
from_zk.processing_threads_num, processing_threads_num);
if (processing_threads_num_changed)
LOG_WARNING(log, "{}", message);
else
LOG_TRACE(log, "{}", message);
processing_threads_num = from_zk.processing_threads_num; processing_threads_num = from_zk.processing_threads_num;
} }

View File

@ -25,10 +25,12 @@ struct ObjectStorageQueueTableMetadata
const UInt64 tracked_files_limit; const UInt64 tracked_files_limit;
const UInt64 tracked_files_ttl_sec; const UInt64 tracked_files_ttl_sec;
const UInt64 buckets; const UInt64 buckets;
UInt64 processing_threads_num; /// Can be changed from keeper.
const String last_processed_path; const String last_processed_path;
const UInt64 loading_retries; const UInt64 loading_retries;
UInt64 processing_threads_num; /// Can be changed from keeper.
bool processing_threads_num_changed = false;
ObjectStorageQueueTableMetadata( ObjectStorageQueueTableMetadata(
const ObjectStorageQueueSettings & engine_settings, const ObjectStorageQueueSettings & engine_settings,
const ColumnsDescription & columns_, const ColumnsDescription & columns_,