Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

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

  • Loading branch information...
commit 370e7decdb4b715a50b61d6eed797faa83c29cca 1 parent fb670f5
@kocolosk kocolosk authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/couch_index/src/couch_index_server.erl
4 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)
lists:foreach(Fun, ets:lookup(?BY_DB, DbName)),
Please sign in to comment.
Something went wrong with that request. Please try again.