You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2017/03/14 19:26:07 UTC

[12/50] couch-replicator commit: updated refs/heads/63012-scheduler to 27a5eae

Fix canceling _replicate requests using the full document body

If 'cancel' was 'true' but no id was specified, previously id was not parsed
out of the document body and remained undefined.

Fix and make all the possible configuration explicit in the parsing case
statement.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/b7d92afb
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/b7d92afb
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/b7d92afb

Branch: refs/heads/63012-scheduler
Commit: b7d92afb8da7c0caa29d8a734f83a1df051ae382
Parents: c4f7b78
Author: Nick Vatamaniuc <va...@apache.org>
Authored: Fri Oct 28 10:45:32 2016 -0400
Committer: Nick Vatamaniuc <va...@apache.org>
Committed: Fri Oct 28 10:45:32 2016 -0400

----------------------------------------------------------------------
 src/couch_replicator_docs.erl | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/b7d92afb/src/couch_replicator_docs.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_docs.erl b/src/couch_replicator_docs.erl
index e27aad6..71acc29 100644
--- a/src/couch_replicator_docs.erl
+++ b/src/couch_replicator_docs.erl
@@ -204,10 +204,17 @@ parse_rep_doc_without_id(RepDoc) ->
 -spec parse_rep_doc({[_]}, #user_ctx{}) -> {ok, #rep{}}.
 parse_rep_doc(Doc, UserCtx) ->
     {ok, Rep} = parse_rep_doc_without_id(Doc, UserCtx),
-    case get_value(cancel, Rep#rep.options, false) of
-        true ->
+    Cancel = get_value(cancel, Rep#rep.options, false),
+    Id = get_value(id, Rep#rep.options, nil),
+    case {Cancel, Id} of
+        {true, nil} ->
+            % Cancel request with no id, must parse id out of body contents
+            {ok, update_rep_id(Rep)};
+        {true, Id} ->
+            % Cancel request with an id specified, so do not parse id from body
             {ok, Rep};
-        false ->
+        {false, _Id} ->
+            % Not a cancel request, regular replication doc
             {ok, update_rep_id(Rep)}
     end.