From 6bc47cb399c42e23aa53788c26accb9dd0ef2eb8 Mon Sep 17 00:00:00 2001 From: Jarek Kowalski Date: Sun, 31 May 2020 17:24:12 -0700 Subject: [PATCH] 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 --- repo/content/content_manager_lock_free.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/repo/content/content_manager_lock_free.go b/repo/content/content_manager_lock_free.go index 847bf28b9..37a62fe92 100644 --- a/repo/content/content_manager_lock_free.go +++ b/repo/content/content_manager_lock_free.go @@ -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 }