couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r988263 - /couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl
Date Mon, 23 Aug 2010 19:27:28 GMT
Author: fdmanana
Date: Mon Aug 23 19:27:28 2010
New Revision: 988263

URL: http://svn.apache.org/viewvc?rev=988263&view=rev
Log:
New replicator: avoid possible deadlock when a replication by doc IDs is requested and the
list of doc IDs is empty.

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=988263&r1=988262&r2=988263&view=diff
==============================================================================
--- couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl (original)
+++ couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl Mon Aug 23 19:27:28 2010
@@ -197,8 +197,15 @@ do_init([RepId, Src, Tgt, Options, UserC
     DocIds ->
         ChangesQueue = nil,
         ChangesReader = nil,
-        MissingRevsFinder = spawn_missing_revs_finder(self(), Target,
-            DocIds, MissingRevsQueue)
+        MissingRevsFinder = case DocIds of
+        [] ->
+            % avoid getting the doc copier process get blocked if it dequeues
+            % before the queue is closed
+            couch_work_queue:close(MissingRevsQueue),
+            nil;
+        Ids when is_list(Ids) ->
+            spawn_missing_revs_finder(self(), Target, Ids, MissingRevsQueue)
+        end
     end,
 
     % This starts the doc copy process. It fetches documents from the



Mime
View raw message