Use MAKE_DEPRECATED_BY_SERVER_CONFIG() for deprecated throttle settings

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
This commit is contained in:
Azat Khuzhin 2023-04-03 14:52:47 +02:00
parent 684ecc24e2
commit 61405b827d
3 changed files with 9 additions and 9 deletions

View File

@ -19,7 +19,10 @@ void ServerSettings::loadSettingsFromConfig(const Poco::Util::AbstractConfigurat
"background_buffer_flush_schedule_pool_size",
"background_schedule_pool_size",
"background_message_broker_schedule_pool_size",
"background_distributed_schedule_pool_size"
"background_distributed_schedule_pool_size",
"max_remote_read_network_bandwidth_for_server",
"max_remote_write_network_bandwidth_for_server",
};
for (auto setting : all())

View File

@ -738,6 +738,7 @@ class IColumn;
#define MAKE_OBSOLETE(M, TYPE, NAME, DEFAULT) \
M(TYPE, NAME, DEFAULT, "Obsolete setting, does nothing.", BaseSettingsHelpers::Flags::OBSOLETE)
/// NOTE: ServerSettings::loadSettingsFromConfig() should be updated to include this settings
#define MAKE_DEPRECATED_BY_SERVER_CONFIG(M, TYPE, NAME, DEFAULT) \
M(TYPE, NAME, DEFAULT, "User-level setting is deprecated, and it must be defined in the server configuration instead.", BaseSettingsHelpers::Flags::OBSOLETE)
@ -771,6 +772,8 @@ class IColumn;
MAKE_DEPRECATED_BY_SERVER_CONFIG(M, UInt64, background_schedule_pool_size, 128) \
MAKE_DEPRECATED_BY_SERVER_CONFIG(M, UInt64, background_message_broker_schedule_pool_size, 16) \
MAKE_DEPRECATED_BY_SERVER_CONFIG(M, UInt64, background_distributed_schedule_pool_size, 16) \
MAKE_DEPRECATED_BY_SERVER_CONFIG(M, UInt64, max_remote_read_network_bandwidth_for_server, 0) \
MAKE_DEPRECATED_BY_SERVER_CONFIG(M, UInt64, max_remote_write_network_bandwidth_for_server, 0) \
/* ---- */ \
MAKE_OBSOLETE(M, DefaultDatabaseEngine, default_database_engine, DefaultDatabaseEngine::Atomic) \
MAKE_OBSOLETE(M, UInt64, max_pipeline_depth, 0) \
@ -780,8 +783,6 @@ class IColumn;
MAKE_OBSOLETE(M, Seconds, drain_timeout, 3) \
MAKE_OBSOLETE(M, UInt64, backup_threads, 16) \
MAKE_OBSOLETE(M, UInt64, restore_threads, 16) \
MAKE_OBSOLETE(M, UInt64, max_remote_read_network_bandwidth_for_server, 0) \
MAKE_OBSOLETE(M, UInt64, max_remote_write_network_bandwidth_for_server, 0) \
/** The section above is for obsolete settings. Do not add anything there. */

View File

@ -2333,9 +2333,7 @@ ThrottlerPtr Context::getRemoteReadThrottler() const
ThrottlerPtr throttler;
const auto & query_settings = getSettingsRef();
UInt64 bandwidth_for_server = query_settings.max_remote_read_network_bandwidth_for_server;
if (shared->server_settings.max_remote_read_network_bandwidth_for_server.changed)
bandwidth_for_server = shared->server_settings.max_remote_read_network_bandwidth_for_server.changed;
UInt64 bandwidth_for_server = shared->server_settings.max_remote_read_network_bandwidth_for_server;
if (bandwidth_for_server)
{
auto lock = getLock();
@ -2360,9 +2358,7 @@ ThrottlerPtr Context::getRemoteWriteThrottler() const
ThrottlerPtr throttler;
const auto & query_settings = getSettingsRef();
UInt64 bandwidth_for_server = query_settings.max_remote_write_network_bandwidth_for_server;
if (shared->server_settings.max_remote_write_network_bandwidth_for_server.changed)
bandwidth_for_server = shared->server_settings.max_remote_write_network_bandwidth_for_server.changed;
UInt64 bandwidth_for_server = shared->server_settings.max_remote_write_network_bandwidth_for_server;
if (bandwidth_for_server)
{
auto lock = getLock();