You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2010/08/21 19:37:01 UTC
svn commit: r987801 -
/couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl
Author: fdmanana
Date: Sat Aug 21 17:37:01 2010
New Revision: 987801
URL: http://svn.apache.org/viewvc?rev=987801&view=rev
Log:
Avoid deadlock for a replication by doc IDs when the list of doc IDs passes the limits of the work queue.
Modified:
couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl
Modified: couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl?rev=987801&r1=987800&r2=987801&view=diff
==============================================================================
--- couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl (original)
+++ couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl Sat Aug 21 17:37:01 2010
@@ -195,13 +195,8 @@ do_init([RepId, Src, Tgt, Options, UserC
DocIds ->
ChangesQueue = nil,
ChangesReader = nil,
- MissingRevsFinder = nil,
-
- lists:foreach(
- fun(DocId) ->
- ok = couch_work_queue:queue(MissingRevsQueue, {doc_id, DocId})
- end, DocIds),
- couch_work_queue:close(MissingRevsQueue)
+ MissingRevsFinder = spawn_missing_revs_finder(self(), Target,
+ DocIds, MissingRevsQueue)
end,
% This starts the doc copy process. It fetches documents from the
@@ -442,6 +437,13 @@ spawn_missing_revs_finder(StatsProcess,
end).
+missing_revs_finder_loop(_, _, DocIds, MissingRevsQueue) when is_list(DocIds) ->
+ lists:foreach(
+ fun(DocId) ->
+ ok = couch_work_queue:queue(MissingRevsQueue, {doc_id, DocId})
+ end, DocIds),
+ couch_work_queue:close(MissingRevsQueue);
+
missing_revs_finder_loop(Cp,
Target, ChangesQueue, MissingRevsQueue) ->
case couch_work_queue:dequeue(ChangesQueue) of