You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ji...@apache.org on 2018/08/21 01:13:40 UTC

[couchdb] branch COUCHDB-3326-clustered-purge-pr2-simplify-mem3-rep updated (b663478 -> da43788)

This is an automated email from the ASF dual-hosted git repository.

jiangphcn pushed a change to branch COUCHDB-3326-clustered-purge-pr2-simplify-mem3-rep
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


    omit b663478  Simplify logic in mem3_rep
    omit 207b3b0  Update fabric_doc_open eunit tests
    omit 2949d2a  Fix race on couch_db:reopen/1
    omit b899b50  Fix default security object handling
    omit e994fc7  Fix bug during purge
    omit 45f9c55  Fix typos in couch_db_engine.erl
     add 39dede7  Expose document update errors to client
     add d3453d2  Merge pull request #1486 from cloudant/fix-doc-update-case-clause
     add 28ba48d  Reduce size of #leaf.atts keys
     add 0cb1110  Add `POST /_node/$node/_restart` endpoint
     add d14869e  Calculate uptime since application start instead of a beam start
     add fbe98b6  Use "/_node/<node>/_restart" from JavaScript tests
     add 7217481  Remove special handling of 'restart' from 'test/javascript/run'
     add 91ff3f6  Remove _restart endpoint from non-clustered interface
     add 9be1213  Remove no longer needed handle_restart_req handler
     add b847adb  Merge pull request #1543 from cloudant/implement-node-restart
     add 3852a00  Fix typos in couch_db_engine.erl
     add da2e22a  Fix bug during purge
     add 151b9b0  Fix default security object handling
     add bb27d5e  Fix race on couch_db:reopen/1
     add aea2833  Update fabric_doc_open eunit tests
     new da43788  Simplify logic in mem3_rep

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (b663478)
            \
             N -- N -- N   refs/heads/COUCHDB-3326-clustered-purge-pr2-simplify-mem3-rep (da43788)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

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.


Summary of changes:
 rel/overlay/etc/default.ini                 |  1 -
 src/chttpd/src/chttpd_misc.erl              |  8 +++-
 src/couch/src/couch_app.erl                 | 11 +++++-
 src/couch/src/couch_att.erl                 | 10 ++++-
 src/couch/src/couch_httpd_misc_handlers.erl | 23 +-----------
 src/fabric/src/fabric.erl                   | 58 ++++++++++++++++++++++++++++-
 src/fabric/src/fabric_doc_update.erl        |  3 +-
 test/javascript/run                         |  6 +--
 test/javascript/test_setup.js               | 11 +++++-
 9 files changed, 96 insertions(+), 35 deletions(-)


[couchdb] 01/01: Simplify logic in mem3_rep

Posted by ji...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jiangphcn pushed a commit to branch COUCHDB-3326-clustered-purge-pr2-simplify-mem3-rep
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit da437885dcfba62272d7d806e884bcac5e7e64d9
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Wed Mar 21 12:23:47 2018 -0500

    Simplify logic in mem3_rep
    
    Previously there were two separate database references and it was not
    clear which was used where. This simplifies things by reducing it to a
    single instance so that the logic is simpler.
---
 src/mem3/src/mem3_rep.erl | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/mem3/src/mem3_rep.erl b/src/mem3/src/mem3_rep.erl
index 8d996d6..670f990 100644
--- a/src/mem3/src/mem3_rep.erl
+++ b/src/mem3/src/mem3_rep.erl
@@ -73,12 +73,11 @@ go(#shard{} = Source, #shard{} = Target, Opts) ->
     go(Acc).
 
 
-go(#acc{source=Source, batch_count=BC}=Acc0) ->
+go(#acc{source=Source, batch_count=BC}=Acc) ->
     case couch_db:open(Source#shard.name, [?ADMIN_CTX]) of
     {ok, Db} ->
-        Acc = Acc0#acc{db=Db},
         Resp = try
-            repl(Db, Acc)
+            repl(Acc#acc{db = Db})
         catch error:{not_found, no_db_file} ->
             {error, missing_target}
         after
@@ -170,9 +169,9 @@ find_source_seq_int(#doc{body={Props}}, SrcNode0, TgtNode0, TgtUUID, TgtSeq) ->
     end.
 
 
-repl(Db, Acc0) ->
+repl(#acc{db = Db} = Acc0) ->
     erlang:put(io_priority, {internal_repl, couch_db:name(Db)}),
-    #acc{seq=Seq} = Acc1 = calculate_start_seq(Acc0#acc{source = Db}),
+    #acc{seq=Seq} = Acc1 = calculate_start_seq(Acc0),
     case Seq >= couch_db:get_update_seq(Db) of
         true ->
             {ok, 0};
@@ -186,7 +185,7 @@ repl(Db, Acc0) ->
 
 calculate_start_seq(Acc) ->
     #acc{
-        source = Db,
+        db = Db,
         target = #shard{node=Node, name=Name}
     } = Acc,
     %% Give the target our UUID and ask it to return the checkpoint doc
@@ -222,7 +221,7 @@ calculate_start_seq(Acc) ->
 
 compare_epochs(Acc) ->
     #acc{
-        source = Db,
+        db = Db,
         target = #shard{node=Node, name=Name}
     } = Acc,
     UUID = couch_db:get_uuid(Db),
@@ -303,13 +302,13 @@ chunk_revs([{Id, R, A}|Revs], {Count, Chunk}, Chunks, Limit) ->
     ).
 
 
-open_docs(#acc{source=Source, infos=Infos}, Missing) ->
+open_docs(#acc{db=Db, infos=Infos}, Missing) ->
     lists:flatmap(fun({Id, Revs, _}) ->
         FDI = lists:keyfind(Id, #full_doc_info.id, Infos),
         #full_doc_info{rev_tree=RevTree} = FDI,
         {FoundRevs, _} = couch_key_tree:get_key_leafs(RevTree, Revs),
         lists:map(fun({#leaf{deleted=IsDel, ptr=SummaryPtr}, FoundRevPath}) ->
-            couch_db:make_doc(Source, Id, IsDel, SummaryPtr, FoundRevPath)
+            couch_db:make_doc(Db, Id, IsDel, SummaryPtr, FoundRevPath)
         end, FoundRevs)
     end, Missing).
 
@@ -325,7 +324,7 @@ save_on_target(Node, Name, Docs) ->
 
 
 update_locals(Acc) ->
-    #acc{seq=Seq, source=Db, target=Target, localid=Id, history=History} = Acc,
+    #acc{seq=Seq, db=Db, target=Target, localid=Id, history=History} = Acc,
     #shard{name=Name, node=Node} = Target,
     NewEntry = [
         {<<"source_node">>, atom_to_binary(node(), utf8)},