use cache.Recalculate instead of Invalidate for imports

Invalidate does not always rebuild the cache - if the last rebuild is < 10s ago,
it does nothing. We always want to rebuild the cache after imports.

Also updated the comments around recalculate/invalidate to clarify.
This commit is contained in:
Matt Jaffee 2018-09-12 17:07:46 -05:00
parent 14a8362261
commit 3ea07ae3a7
No known key found for this signature in database
GPG key ID: 08A3DFFF987B11BF
2 changed files with 4 additions and 4 deletions

View file

@ -40,10 +40,10 @@ type cache interface {
// Returns a list of all IDs.
IDs() []uint64
// Updates the cache, if necessary.
// Soft ask for the cache to be rebuilt - may not if it has been done recently.
Invalidate()
// Rebuilds the cache
// Rebuilds the cache.
Recalculate()
// Returns an ordered list of the top ranked bitmaps.

View file

@ -1386,7 +1386,7 @@ func (f *fragment) bulkImport(rowIDs, columnIDs []uint64) error {
f.cache.BulkAdd(rowID, n)
}
f.cache.Invalidate()
f.cache.Recalculate()
return snapshot(f, results)
}
@ -1462,7 +1462,7 @@ func (f *fragment) importRoaringBytes(roaringBytes []byte) error {
n := bm.CountRange(rowID*ShardWidth, (rowID+1)*ShardWidth)
f.cache.BulkAdd(rowID, n)
}
f.cache.Invalidate()
f.cache.Recalculate()
err = snapshot(f, bm)
return err