content: emit warning whenever the number of index blobs gets too high, which is an indication that maintenance has not run in a long time

This commit is contained in:
Jarek Kowalski
2020-05-31 17:24:12 -07:00
committed by Julio López
parent 960c33475e
commit 6bc47cb399

View File

@@ -19,6 +19,8 @@
"github.com/kopia/kopia/repo/hashing"
)
const indexBlobCompactionWarningThreshold = 100
// lockFreeManager contains parts of Manager state that can be accessed without locking
type lockFreeManager struct {
// this one is not lock-free
@@ -119,6 +121,10 @@ func (bm *lockFreeManager) loadPackIndexesUnlocked(ctx context.Context) ([]Index
return nil, false, err
}
if len(indexBlobs) > indexBlobCompactionWarningThreshold {
log(ctx).Warningf("Found too many index blobs (%v), this may result in degraded performance.\n\nPlease ensure periodic repository maintenance is enabled or run 'kopia maintenance'.", len(indexBlobs))
}
return indexBlobs, updated, nil
}