couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r727832 - in /couchdb/trunk: etc/couchdb/local_dev.ini src/couchdb/couch_file.erl src/couchdb/couch_server.erl src/couchdb/couch_view_group.erl
Date Thu, 18 Dec 2008 21:43:34 GMT
Author: damien
Date: Thu Dec 18 13:43:34 2008
New Revision: 727832

URL: http://svn.apache.org/viewvc?rev=727832&view=rev
Log:
fix for crash of couch_server when database non-existant

Modified:
    couchdb/trunk/etc/couchdb/local_dev.ini
    couchdb/trunk/src/couchdb/couch_file.erl
    couchdb/trunk/src/couchdb/couch_server.erl
    couchdb/trunk/src/couchdb/couch_view_group.erl

Modified: couchdb/trunk/etc/couchdb/local_dev.ini
URL: http://svn.apache.org/viewvc/couchdb/trunk/etc/couchdb/local_dev.ini?rev=727832&r1=727831&r2=727832&view=diff
==============================================================================
--- couchdb/trunk/etc/couchdb/local_dev.ini (original)
+++ couchdb/trunk/etc/couchdb/local_dev.ini Thu Dec 18 13:43:34 2008
@@ -17,43 +17,3 @@
 [update_notification]
 ;unique notifier name=/full/path/to/exe -with "cmd line arg"
 
-
-
-[test]
-foo = bar
-
-[test]
-foo = bar
-
-[test]
-foo = bar
-
-[test]
-foo = bar
-
-[test]
-foo = bar
-
-[test]
-foo = bar
-
-[test]
-foo = bar
-
-[test]
-foo = bar
-
-[test]
-foo = bar
-
-[test]
-foo = bar
-
-[test]
-foo = bar
-
-[test]
-foo = bar
-
-[test]
-foo = bar

Modified: couchdb/trunk/src/couchdb/couch_file.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_file.erl?rev=727832&r1=727831&r2=727832&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_file.erl (original)
+++ couchdb/trunk/src/couchdb/couch_file.erl Thu Dec 18 13:43:34 2008
@@ -40,7 +40,11 @@
     ignore ->
         % get the error
         receive
-        {Ref, Error} ->
+        {Ref, Pid, Error} ->
+            case process_info(self(), trap_exit) of
+            {trap_exit, true} -> receive {'EXIT', Pid, _} -> ok end;
+            {trap_exit, false} -> ok
+            end,
             Error
         end;
     Error ->
@@ -276,7 +280,7 @@
 
 
 init_status_error(ReturnPid, Ref, Error) ->
-    ReturnPid ! {Ref, Error},
+    ReturnPid ! {Ref, self(), Error},
     ignore.
 
 % server functions

Modified: couchdb/trunk/src/couchdb/couch_server.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_server.erl?rev=727832&r1=727831&r2=727832&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_server.erl (original)
+++ couchdb/trunk/src/couchdb/couch_server.erl Thu Dec 18 13:43:34 2008
@@ -309,8 +309,10 @@
 
 handle_info({'EXIT', Pid, _Reason}, #server{current_dbs_open=DbsOpen}=Server) ->
     [{Pid, DbName}] = ets:lookup(couch_dbs_by_pid, Pid),
+    [{DbName, {Pid, LruTime}}] = ets:lookup(couch_dbs_by_name, DbName),
     true = ets:delete(couch_dbs_by_pid, Pid),
     true = ets:delete(couch_dbs_by_name, DbName),
+    true = ets:delete(couch_dbs_by_lru, LruTime),
     {noreply, Server#server{current_dbs_open=DbsOpen-1}};
 handle_info(Info, _Server) ->
     exit({unknown_message, Info}).

Modified: couchdb/trunk/src/couchdb/couch_view_group.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_view_group.erl?rev=727832&r1=727831&r2=727832&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_view_group.erl (original)
+++ couchdb/trunk/src/couchdb/couch_view_group.erl Thu Dec 18 13:43:34 2008
@@ -47,9 +47,19 @@
 start_link(InitArgs) ->
     case gen_server:start_link(couch_view_group,
             {InitArgs, self(), Ref = make_ref()}, []) of
-    {ok, Pid}   -> {ok, Pid};
-    ignore      -> receive {Ref, Error} -> Error end;
-    Error       -> Error
+    {ok, Pid} ->
+        {ok, Pid};
+    ignore -> 
+        receive
+        {Ref, Pid, Error} ->
+            case process_info(self(), trap_exit) of
+            {trap_exit, true} -> receive {'EXIT', Pid, _} -> ok end;
+            {trap_exit, false} -> ok
+            end,
+            Error
+        end;
+    Error ->
+        Error
     end.
 
 % init differentiates between temp and design_doc views. It creates a closure
@@ -67,7 +77,7 @@
                 updater_pid = Pid,
                 group=Group}};
     Error ->
-        ReturnPid ! {Ref, Error},
+        ReturnPid ! {Ref, self(), Error},
         ignore
     end.
 



Mime
View raw message