You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ko...@apache.org on 2012/12/02 15:01:57 UTC
git commit: Close view files cleanly on DB create/delete
Updated Branches:
refs/heads/1364-windows_indexing_hang [created] d4981a68e
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/d4981a68
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/d4981a68
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/d4981a68
Branch: refs/heads/1364-windows_indexing_hang
Commit: d4981a68e86e3efd0ff4b2ddebb2ab524555301c
Parents: fb670f5
Author: Adam Kocoloski <ad...@cloudant.com>
Authored: Sun Dec 2 08:07:48 2012 -0500
Committer: Adam Kocoloski <ad...@cloudant.com>
Committed: Sun Dec 2 08:57:09 2012 -0500
----------------------------------------------------------------------
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/d4981a68/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)),