nickva commented on code in PR #6210:
URL: https://github.com/apache/couchdb/pull/6210#discussion_r4520740507


##########
src/mem3/src/mem3_rep.erl:
##########
@@ -543,7 +552,10 @@ pull_purges(Db, Count, #shard{} = SrcShard, #tgt{} = Tgt0, 
HashFun) ->
             end,
             Infos1 = lists:filter(BelongsFun, Infos),
             {ok, _} = couch_db:purge_docs(Db, Infos1, [?REPLICATED_CHANGES]),
-            Body = purge_cp_body(SrcShard, TgtShard, ThroughSeq),
+            % A checkpoint form the target but it's the same one the target
+            % uses when it pushes to us. So we write it from the target's point
+            % of view: it's the source and we are the target.
+            Body = purge_cp_body(TgtShard, SrcShard, ThroughSeq),

Review Comment:
   A good question. For those case we want to keep it as `(Src,Tgt,Seq)` 
because those are pushes from us (Src) to (Tgt) so we checkpoint locally on the 
Src with a Src->Tgt checkpoint. For example if we're nodeA and the target is 
nodeB. We'd be updating the checkpoint on nodeA: `checkpoint(Src=nodeA, 
Tgt=nodeB, Seq)`.
   
   In this case we're "pulling" from a target. Which is the same direction as a 
target pushing to us. So if we go with us being nodeA and the other nodeB. Then 
a pull from nodeB is like nodeB pushing to us. Then on nodeB we'll write a 
`checkpoint(nodeB, nodeA)` the source then has to be nodeB (the other node) and 
the target is nodeA(us). 



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to