Close trees before cleanup

Problem is that we sometimes get errors resulting
from files being written as a result of pending
merges.  Closing a tree should stop all such
file-level activity.
This commit is contained in:
Kresten Krab Thorup 2012-01-19 14:15:46 +01:00
parent 29d1493415
commit 3ddfd97aea

View file

@ -88,7 +88,8 @@ handle_call({lookup, N, K}, _, #state { btrees = D} = State) ->
Tree = dict:fetch(N, D),
Reply = lsm_btree:lookup(Tree, K),
{reply, Reply, State};
handle_call(stop, _, State) ->
handle_call(stop, _, #state{ btrees = D } = State ) ->
[ lsm_btree:close(Tree) || {_,Tree} <- dict:to_list(D) ],
cleanup_trees(State),
{stop, normal, ok, State};
handle_call(_Request, _From, State) ->