Skip to content

Commit

Permalink
leveldb: release the compaction object if it's discarded (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjl493456442 authored Oct 25, 2020
1 parent a4ce3a3 commit 54c3321
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions leveldb/db_compaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
}
Expand Down

0 comments on commit 54c3321

Please sign in to comment.