From 32c32013a6d2a8ee5fb231d3f3cb5538128650d2 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Thu, 9 Mar 2017 15:40:13 +0100 Subject: [PATCH] Fix loading of persisted blocks --- db.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/db.go b/db.go index bf8600fc4..7124ce106 100644 --- a/db.go +++ b/db.go @@ -369,10 +369,7 @@ func (db *DB) reloadBlocks() error { } heads = append(heads, b.(*headBlock)) } else { - if ok && meta.ULID != b.Meta().ULID { - if err := b.Close(); err != nil { - return err - } + if !ok || meta.ULID != b.Meta().ULID { b, err = newPersistedBlock(dirs[i]) if err != nil { return errors.Wrapf(err, "open persisted block %s", dirs[i]) @@ -385,7 +382,7 @@ func (db *DB) reloadBlocks() error { } for seq, b := range db.seqBlocks { - if _, ok := seqBlocks[seq]; !ok { + if nb, ok := seqBlocks[seq]; !ok || nb != b { if err := b.Close(); err != nil { return errors.Wrapf(err, "closing removed block %d", b.Meta().Sequence) }