diff --git a/cache.go b/cache.go index b03e4951c..746934c47 100644 --- a/cache.go +++ b/cache.go @@ -262,6 +262,8 @@ func (c *rankCache) invalidate() { // The cache will remain flagged as dirty and will be recalculated if Top is called. // This may cause unexpected memory growth, so record it in metrics for debugging purposes. c.stats.Count(MetricInvalidateCacheSkipped, 1, 1.0) + // Ensure that we're marked as dirty even if we weren't otherwise. + c.dirty = true return } c.stats.Count(MetricInvalidateCache, 1, 1.0) diff --git a/fragment.go b/fragment.go index 8d305bde1..a39c5a422 100644 --- a/fragment.go +++ b/fragment.go @@ -2528,7 +2528,7 @@ func (f *fragment) importPositions(tx Tx, set, clear []uint64, rowSet map[uint64 } if f.CacheType != CacheTypeNone { - f.cache.Recalculate() + f.cache.Invalidate() } return nil } @@ -2826,7 +2826,7 @@ func (f *fragment) unprotectedImportRoaring(ctx context.Context, tx Tx, data []b } // we only set this if we need to update the cache if anyChanged { - f.cache.Recalculate() + f.cache.Invalidate() } span, _ = tracing.StartSpanFromContext(ctx, "importRoaring.incrementOpN")