You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "nickva (via GitHub)" <gi...@apache.org> on 2026/04/30 04:25:03 UTC
[PR] Fix append_update_replies case clause in fabric_doc_update [couchdb]
nickva opened a new pull request, #5989:
URL: https://github.com/apache/couchdb/pull/5989
In `serialize_worker_startup=false` mode it was possible before to get a function_clause error in `append_update_replies/3`. The `function_clause` was because of an empty `Docs` list and a non-empty `Replies` list. That happened when we had at least two conflicted replies for a doc, one arriving and others in-flight. The arriving one would knock out the doc from the expected replies list, such that when the second reply arrived, it wouldn't match up with anything.
To fix this, keep track of conflicts separately and check that conflicted list before extra workers spawn, and also avoid altering the grouped docs structure for in-flight requests
--
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
Re: [PR] Fix append_update_replies case clause in fabric_doc_update [couchdb]
Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva merged PR #5989:
URL: https://github.com/apache/couchdb/pull/5989
--
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
Re: [PR] Fix append_update_replies case clause in fabric_doc_update [couchdb]
Posted by "nickva (via GitHub)" <gi...@apache.org>.
nickva commented on code in PR #5989:
URL: https://github.com/apache/couchdb/pull/5989#discussion_r3174783485
##########
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:
Good idea, that's smaller and neater. Updated.
--
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
Re: [PR] Fix append_update_replies case clause in fabric_doc_update [couchdb]
Posted by "rnewson (via GitHub)" <gi...@apache.org>.
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