Skip to content

Commit

Permalink
leveldb: fix table file leaks when manifest is rotated (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
qianbin authored Jul 21, 2022
1 parent 64ee559 commit 126854a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion leveldb/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,12 @@ func (s *session) commit(r *sessionRecord, trivial bool) (err error) {
}
}()

if s.manifest == nil || s.manifest.Size() >= s.o.GetMaxManifestFileSize() {
if s.manifest == nil {
// manifest journal writer not yet created, create one
err = s.newManifest(r, nv)
} else if s.manifest.Size() >= s.o.GetMaxManifestFileSize() {
// pass nil sessionRecord to avoid over-reference table file
err = s.newManifest(nil, nv)
} else {
err = s.flushManifest(r)
}
Expand Down

0 comments on commit 126854a

Please sign in to comment.