diff options
author | Damien F. Katz <damien@apache.org> | 2010-03-04 01:09:22 +0000 |
---|---|---|
committer | Damien F. Katz <damien@apache.org> | 2010-03-04 01:09:22 +0000 |
commit | 3a3a9c1efab1c9fe4cd5ebb6c80da4005eb0806b (patch) | |
tree | f850ff24c113465531aab2bdcdb2f2e70855d00c /src/couchdb/couch_db_updater.erl | |
parent | 2ea7ab6a8525184ecdbfcee69667e200511b9f9b (diff) |
Changed process tree shutdown to be synchronous, to eliminate spurious test failures caused by processes not shutdown fast enough or at the wrong time.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@918805 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_db_updater.erl')
-rw-r--r-- | src/couchdb/couch_db_updater.erl | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/couchdb/couch_db_updater.erl b/src/couchdb/couch_db_updater.erl index 982ee03a..fdd79481 100644 --- a/src/couchdb/couch_db_updater.erl +++ b/src/couchdb/couch_db_updater.erl @@ -20,6 +20,7 @@ init({MainPid, DbName, Filepath, Fd, Options}) -> + process_flag(trap_exit, true), case lists:member(create, Options) of true -> % create a new header and writes it to the file @@ -37,8 +38,10 @@ init({MainPid, DbName, Filepath, Fd, Options}) -> {ok, Db2#db{main_pid=MainPid}}. -terminate(Reason, _Srv) -> - couch_util:terminate_linked(Reason), +terminate(_Reason, Db) -> + couch_file:close(Db#db.fd), + couch_util:shutdown_sync(Db#db.compactor_pid), + couch_util:shutdown_sync(Db#db.fd_ref_counter), ok. handle_call(get_db, _From, Db) -> @@ -214,7 +217,11 @@ handle_info(delayed_commit, Db) -> Db2 -> ok = gen_server:call(Db2#db.main_pid, {db_updated, Db2}), {noreply, Db2} - end. + end; +handle_info({'EXIT', _Pid, normal}, Db) -> + {noreply, Db}; +handle_info({'EXIT', _Pid, Reason}, Db) -> + {stop, Reason, Db}. code_change(_OldVsn, State, _Extra) -> {ok, State}. |