From dce62a88a93fc1526b6d79dd220afe9ccd332af7 Mon Sep 17 00:00:00 2001 From: Kresten Krab Thorup Date: Mon, 24 Sep 2012 17:31:32 +0200 Subject: [PATCH] Fix invalid error This fixes https://github.com/krestenkrab/hanoidb/issues/12 where an old file descriptor is used when storing 2i (transact data) causes the tx log to roll. --- src/hanoidb_nursery.erl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hanoidb_nursery.erl b/src/hanoidb_nursery.erl index 40b4f82..ebdbf61 100644 --- a/src/hanoidb_nursery.erl +++ b/src/hanoidb_nursery.erl @@ -264,9 +264,10 @@ ensure_space(Nursery, NeededRoom, Top) -> flush(Nursery, Top) end. -transact(Spec, Nursery=#nursery{ log_file=File, cache=Cache0, total_size=TotalSize, config=Config }, Top) -> - Nursery1 = ensure_space(Nursery, length(Spec), Top), +transact(Spec, Nursery, Top) -> + transact1(Spec, ensure_space(Nursery, length(Spec), Top), Top). +transact1(Spec, Nursery1=#nursery{ log_file=File, cache=Cache0, total_size=TotalSize, config=Config }, Top) -> Expiry = case hanoidb:get_opt(expiry_secs, Config) of 0 ->