diff options
author | John Christopher Anderson <jchris@apache.org> | 2010-03-04 03:10:19 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2010-03-04 03:10:19 +0000 |
commit | d318717866ffa267781ab482e99a05415e2ac0e4 (patch) | |
tree | 207409d78eacca8e206deb05b99689ec449722a4 /src/couchdb/couch_server.erl | |
parent | 3a3a9c1efab1c9fe4cd5ebb6c80da4005eb0806b (diff) |
reverting damien's latest commit until we can figure out why it's causing failures
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@918834 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_server.erl')
-rw-r--r-- | src/couchdb/couch_server.erl | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/couchdb/couch_server.erl b/src/couchdb/couch_server.erl index 61794dea..325d4a12 100644 --- a/src/couchdb/couch_server.erl +++ b/src/couchdb/couch_server.erl @@ -147,9 +147,8 @@ init([]) -> max_dbs_open=MaxDbsOpen, start_time=httpd_util:rfc1123_date()}}. -terminate(_Reason, _Srv) -> - [couch_util:shutdown_sync(Pid) || {_, {Pid, _LruTime}} <- - ets:tab2list(couch_dbs_by_name)], +terminate(Reason, _Srv) -> + couch_util:terminate_linked(Reason), ok. all_databases() -> @@ -188,7 +187,8 @@ try_close_lru(StartTime) -> [{_, {MainPid, LruTime}}] = ets:lookup(couch_dbs_by_name, DbName), case couch_db:is_idle(MainPid) of true -> - couch_util:shutdown_sync(MainPid), + exit(MainPid, kill), + receive {'EXIT', MainPid, _Reason} -> ok end, true = ets:delete(couch_dbs_by_lru, LruTime), true = ets:delete(couch_dbs_by_name, DbName), true = ets:delete(couch_dbs_by_pid, MainPid), @@ -284,7 +284,8 @@ handle_call({delete, DbName, _Options}, _From, Server) -> case ets:lookup(couch_dbs_by_name, DbName) of [] -> Server; [{_, {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), @@ -314,18 +315,14 @@ handle_cast(Msg, _Server) -> code_change(_OldVsn, State, _Extra) -> {ok, State}. -handle_info({'EXIT', _Pid, config_change}, Server) -> - {stop, shutdown, Server}; -handle_info({'EXIT', Pid, Reason}, #server{dbs_open=DbsOpen}=Server) -> - case ets:lookup(couch_dbs_by_pid, Pid) of - [{Pid, DbName}] -> - [{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{dbs_open=DbsOpen - 1}}; - _ -> - {stop,Reason,Server} - end; +handle_info({'EXIT', _Pid, config_change}, _Server) -> + exit(kill); +handle_info({'EXIT', Pid, _Reason}, #server{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{dbs_open=DbsOpen - 1}}; handle_info(Info, _Server) -> exit({unknown_message, Info}). |