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/23 21:27:28 UTC
svn commit: r988263 -
/couchdb/branches/new_replicator/src/couchdb/couch_replicate.erl
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