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:25:57 UTC
[02/50] couch-replicator commit: updated refs/heads/63012-scheduler
to 27a5eae
Canceling a transient replication via a "replication_id" works again
Canceling a transient replication by POST-ing to _replicate was failing because
it was assumed request body had to always be well-formed (with source, target,
...).
However it is valid to cancel a replication with a body which has just
`"cancel": true` and either `replication_id`, `id` or `_local_id` fields.
Example:
Creating a transient continuous replication
```
http --auth=adm:pass :15984/_replicate \
source='http://adm:pass@localhost:15984/s' \
target='http://adm:pass@localhost:15984/r' \
create_target:='true' \
continuous:='true'
{
"_local_id": "14ed9e9f8411232bdcd2387a8f578806+continuous+create_target",
"ok": true
}
```
Canceling
```
http --auth=adm:pass :15984/_replicate \
cancel:='true' \
replication_id='14ed9e9f8411232bdcd2387a8f578806+continuous+create_target'
{
"_local_id": "14ed9e9f8411232bdcd2387a8f578806+continuous+create_target",
"ok": true
}
```
Log shows:
```
Canceling replication '14ed9e9f8411232bdcd2387a8f578806+continuous+create_target'
```
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/c9f04862
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/c9f04862
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/c9f04862
Branch: refs/heads/63012-scheduler
Commit: c9f04862f7431845919476421dbaab4468d2de71
Parents: 26fc4df
Author: Nick Vatamaniuc <va...@apache.org>
Authored: Thu Oct 20 23:47:26 2016 -0400
Committer: Nick Vatamaniuc <va...@apache.org>
Committed: Thu Oct 20 23:47:26 2016 -0400
----------------------------------------------------------------------
src/couch_replicator_docs.erl | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/c9f04862/src/couch_replicator_docs.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_docs.erl b/src/couch_replicator_docs.erl
index a3e6b35..777c8a4 100644
--- a/src/couch_replicator_docs.erl
+++ b/src/couch_replicator_docs.erl
@@ -194,7 +194,12 @@ 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),
- {ok, update_rep_id(Rep)}.
+ case get_value(cancel, Rep#rep.options, false) of
+ true ->
+ {ok, Rep};
+ false ->
+ {ok, update_rep_id(Rep)}
+ end.
-spec parse_rep_doc_without_id({[_]}, #user_ctx{}) -> {ok, #rep{}}.