Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default enable raft-engine #150

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
breezewish marked this conversation as resolved.
Show resolved Hide resolved
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