couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r987801 - /couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl
Date Sat, 21 Aug 2010 17:37:01 GMT
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



Mime
View raw message