From 7faa7620216b68048cea0a5b751d84eee6c3e487 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 16 Feb 2021 13:39:54 +0200 Subject: [PATCH] lib/mergeset: remove unused code after a4140de9e601a7ad2b6c13c35c2dc6f533883060 --- lib/mergeset/part_search.go | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/lib/mergeset/part_search.go b/lib/mergeset/part_search.go index 8711bc3b2..0c7b17855 100644 --- a/lib/mergeset/part_search.go +++ b/lib/mergeset/part_search.go @@ -25,9 +25,6 @@ type partSearch struct { // The remaining block headers to scan in the current metaindexRow. bhs []blockHeader - // Pointer to inmemory block, which may be reused. - inmemoryBlockReuse *inmemoryBlock - idxbCache *indexBlockCache ibCache *inmemoryBlockCache @@ -48,10 +45,6 @@ func (ps *partSearch) reset() { ps.p = nil ps.mrs = nil ps.bhs = nil - if ps.inmemoryBlockReuse != nil { - putInmemoryBlock(ps.inmemoryBlockReuse) - ps.inmemoryBlockReuse = nil - } ps.idxbCache = nil ps.ibCache = nil ps.err = nil @@ -240,10 +233,6 @@ func (ps *partSearch) Error() error { } func (ps *partSearch) nextBlock() error { - if ps.inmemoryBlockReuse != nil { - putInmemoryBlock(ps.inmemoryBlockReuse) - ps.inmemoryBlockReuse = nil - } if len(ps.bhs) == 0 { // The current metaindexRow is over. Proceed to the next metaindexRow. if err := ps.nextBHS(); err != nil { @@ -252,13 +241,10 @@ func (ps *partSearch) nextBlock() error { } bh := &ps.bhs[0] ps.bhs = ps.bhs[1:] - ib, mayReuseInmemoryBlock, err := ps.getInmemoryBlock(bh) + ib, err := ps.getInmemoryBlock(bh) if err != nil { return err } - if mayReuseInmemoryBlock { - ps.inmemoryBlockReuse = ib - } ps.ib = ib ps.ibItemIdx = 0 return nil @@ -301,19 +287,19 @@ func (ps *partSearch) readIndexBlock(mr *metaindexRow) (*indexBlock, error) { return idxb, nil } -func (ps *partSearch) getInmemoryBlock(bh *blockHeader) (*inmemoryBlock, bool, error) { +func (ps *partSearch) getInmemoryBlock(bh *blockHeader) (*inmemoryBlock, error) { var ibKey inmemoryBlockCacheKey ibKey.Init(bh) ib := ps.ibCache.Get(ibKey) if ib != nil { - return ib, false, nil + return ib, nil } ib, err := ps.readInmemoryBlock(bh) if err != nil { - return nil, false, err + return nil, err } ps.ibCache.Put(ibKey, ib) - return ib, false, nil + return ib, nil } func (ps *partSearch) readInmemoryBlock(bh *blockHeader) (*inmemoryBlock, error) {