From 17c24c236aa41a4b74207b1bca55e218bd9318f1 Mon Sep 17 00:00:00 2001 From: Seebs Date: Fri, 11 Dec 2020 13:57:04 -0600 Subject: [PATCH] don't try to use the rowCache for CountRange Several issues: 1. tx.frag could be non-nil but not the fragment requested. 2. start and end need not be exact row boundaries. 3. therefore this could be returning the count of the row containing "start", for a fragment other than the one requested. 4. also in fact the rowcache wasn't populated before this so in one memory profile, this function alone was responsible for nearly 100GB of cached values... --- rbf.go | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/rbf.go b/rbf.go index c0d95502f..28b7932f8 100644 --- a/rbf.go +++ b/rbf.go @@ -360,19 +360,7 @@ func (tx *RBFTx) UnionInPlace(index, field, view string, shard uint64, others .. // CountRange returns the count of hot bits in the start, end range on the fragment. // roaring.countRange counts the number of bits set between [start, end). func (tx *RBFTx) CountRange(index, field, view string, shard uint64, start, end uint64) (n uint64, err error) { - - if tx.frag == nil { - return tx.tx.CountRange(rbfName(index, field, view, shard), start, end) - } - - // For speed, exploit the fact that on startup the rowCache will - // have already loaded fragments. - rowID := start / ShardWidth - row, err := tx.frag.unprotectedRow(tx, rowID) - if err != nil { - return 0, err - } - return row.Count(), nil + return tx.tx.CountRange(rbfName(index, field, view, shard), start, end) } func (tx *RBFTx) OffsetRange(index, field, view string, shard uint64, offset, start, end uint64) (*roaring.Bitmap, error) {