From 3ddfd97aeaef946c4851897b11cf7c444546c0d3 Mon Sep 17 00:00:00 2001 From: Kresten Krab Thorup Date: Thu, 19 Jan 2012 14:15:46 +0100 Subject: [PATCH] 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. --- test/lsm_btree_drv.erl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/lsm_btree_drv.erl b/test/lsm_btree_drv.erl index 9d47f7e..5b1800e 100644 --- a/test/lsm_btree_drv.erl +++ b/test/lsm_btree_drv.erl @@ -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) ->