Updated Branches: refs/heads/master 8f38cbed2 -> c31daee43
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/c31daee4 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/c31daee4 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/c31daee4 Branch: refs/heads/master Commit: c31daee43810759b11d6240f0ed63c8e9ad397a5 Parents: 72e2db8 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:45:21 2011 +0000 ---------------------------------------------------------------------- share/www/script/test/replicator_db.js | 4 ++++ src/couch_replicator/src/couch_replicator.erl | 1 + .../src/couch_replicator_utils.erl | 2 +- 3 files changed, 6 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/c31daee4/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/c31daee4/src/couch_replicator/src/couch_replicator.erl ---------------------------------------------------------------------- diff --git a/src/couch_replicator/src/couch_replicator.erl b/src/couch_replicator/src/couch_replicator.erl index 14f0e36..1f7c08a 100644 --- a/src/couch_replicator/src/couch_replicator.erl +++ b/src/couch_replicator/src/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/c31daee4/src/couch_replicator/src/couch_replicator_utils.erl ---------------------------------------------------------------------- diff --git a/src/couch_replicator/src/couch_replicator_utils.erl b/src/couch_replicator/src/couch_replicator_utils.erl index d4fc0e7..f4ae785 100644 --- a/src/couch_replicator/src/couch_replicator_utils.erl +++ b/src/couch_replicator/src/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.
