mirror of
https://github.com/minio/minio.git
synced 2025-11-09 05:34:56 -05:00
Fix invalidated metacaches (#10784)
* Fix caches having EOF marked as a failure. * Simplify cache updates. * Provide context for checkMetacacheState failures. * Log 499 when the client disconnects.
This commit is contained in:
@@ -247,7 +247,7 @@ func (b *bucketMetacache) findCache(o listPathOptions) metacache {
|
||||
b.caches[best.id] = best
|
||||
b.updated = true
|
||||
}
|
||||
debugPrint("returning cached")
|
||||
debugPrint("returning cached %s, status: %v, ended: %v", best.id, best.status, best.ended)
|
||||
return best
|
||||
}
|
||||
if !o.Create {
|
||||
@@ -348,16 +348,20 @@ func (b *bucketMetacache) updateCacheEntry(update metacache) (metacache, error)
|
||||
}
|
||||
|
||||
existing.lastUpdate = UTCNow()
|
||||
if existing.status == scanStateStarted && update.status != scanStateStarted {
|
||||
existing.status = update.status
|
||||
}
|
||||
if existing.status == scanStateSuccess && update.status == scanStateSuccess {
|
||||
|
||||
if existing.status == scanStateStarted && update.status == scanStateSuccess {
|
||||
existing.ended = UTCNow()
|
||||
existing.endedCycle = update.endedCycle
|
||||
}
|
||||
|
||||
if existing.status == scanStateStarted && update.status != scanStateStarted {
|
||||
existing.status = update.status
|
||||
}
|
||||
|
||||
if existing.error == "" && update.error != "" {
|
||||
existing.error = update.error
|
||||
existing.status = scanStateError
|
||||
existing.ended = UTCNow()
|
||||
}
|
||||
existing.fileNotFound = existing.fileNotFound || update.fileNotFound
|
||||
b.caches[update.id] = existing
|
||||
|
||||
Reference in New Issue
Block a user