From d0d0bdd722b320c44f02c07e911e030d5bb0c953 Mon Sep 17 00:00:00 2001 From: Matt Jaffee Date: Wed, 12 Sep 2018 17:25:12 -0500 Subject: [PATCH] simplify fragment.unprotectedRow (unparam) --- fragment.go | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/fragment.go b/fragment.go index c521d1187..6d92ce37f 100644 --- a/fragment.go +++ b/fragment.go @@ -338,15 +338,13 @@ func (f *fragment) closeStorage() error { func (f *fragment) row(rowID uint64) *Row { f.mu.Lock() defer f.mu.Unlock() - return f.unprotectedRow(rowID, true, true) + return f.unprotectedRow(rowID) } -func (f *fragment) unprotectedRow(rowID uint64, checkRowCache bool, updateRowCache bool) *Row { - if checkRowCache { - r, ok := f.rowCache.Fetch(rowID) - if ok && r != nil { - return r - } +func (f *fragment) unprotectedRow(rowID uint64) *Row { + r, ok := f.rowCache.Fetch(rowID) + if ok && r != nil { + return r } // Only use a subset of the containers. @@ -365,9 +363,7 @@ func (f *fragment) unprotectedRow(rowID uint64, checkRowCache bool, updateRowCac } row.invalidateCount() - if updateRowCache { - f.rowCache.Add(rowID, row) - } + f.rowCache.Add(rowID, row) return row } @@ -427,7 +423,7 @@ func (f *fragment) unprotectedSetBit(rowID, columnID uint64) (changed bool, err } // Get the row from row cache or fragment.storage. - row := f.unprotectedRow(rowID, true, true) + row := f.unprotectedRow(rowID) row.SetBit(columnID) // Update the cache. @@ -479,7 +475,7 @@ func (f *fragment) unprotectedClearBit(rowID, columnID uint64) (changed bool, er } // Get the row from cache or fragment.storage. - row := f.unprotectedRow(rowID, true, true) + row := f.unprotectedRow(rowID) row.clearBit(columnID) // Update the cache.