couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kocol...@apache.org
Subject git commit: Close view files cleanly on DB create/delete
Date Wed, 05 Dec 2012 23:41:18 GMT
Updated Branches:
  refs/heads/1.3.x a60646324 -> e64bbecd0


Close view files cleanly on DB create/delete

The shutdown_sync was actually interfering with a clean shutdown
initiated by the index processes themselves when they received a 'DOWN'
message from their monitoring of the DB process.  The explicit 'delete'
cast message in this patch is very probably redundant, but it makes the
intent clear.  The important bit is to let the index process terminate
*and* get confirmation of the termination before attempting to nuke the
directory.

COUCHDB-1364


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

Branch: refs/heads/1.3.x
Commit: e64bbecd01f054761ff77fa6f921b50aa1d5803d
Parents: a606463
Author: Adam Kocoloski <kocolosk@apache.org>
Authored: Sun Dec 2 09:04:48 2012 -0500
Committer: Adam Kocoloski <kocolosk@apache.org>
Committed: Wed Dec 5 15:41:05 2012 -0800

----------------------------------------------------------------------
 src/couch_index/src/couch_index_server.erl |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/e64bbecd/src/couch_index/src/couch_index_server.erl
----------------------------------------------------------------------
diff --git a/src/couch_index/src/couch_index_server.erl b/src/couch_index/src/couch_index_server.erl
index 48fa8e4..bc1fce7 100644
--- a/src/couch_index/src/couch_index_server.erl
+++ b/src/couch_index/src/couch_index_server.erl
@@ -160,7 +160,9 @@ reset_indexes(DbName, Root) ->
     % shutdown all the updaters and clear the files, the db got changed
     Fun = fun({_, {DDocId, Sig}}) ->
         [{_, Pid}] = ets:lookup(?BY_SIG, {DbName, Sig}),
-        couch_util:shutdown_sync(Pid),
+        MRef = erlang:monitor(process, Pid),
+        gen_server:cast(Pid, delete),
+        receive {'DOWN', MRef, _, _, _} -> ok end,
         rem_from_ets(DbName, Sig, DDocId, Pid)
     end,
     lists:foreach(Fun, ets:lookup(?BY_DB, DbName)),


Mime
View raw message