This is an automated email from the ASF dual-hosted git repository. davisp pushed a commit to branch optimize-doc-updates in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 12d51c62c659433c6a68ff4a65dac484cde7b39f Author: Paul J. Davis <[email protected]> AuthorDate: Thu Nov 2 12:25:09 2017 -0500 Optimize validating replicated updates --- src/couch/src/couch_db.erl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/couch/src/couch_db.erl b/src/couch/src/couch_db.erl index 5e720c2..eb39c56 100644 --- a/src/couch/src/couch_db.erl +++ b/src/couch/src/couch_db.erl @@ -945,13 +945,14 @@ prep_and_validate_replicated_updates(Db, [Bucket|RestBuckets], [OldInfo|RestOldI {ok, #full_doc_info{rev_tree=OldTree}} -> OldLeafs = couch_key_tree:get_all_leafs_full(OldTree), OldLeafsLU = [{Start, RevId} || {Start, [{RevId, _}|_]} <- OldLeafs], + NewPaths = lists:map(fun couch_doc:to_path/1, Bucket), + SortedPaths = lists:sort(NewPaths), NewRevTree = lists:foldl( - fun(NewDoc, AccTree) -> - {NewTree, _} = couch_key_tree:merge(AccTree, - couch_doc:to_path(NewDoc), Db#db.revs_limit), + fun(NewPath, AccTree) -> + {NewTree, _} = couch_key_tree:merge(AccTree, NewPath), NewTree end, - OldTree, Bucket), + OldTree, SortedPaths), Leafs = couch_key_tree:get_all_leafs_full(NewRevTree), LeafRevsFullDict = dict:from_list( [{{Start, RevId}, FullPath} || {Start, [{RevId, _}|_]}=FullPath <- Leafs]), {ValidatedBucket, AccErrors3} = -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
