You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2026/10/15 13:18:15 UTC
(couchdb) branch vdu-update-discrepancy created (now 7b22225e5)
This is an automated email from the ASF dual-hosted git repository.
rnewson pushed a change to branch vdu-update-discrepancy
in repository https://gitbox.apache.org/repos/asf/couchdb.git
at 7b22225e5 we skipped necessary logic in the IsOldLeaf case
This branch includes the following new commits:
new 7b22225e5 we skipped necessary logic in the IsOldLeaf case
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(couchdb) 01/01: we skipped necessary logic in the IsOldLeaf case
Posted by rn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rnewson pushed a commit to branch vdu-update-discrepancy
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 7b22225e583dbc05c8f742e41946e907b3d61c60
Author: Robert Newson <rn...@apache.org>
AuthorDate: Thu Oct 15 11:26:28 2026 +0100
we skipped necessary logic in the IsOldLeaf case
revise this section to do all the necessary logic except
the VDU callback when no VDU is present.
fixes https://github.com/apache/couchdb/issues/6162
---
src/couch/src/couch_db.erl | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/src/couch/src/couch_db.erl b/src/couch/src/couch_db.erl
index e22f070b7..04ba8bf01 100644
--- a/src/couch/src/couch_db.erl
+++ b/src/couch/src/couch_db.erl
@@ -1237,14 +1237,13 @@ prep_and_validate_replicated_updates(
fun(#doc{id = Id, revs = {Pos, [RevId | _]}} = Doc, {AccValidated, AccErrors2}) ->
IsOldLeaf = lists:member({Pos, RevId}, OldLeafsLU),
case dict:find({Pos, RevId}, LeafRevsFullDict) of
- {ok, {Start, Path}} when not IsOldLeaf ->
- % our unflushed doc is a leaf node. Go back on the path
- % to find the previous rev that's on disk.
-
- LoadPrevRevFun = fun() ->
- make_first_doc_on_disk(Db, Id, Start - 1, tl(Path))
+ {ok, {Start, Path}} ->
+ LoadPrevRevFun = fun
+ () when IsOldLeaf ->
+ make_first_doc_on_disk(Db, Id, Start, tl(Path));
+ () ->
+ make_first_doc_on_disk(Db, Id, Start - 1, tl(Path))
end,
-
case couch_doc:has_stubs(Doc) of
true ->
DiskDoc =
@@ -1268,9 +1267,7 @@ prep_and_validate_replicated_updates(
Error ->
{AccValidated, [{Doc, Error} | AccErrors2]}
end;
- _ ->
- % this doc isn't a leaf or already exists in the tree.
- % ignore but consider it a success.
+ error ->
{AccValidated, AccErrors2}
end
end,