Skip to content

Commit

Permalink
Do not update ra_log_snapshot_state from snapshot writer process.
Browse files Browse the repository at this point in the history
As this could cause entries not to be written to the WAL (as it thinks
they will never be read) but the main ra process is not yet aware
of the snapshot and thus may try to read these entries.
  • Loading branch information
kjnilsson authored and mkuratczyk committed Jul 12, 2024
1 parent 4fe9b43 commit 5339a64
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/ra_snapshot.erl
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ begin_snapshot(#{index := Idx, term := Term} = Meta, MacRef, SnapKind,
-spec promote_checkpoint(Idx :: ra_index(), State0 :: state()) ->
{boolean(), State :: state(), Effects :: [effect()]}.
promote_checkpoint(PromotionIdx,
#?MODULE{uid = UId,
module = Mod,
#?MODULE{module = Mod,
snapshot_directory = SnapDir,
checkpoint_directory = CheckpointDir,
checkpoints = Checkpoints0} = State0) ->
Expand All @@ -369,7 +368,6 @@ promote_checkpoint(PromotionIdx,
%% into a snapshot.
ok = Mod:sync(Checkpoint),
ok = prim_file:rename(Checkpoint, Snapshot),
true = ets:insert(?ETSTBL, {UId, Idx}),
Self ! {ra_log_event,
{snapshot_written,
{Idx, Term}, snapshot}}
Expand Down

0 comments on commit 5339a64

Please sign in to comment.