From c3ed72b783feedafa0567dcb132b71b098f7d478 Mon Sep 17 00:00:00 2001 From: CalvinNeo Date: Fri, 26 Aug 2022 15:46:20 +0800 Subject: [PATCH] f Signed-off-by: CalvinNeo --- etc/config-template.toml | 2 +- src/config.rs | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/etc/config-template.toml b/etc/config-template.toml index 4b33b6a000b..ab805b077a2 100644 --- a/etc/config-template.toml +++ b/etc/config-template.toml @@ -949,7 +949,7 @@ [raft-engine] ## Determines whether to use Raft Engine to store raft logs. When it is ## enabled, configurations of `raftdb` are ignored. -# enable = false +# enable = true ## The directory at which raft log files are stored. If the directory does not ## exist, it will be created when TiKV is started. diff --git a/src/config.rs b/src/config.rs index 111e7b148d6..81427e436a5 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1409,7 +1409,7 @@ impl RaftDbConfig { } } -#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Default)] +#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)] #[serde(default, rename_all = "kebab-case")] pub struct RaftEngineConfig { pub enable: bool, @@ -1417,6 +1417,15 @@ pub struct RaftEngineConfig { config: RawRaftEngineConfig, } +impl Default for RaftEngineConfig { + fn default() -> Self { + Self { + enable: true, + config: RawRaftEngineConfig::default(), + } + } +} + impl RaftEngineConfig { fn validate(&mut self) -> Result<(), Box> { self.config.sanitize().map_err(Box::new)?;