Skip to content

Commit 7cb02e0

Browse files
Merge pull request #555 from rabbitmq/mk-backport-553-to-v2.15.x
2.15.x: backport #553 (66de28e)
2 parents bf79e43 + f7a4b78 commit 7cb02e0

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ LOCAL_DEPS = sasl crypto
2121
dep_elvis_mk = git https://github.com/inaka/elvis.mk.git master
2222
dep_looking_glass = git https://github.com/rabbitmq/looking-glass.git master
2323
dep_inet_tcp_proxy = git https://github.com/rabbitmq/inet_tcp_proxy.git
24+
dep_eunit_formatters = git https://github.com/seancribbs/eunit_formatters main
2425

2526
DEP_PLUGINS = elvis_mk
2627

src/ra_server.erl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,8 @@ handle_follower(#append_entries_rpc{term = Term,
11091109
" including ~b entries did not validate local log. "
11101110
"Local last index ~b",
11111111
[LogId, PLIdx, length(Entries0), LocalLastIdx]),
1112-
{LVTerm, State2} = fetch_term(LastValidatedIdx, State0),
1112+
{LVTerm, State2} = fetch_term(LastValidatedIdx,
1113+
State0#{log => Log2}),
11131114
Reply = #append_entries_reply{term = CurTerm,
11141115
success = true,
11151116
next_index = LastValidatedIdx + 1,
@@ -1162,7 +1163,8 @@ handle_follower(#append_entries_rpc{term = Term,
11621163
transition_to => follower}}},
11631164
Effects};
11641165
{term_mismatch, OtherTerm, Log0} ->
1165-
LastApplied = maps:get(last_applied, State00),
1166+
State1 = State0#{log => Log0},
1167+
LastApplied = maps:get(last_applied, State1),
11661168
?INFO("~ts: term mismatch - follower had entry at ~b with term ~b "
11671169
"but not with term ~b~n"
11681170
"Asking leader ~w to resend from ~b",
@@ -1177,11 +1179,10 @@ handle_follower(#append_entries_rpc{term = Term,
11771179
% This _may_ overwrite some valid entries but is probably the
11781180
% simplest and most reliable way to proceed
11791181
{Reply, State2} = mismatch_append_entries_reply(Term, LastApplied,
1180-
State0),
1182+
State1),
11811183
Effects = [cast_reply(Id, LeaderId, Reply) | Effects0],
11821184
{await_condition,
1183-
State2#{log => Log0,
1184-
condition =>
1185+
State2#{condition =>
11851186
#{predicate_fun => follower_catchup_cond_fun(term_mismatch),
11861187
% repeat reply effect on condition timeout
11871188
timeout => #{effects => Effects,

0 commit comments

Comments
 (0)