couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [43/50] [abbrv] git commit: updated refs/heads/1843-feature-bigcouch to cba2e81
Date Sat, 29 Jun 2013 15:18:24 GMT
[move] Silence some logging

If a db dies becuase its fd closed then we should avoid trying to close
the dead fd in couch_db:terminate/2.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/0c273b1e
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/0c273b1e
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/0c273b1e

Branch: refs/heads/1843-feature-bigcouch
Commit: 0c273b1e1258b5faadce574e4380598ae2d71493
Parents: 06475ba
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Wed Mar 13 13:09:10 2013 -0500
Committer: Paul J. Davis <paul.joseph.davis@gmail.com>
Committed: Wed Mar 20 06:02:56 2013 -0500

----------------------------------------------------------------------
 src/couch/src/couch_db_updater.erl | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/0c273b1e/src/couch/src/couch_db_updater.erl
----------------------------------------------------------------------
diff --git a/src/couch/src/couch_db_updater.erl b/src/couch/src/couch_db_updater.erl
index b8e150c..649826a 100644
--- a/src/couch/src/couch_db_updater.erl
+++ b/src/couch/src/couch_db_updater.erl
@@ -66,7 +66,14 @@ init({DbName, Filepath, Fd, Options}) ->
 
 
 terminate(_Reason, Db) ->
-    ok = couch_file:close(Db#db.fd),
+    % If the reason we died is becuase our fd disappeared
+    % then we don't need to try closing it again.
+    case Db#db.fd of
+        Pid when is_pid(Pid) ->
+            ok = couch_file:close(Db#db.fd);
+        _ ->
+            ok
+    end,
     couch_util:shutdown_sync(Db#db.compactor_pid),
     couch_util:shutdown_sync(Db#db.fd),
     ok.
@@ -301,7 +308,7 @@ handle_info({'EXIT', _Pid, Reason}, Db) ->
     {stop, Reason, Db};
 handle_info({'DOWN', Ref, _, _, Reason}, #db{fd_monitor=Ref, name=Name} = Db) ->
     ?LOG_ERROR("DB ~s shutting down - Fd ~p", [Name, Reason]),
-    {stop, normal, Db}.
+    {stop, normal, Db#db{fd=undefined, fd_monitor=undefined}}.
 
 code_change(_OldVsn, State, _Extra) ->
     {ok, State}.


Mime
View raw message