You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ra...@apache.org on 2011/06/14 00:10:09 UTC

svn commit: r1135313 - in /couchdb/trunk/src/couchdb: couch_api_wrap.erl couch_replicator.erl

Author: randall
Date: Mon Jun 13 22:10:09 2011
New Revision: 1135313

URL: http://svn.apache.org/viewvc?rev=1135313&view=rev
Log:
safer db close on rep terminate than in r1133561

As fdmanana pointed out to me, my last change to this broke the
replication js test. While dropping the ref on a local database is not
strictly necessary, closing a remote database might terminate an http
connection that is being help open. The remote server will complain
if we drop it unexpectedly.

Modified:
    couchdb/trunk/src/couchdb/couch_api_wrap.erl
    couchdb/trunk/src/couchdb/couch_replicator.erl

Modified: couchdb/trunk/src/couchdb/couch_api_wrap.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_api_wrap.erl?rev=1135313&r1=1135312&r2=1135313&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_api_wrap.erl (original)
+++ couchdb/trunk/src/couchdb/couch_api_wrap.erl Mon Jun 13 22:10:09 2011
@@ -104,7 +104,7 @@ db_close(#httpdb{httpc_pool = Pool}) ->
     unlink(Pool),
     ok = couch_httpc_pool:stop(Pool);
 db_close(DbName) ->
-    couch_db:close(DbName).
+    catch couch_db:close(DbName).
 
 
 get_db_info(#httpdb{} = Db) ->

Modified: couchdb/trunk/src/couchdb/couch_replicator.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_replicator.erl?rev=1135313&r1=1135312&r2=1135313&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_replicator.erl (original)
+++ couchdb/trunk/src/couchdb/couch_replicator.erl Mon Jun 13 22:10:09 2011
@@ -475,7 +475,9 @@ terminate(Reason, State) ->
 terminate_cleanup(State) ->
     couch_task_status:update("Finishing"),
     stop_db_compaction_notifier(State#rep_state.source_db_compaction_notifier),
-    stop_db_compaction_notifier(State#rep_state.target_db_compaction_notifier).
+    stop_db_compaction_notifier(State#rep_state.target_db_compaction_notifier),
+    couch_api_wrap:db_close(State#rep_state.source),
+    couch_api_wrap:db_close(State#rep_state.target).
 
 
 do_last_checkpoint(#rep_state{seqs_in_progress = [],