From 54c33216b2eb07b2e2074862012f77a2f18d1de2 Mon Sep 17 00:00:00 2001 From: gary rong Date: Mon, 26 Oct 2020 00:04:11 +0800 Subject: [PATCH] leveldb: release the compaction object if it's discarded (#8) --- leveldb/db_compaction.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/leveldb/db_compaction.go b/leveldb/db_compaction.go index 56440df5..b19d8072 100644 --- a/leveldb/db_compaction.go +++ b/leveldb/db_compaction.go @@ -689,11 +689,16 @@ func (db *DB) tableRangeCompactionAt(level int, umin, umax []byte) error { comp = db.s.getCompactionRange(ctx, level, umin, umax) } if comp != nil { + // If the compaction object is eventually discarded, + // don't forget to release it in order to release the + // underlying version. select { case <-db.closeC: + comp.release() return ErrClosed case c := <-done: ctx.delete(c) + comp.release() continue default: }