Skip to content

Commit

Permalink
Do not report failure for empty appends
Browse files Browse the repository at this point in the history
Summary:
Stop reporting an error if we fail when handling an empty append that
fail because the previous log entry is missing. This log entry can
create excessive log entries when clusters are malfunctioning.

Reviewed By: jaher

Differential Revision: D65510926

fbshipit-source-id: 88231b0e1700080461c976a27b15233f76679934
  • Loading branch information
hsun324 authored and facebook-github-bot committed Nov 8, 2024
1 parent 623c5dd commit dfc2575
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/wa_raft_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -2559,8 +2559,9 @@ append_entries(State, PrevLogIndex, PrevLogTerm, Entries, EntryCount, #raft_stat
% If the log entry is not found, then ignore and notify the leader of what log entry
% is required by this follower in the reply.
?RAFT_COUNT({raft, State, 'heartbeat.skip.missing_previous_log_entry'}),
?LOG_WARNING("Server[~0p, term ~0p, ~0p] skips appending ~0p log entries in range ~0p to ~0p because previous log entry at ~0p is not available in local log covering ~0p to ~0p.",
[Name, CurrentTerm, State, EntryCount, PrevLogIndex + 1, PrevLogIndex + EntryCount, PrevLogIndex, wa_raft_log:first_index(View), wa_raft_log:last_index(View)], #{domain => [whatsapp, wa_raft]}),
EntryCount =/= 0 andalso
?LOG_WARNING("Server[~0p, term ~0p, ~0p] skips appending ~0p log entries in range ~0p to ~0p because previous log entry at ~0p is not available in local log covering ~0p to ~0p.",
[Name, CurrentTerm, State, EntryCount, PrevLogIndex + 1, PrevLogIndex + EntryCount, PrevLogIndex, wa_raft_log:first_index(View), wa_raft_log:last_index(View)], #{domain => [whatsapp, wa_raft]}),
{ok, false, wa_raft_log:last_index(View), Data};
{error, Reason} ->
?RAFT_COUNT({raft, State, 'heartbeat.skip.failed_to_read_previous_log_entry'}),
Expand Down

0 comments on commit dfc2575

Please sign in to comment.