couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r954449 - in /couchdb/branches/0.11.x: src/couchdb/couch_server.erl src/couchdb/couch_view.erl test/etap/010-file-basics.t test/etap/040-util.t
Date Mon, 14 Jun 2010 13:31:19 GMT
Author: jan
Date: Mon Jun 14 13:31:18 2010
New Revision: 954449

URL: http://svn.apache.org/viewvc?rev=954449&view=rev
Log:
Revert "Merged r930363 from trunk:"

This reverts commit f7ac88db166c7082dd510d157c3c6649306914f6.

Modified:
    couchdb/branches/0.11.x/src/couchdb/couch_server.erl
    couchdb/branches/0.11.x/src/couchdb/couch_view.erl
    couchdb/branches/0.11.x/test/etap/010-file-basics.t
    couchdb/branches/0.11.x/test/etap/040-util.t

Modified: couchdb/branches/0.11.x/src/couchdb/couch_server.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_server.erl?rev=954449&r1=954448&r2=954449&view=diff
==============================================================================
--- couchdb/branches/0.11.x/src/couchdb/couch_server.erl (original)
+++ couchdb/branches/0.11.x/src/couchdb/couch_server.erl Mon Jun 14 13:31:18 2010
@@ -212,13 +212,7 @@ open_async(Server, From, DbName, Filepat
     Opener = spawn_link(fun() ->
             Res = couch_db:start_link(DbName, Filepath, Options),
             gen_server:call(Parent, {open_result, DbName, Res}, infinity),
-            unlink(Parent),
-            case Res of
-            {ok, DbReader} ->
-                unlink(DbReader);
-            _ ->
-                ok
-            end
+            unlink(Parent)
         end),
     true = ets:insert(couch_dbs_by_name, {DbName, {opening, Opener, [From]}}),
     true = ets:insert(couch_dbs_by_pid, {Opener, DbName}),
@@ -305,13 +299,15 @@ handle_call({delete, DbName, _Options}, 
         case ets:lookup(couch_dbs_by_name, DbName) of
         [] -> Server;
         [{_, {opening, Pid, Froms}}] ->
-            couch_util:shutdown_sync(Pid),
+            exit(Pid, kill),
+            receive {'EXIT', Pid, _Reason} -> ok end,
             true = ets:delete(couch_dbs_by_name, DbName),
             true = ets:delete(couch_dbs_by_pid, Pid),
             [gen_server:send_result(F, not_found) || F <- Froms],
             Server#server{dbs_open=Server#server.dbs_open - 1};
         [{_, {opened, Pid, LruTime}}] ->
-            couch_util:shutdown_sync(Pid),
+            exit(Pid, kill),
+            receive {'EXIT', Pid, _Reason} -> ok end,
             true = ets:delete(couch_dbs_by_name, DbName),
             true = ets:delete(couch_dbs_by_pid, Pid),
             true = ets:delete(couch_dbs_by_lru, LruTime),
@@ -341,9 +337,19 @@ handle_cast(Msg, _Server) ->
 code_change(_OldVsn, State, _Extra) ->
     {ok, State}.
 
-handle_info({'EXIT', _Pid, config_change}, Server) ->
-    {noreply, shutdown, Server};
-handle_info(Error, _Server) ->
-    ?LOG_ERROR("Unexpected message, restarting couch_server: ~p", [Error]),
-    exit(kill).
+handle_info({'EXIT', _Pid, config_change}, _Server) ->
+    {stop, shutdown, Server};
+handle_info({'EXIT', Pid, Reason}, #server{dbs_open=DbsOpen}=Server) ->
+    [{Pid, DbName}] = ets:lookup(couch_dbs_by_pid, Pid),
+    case ets:lookup(couch_dbs_by_name, DbName) of
+    [{DbName, {opened, Pid, LruTime}}] ->
+        true = ets:delete(couch_dbs_by_lru, LruTime);
+    [{DbName, {opening, Pid, Froms}}] ->
+        [gen_server:reply(From, Reason) || From <- Froms]
+    end,
+    true = ets:delete(couch_dbs_by_pid, Pid),
+    true = ets:delete(couch_dbs_by_name, DbName),
+    {noreply, Server#server{dbs_open=DbsOpen - 1}};
+qhandle_info(Info, _Server) ->
+    exit({unknown_message, Info}).
 

Modified: couchdb/branches/0.11.x/src/couchdb/couch_view.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/src/couchdb/couch_view.erl?rev=954449&r1=954448&r2=954449&view=diff
==============================================================================
--- couchdb/branches/0.11.x/src/couchdb/couch_view.erl (original)
+++ couchdb/branches/0.11.x/src/couchdb/couch_view.erl Mon Jun 14 13:31:18 2010
@@ -312,7 +312,8 @@ do_reset_indexes(DbName, Root) ->
         fun({_DbName, Sig}) ->
             ?LOG_DEBUG("Killing update process for view group ~s. in database ~s.", [Sig,
DbName]),
             [{_, Pid}] = ets:lookup(group_servers_by_sig, {DbName, Sig}),
-            couch_util:shutdown_sync(Pid)
+            couch_util:shutdown_sync(Pid),
+            delete_from_ets(Pid, DbName, Sig)
         end, Names),
     delete_index_dir(Root, DbName),
     file:delete(Root ++ "/." ++ ?b2l(DbName) ++ "_temp").

Modified: couchdb/branches/0.11.x/test/etap/010-file-basics.t
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/test/etap/010-file-basics.t?rev=954449&r1=954448&r2=954449&view=diff
==============================================================================
--- couchdb/branches/0.11.x/test/etap/010-file-basics.t (original)
+++ couchdb/branches/0.11.x/test/etap/010-file-basics.t Mon Jun 14 13:31:18 2010
@@ -16,7 +16,7 @@ filename() -> test_util:build_file("test
 
 main(_) ->
     test_util:init_code_path(),
-    etap:plan(19),
+    etap:plan(16),
     case (catch test()) of
         ok ->
             etap:end_tests();

Modified: couchdb/branches/0.11.x/test/etap/040-util.t
URL: http://svn.apache.org/viewvc/couchdb/branches/0.11.x/test/etap/040-util.t?rev=954449&r1=954448&r2=954449&view=diff
==============================================================================
--- couchdb/branches/0.11.x/test/etap/040-util.t (original)
+++ couchdb/branches/0.11.x/test/etap/040-util.t Mon Jun 14 13:31:18 2010
@@ -17,7 +17,7 @@ main(_) ->
     test_util:init_code_path(),
     application:start(crypto),
 
-    etap:plan(14),
+    etap:plan(16),
     case (catch test()) of
         ok ->
             etap:end_tests();



Mime
View raw message