From 63e948e73ba873b6861913425112bcf33eaed8a6 Mon Sep 17 00:00:00 2001 From: Roland Singer Date: Wed, 17 Dec 2014 21:42:57 +0100 Subject: [PATCH] Fixes #1 --- reaper/reaper.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/reaper/reaper.go b/reaper/reaper.go index 8bc2158..63bcf3a 100644 --- a/reaper/reaper.go +++ b/reaper/reaper.go @@ -60,6 +60,10 @@ func reap(db *bolt.DB, options Options, quitC <-chan struct{}, doneC chan<- stru } if options.BatchSize == i { + // Store the current key to the previous key. + // Copy the byte slice key, because this data is + // not safe outside of this transaction. + prevKey = make([]byte, len(k)) copy(prevKey, k) return nil }