Skip to content

Commit

Permalink
Default enable raft-engine (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
CalvinNeo authored Sep 7, 2022
1 parent 56115eb commit 6b0ba87
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion etc/config-template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 10 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1409,14 +1409,23 @@ 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,
#[serde(flatten)]
config: RawRaftEngineConfig,
}

impl Default for RaftEngineConfig {
fn default() -> Self {
Self {
enable: true,
config: RawRaftEngineConfig::default(),
}
}
}

impl RaftEngineConfig {
fn validate(&mut self) -> Result<(), Box<dyn Error>> {
self.config.sanitize().map_err(Box::new)?;
Expand Down

0 comments on commit 6b0ba87

Please sign in to comment.