Updated Branches: refs/heads/1.2.x df81c2a1f -> 53a612793
Include replicion doc id in _active_tasks COUCHDB-1349 Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/53a61279 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/53a61279 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/53a61279 Branch: refs/heads/1.2.x Commit: 53a61279374f3de73662445957b03ed75f594d49 Parents: 43e8375 Author: Filipe David Borba Manana <[email protected]> Authored: Mon Dec 5 19:45:21 2011 +0000 Committer: Filipe David Borba Manana <[email protected]> Committed: Mon Dec 5 19:46:04 2011 +0000 ---------------------------------------------------------------------- share/www/script/test/replicator_db.js | 4 ++++ src/couchdb/couch_replicator.erl | 1 + src/couchdb/couch_replicator_utils.erl | 2 +- 3 files changed, 6 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/53a61279/share/www/script/test/replicator_db.js ---------------------------------------------------------------------- diff --git a/share/www/script/test/replicator_db.js b/share/www/script/test/replicator_db.js index a51cce8..e35635e 100644 --- a/share/www/script/test/replicator_db.js +++ b/share/www/script/test/replicator_db.js @@ -222,6 +222,10 @@ couchTests.replicator_db = function(debug) { T(copy.value === doc.value); } + var tasks = JSON.parse(CouchDB.request("GET", "/_active_tasks").responseText); + TEquals(1, tasks.length, "1 active task"); + TEquals(repDoc._id, tasks[0].doc_id, "replication doc id in active tasks"); + // add another doc to source, it will be replicated to target var docX = { _id: "foo1000", http://git-wip-us.apache.org/repos/asf/couchdb/blob/53a61279/src/couchdb/couch_replicator.erl ---------------------------------------------------------------------- diff --git a/src/couchdb/couch_replicator.erl b/src/couchdb/couch_replicator.erl index db7fe89..1410365 100644 --- a/src/couchdb/couch_replicator.erl +++ b/src/couchdb/couch_replicator.erl @@ -277,6 +277,7 @@ do_init(#rep{options = Options, id = {BaseId, Ext}} = Rep) -> couch_task_status:add_task([ {type, replication}, {replication_id, ?l2b(BaseId ++ Ext)}, + {doc_id, Rep#rep.doc_id}, {source, ?l2b(SourceName)}, {target, ?l2b(TargetName)}, {continuous, get_value(continuous, Options, false)}, http://git-wip-us.apache.org/repos/asf/couchdb/blob/53a61279/src/couchdb/couch_replicator_utils.erl ---------------------------------------------------------------------- diff --git a/src/couchdb/couch_replicator_utils.erl b/src/couchdb/couch_replicator_utils.erl index 6cc4db8..bd590ed 100644 --- a/src/couchdb/couch_replicator_utils.erl +++ b/src/couchdb/couch_replicator_utils.erl @@ -44,7 +44,7 @@ parse_rep_doc({Props}, UserCtx) -> target = Target, options = Options, user_ctx = UserCtx, - doc_id = get_value(<<"_id">>, Props) + doc_id = get_value(<<"_id">>, Props, null) }, {ok, Rep#rep{id = replication_id(Rep)}} end.
