From e9764021542c2e243149af4c0259ee53d2737013 Mon Sep 17 00:00:00 2001 From: niebayes Date: Tue, 26 Dec 2023 17:34:37 +0800 Subject: [PATCH] fix: set replication_factor properly --- src/common/config/src/wal/kafka.rs | 7 +++++-- src/common/meta/src/wal.rs | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/common/config/src/wal/kafka.rs b/src/common/config/src/wal/kafka.rs index d1d1a615a370..e93aa6cb2271 100644 --- a/src/common/config/src/wal/kafka.rs +++ b/src/common/config/src/wal/kafka.rs @@ -121,13 +121,16 @@ pub struct StandaloneKafkaConfig { impl Default for StandaloneKafkaConfig { fn default() -> Self { + let base = KafkaConfig::default(); + let replication_factor = base.broker_endpoints.len() as i16; + Self { - base: KafkaConfig::default(), + base, num_topics: 64, selector_type: TopicSelectorType::RoundRobin, topic_name_prefix: "greptimedb_wal_topic".to_string(), num_partitions: 1, - replication_factor: 3, + replication_factor, create_topic_timeout: Duration::from_secs(30), } } diff --git a/src/common/meta/src/wal.rs b/src/common/meta/src/wal.rs index 1e394e847985..853c6fa5df63 100644 --- a/src/common/meta/src/wal.rs +++ b/src/common/meta/src/wal.rs @@ -89,7 +89,7 @@ mod tests { selector_type = "round_robin" topic_name_prefix = "greptimedb_wal_topic" num_partitions = 1 - replication_factor = 3 + replication_factor = 1 create_topic_timeout = "30s" backoff_init = "500ms" backoff_max = "10s" @@ -103,7 +103,7 @@ mod tests { selector_type: TopicSelectorType::RoundRobin, topic_name_prefix: "greptimedb_wal_topic".to_string(), num_partitions: 1, - replication_factor: 3, + replication_factor: 1, create_topic_timeout: Duration::from_secs(30), backoff: KafkaBackoffConfig { init: Duration::from_millis(500),