Skip to content

Commit

Permalink
Fix check
Browse files Browse the repository at this point in the history
  • Loading branch information
antonio2368 committed Sep 30, 2024
1 parent 3d24588 commit 6eddf2d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/handle_commit.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,9 @@ bool raft_server::snapshot_and_compact(ulong committed_idx, bool forced_creation
// Because we fetch local_snp before checking the flag snp_in_progress_
// we can have a newer snapshot that was created between
// fetching of local_snp and setting the snp_in_progress_ to false
// to avoid creating snapshots too soon, we recheck the distance
if (local_snp && committed_idx >= snapshot_distance + local_snp->get_last_log_idx()) {
// to avoid creating snapshots too soon, we recheck the distance when we are
// sure this is the only thread creating snapshot
if (local_snp && committed_idx < snapshot_distance + local_snp->get_last_log_idx()) {
snp_in_progress_ = false;
return false;
}
Expand Down

0 comments on commit 6eddf2d

Please sign in to comment.