You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "rnewson (via GitHub)" <gi...@apache.org> on 2026/05/01 18:58:25 UTC
Re: [PR] Fix append_update_replies case clause in fabric_doc_update [couchdb]
rnewson commented on code in PR #5989:
URL: https://github.com/apache/couchdb/pull/5989#discussion_r3174708088
##########
src/fabric/src/fabric_doc_update.erl:
##########
@@ -296,35 +307,36 @@ check_forbidden_msg(Replies) ->
end
end.
-update_quorum_met(W, Replies) ->
+update_quorum_met(W, Replies, SWS) ->
Counters = lists:foldl(
fun(R, D) -> orddict:update_counter(R, 1, D) end,
orddict:new(),
Replies
),
- GoodReplies = lists:filter(fun good_reply/1, Counters),
- case
- lists:dropwhile(
- fun
- ({conflict, _}) -> false;
- ({_, Count}) -> Count < W
- end,
- GoodReplies
- )
- of
+ GoodReplies = lists:filter(fun(C) -> good_reply(C, SWS) end, Counters),
+ case lists:dropwhile(quorum_pred(W, SWS), GoodReplies) of
[] ->
false;
[{FinalReply, _} | _] ->
{true, FinalReply}
end.
-good_reply({{ok, _}, _}) ->
- true;
-good_reply({noreply, _}) ->
+% With a conflict in sws we stop the quorum early
+quorum_pred(W, true) ->
+ fun
+ ({conflict, _}) -> false;
+ ({_, Count}) -> Count < W
+ end;
+quorum_pred(W, false) ->
+ fun({_, Count}) -> Count < W end.
Review Comment:
```
quorum_pred(W, SWS) when is_boolean(SWS) ->
fun
({conflict, _}) when SWS -> false;
({_, Count}) -> Count < W
end.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@couchdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org