From 340a97db987a469c52c84c69146b0e92b43bdbac Mon Sep 17 00:00:00 2001 From: Naman Jain Date: Wed, 2 Jun 2021 14:18:00 +0530 Subject: [PATCH] chore: update changelog for 2011 (#1710) --- levels.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/levels.go b/levels.go index 839d3099c..313ff03d1 100644 --- a/levels.go +++ b/levels.go @@ -830,26 +830,21 @@ func (s *levelsController) subcompact(it y.Iterator, kr keyRange, cd compactDef, continue } numBuilds++ - fileID := s.reserveFileID() if err := inflightBuilders.Do(); err != nil { // Can't return from here, until I decrRef all the tables that I built so far. break } - go func(builder *table.Builder) { + go func(builder *table.Builder, fileID uint64) { var err error defer inflightBuilders.Done(err) defer builder.Close() - build := func(fileID uint64) (*table.Table, error) { - fname := table.NewFilename(fileID, s.kv.opt.Dir) - return table.CreateTable(fname, builder) - } - var tbl *table.Table if s.kv.opt.InMemory { tbl, err = table.OpenInMemoryTable(builder.Finish(), fileID, &bopts) } else { - tbl, err = build(fileID) + fname := table.NewFilename(fileID, s.kv.opt.Dir) + tbl, err = table.CreateTable(fname, builder) } // If we couldn't build the table, return fast. @@ -857,7 +852,7 @@ func (s *levelsController) subcompact(it y.Iterator, kr keyRange, cd compactDef, return } res <- tbl - }(builder) + }(builder, s.reserveFileID()) } s.kv.vlog.updateDiscardStats(discardStats) s.kv.opt.Debugf("Discard stats: %v", discardStats)