Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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
directory.

COUCHDB-1364
  • Loading branch information...
commit c20f91dccc76bb212bf73f977e78816123dd20f2 1 parent 18bf2ba
@kocolosk kocolosk authored benoitc committed
Showing with 3 additions and 1 deletion.
  1. +3 −1 apps/couch_index/src/couch_index_server.erl
View
4 apps/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)),
Please sign in to comment.
Something went wrong with that request. Please try again.