From f0819cce75d4a9c72472198ccd9868066cae0efa Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Wed, 4 Nov 2020 08:01:33 -0800 Subject: [PATCH] Keep transient lists while they are updating (#10826) On extremely long running listings keep the transient list 15 minutes after last update instead of using start time. Also don't do overlap checks on transient lists. --- cmd/metacache-bucket.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/metacache-bucket.go b/cmd/metacache-bucket.go index 26ff7b3b6..b3453f61d 100644 --- a/cmd/metacache-bucket.go +++ b/cmd/metacache-bucket.go @@ -297,27 +297,34 @@ func (b *bucketMetacache) cleanup() { b.mu.RLock() for id, cache := range b.caches { - if b.transient && time.Since(cache.started) > time.Hour { + if b.transient && time.Since(cache.lastUpdate) > 15*time.Minute && time.Since(cache.lastHandout) > 15*time.Minute { // Keep transient caches only for 1 hour. remove[id] = struct{}{} + continue } if !cache.worthKeeping(currentCycle) { debugPrint("cache %s not worth keeping", id) remove[id] = struct{}{} + continue } if cache.id != id { logger.Info("cache ID mismatch %s != %s", id, cache.id) remove[id] = struct{}{} + continue } if cache.bucket != b.bucket && !b.transient { logger.Info("cache bucket mismatch %s != %s", b.bucket, cache.bucket) remove[id] = struct{}{} + continue } } // Check all non-deleted against eachother. // O(n*n), but should still be rather quick. for id, cache := range b.caches { + if b.transient { + break + } if _, ok := remove[id]; ok { continue }