Merge pull request #57822 from azat/kafka-disable-stat

Disable system.kafka_consumers by default (due to possible live memory leak)
This commit is contained in:
Alexey Milovidov 2023-12-14 04:37:50 +01:00 committed by GitHub
commit 7a2edb4804
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -661,10 +661,19 @@ void StorageKafka::updateConfiguration(cppkafka::Configuration & kafka_config,
if (kafka_consumer_weak_ptr_ptr)
{
/// NOTE: statistics should be consumed, otherwise it creates too much
/// entries in the queue, that leads to memory leak and slow shutdown.
///
/// This is the case when you have kafka table but no SELECT from it or
/// materialized view attached.
///
/// So for now it is disabled by default, until properly fixed.
#if 0
if (!config.has(config_prefix + "." + "statistics_interval_ms"))
{
kafka_config.set("statistics.interval.ms", "3000"); // every 3 seconds by default. set to 0 to disable.
}
#endif
if (kafka_config.get("statistics.interval.ms") != "0")
{