Skip to content

Commit f632b36

Browse files
committed
Fix: when a snapshot is installed, all logs convered by snapshot should be purged
There may be log entries that are different from the ones applied to the snapshot. Using these logs for replication leads to data damage.
1 parent b93971d commit f632b36

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

openraft/src/core/install_snapshot.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ impl<D: AppData, R: AppDataResponse, N: RaftNetwork<D>, S: RaftStorage<D, R>> Ra
276276

277277
// Applied logs are not needed. Purge them or there may be a hole in the log.
278278
if let Some(last) = &last_applied {
279-
purge_applied_logs(self.storage.clone(), last, self.config.max_applied_log_to_keep).await?;
279+
purge_applied_logs(self.storage.clone(), last, 0).await?;
280280
}
281281

282282
// snapshot is installed

0 commit comments

Comments
 (0)