Skip to content

Commit

Permalink
fix: Broken snapshot creation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine committed Oct 2, 2024
1 parent ccfb723 commit 18d73ec
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
1 change: 1 addition & 0 deletions examples/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub fn build_config(node_id: u64) -> Config {
ensure_directory_exist(&storage_pth).expect("Failed to create storage directory");

Config {
bootstrap_from_snapshot: false,
tick_interval: 0.2,
log_dir: storage_pth.clone(),
save_compacted_logs: true,
Expand Down
3 changes: 0 additions & 3 deletions raftify/src/raft_node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1115,9 +1115,6 @@ impl<
storage: self.raw_node.store().clone(),
})
.unwrap();

// #[cfg(feature = "inmemory_storage")]
// todo!("Implement LocalRequestMsg::GetStorage request handler for inmemory storage");
}
LocalRequestMsg::DebugNode { tx_msg } => {
tx_msg
Expand Down
5 changes: 1 addition & 4 deletions raftify/src/storage/heed_storage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,7 @@ impl HeedStorageCore {
fn save_compacted_entries(&self, entries: &[Entry]) -> Result<()> {
let compacted_log_dir_path = Path::new(&self.config.compacted_log_dir);
let compacted_log_dir_path = compacted_log_dir_path.to_str().unwrap();
let dest_path = format!(
"{}/node-{}/compacted.json",
compacted_log_dir_path, self.config.raft_config.id
);
let dest_path = format!("{}/compacted_logs.json", compacted_log_dir_path);

match fs::metadata(&dest_path) {
Ok(metadata) if metadata.len() > self.config.compacted_log_size_threshold => {
Expand Down

0 comments on commit 18d73ec

Please sign in to comment.