From 3039fd4519750e72c16d875662fc084fc2d2304f Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Tue, 17 Jan 2023 00:32:00 +0100 Subject: [PATCH] Optimize background heal status to use LocalStorageInfo (#16414) --- cmd/admin-handlers.go | 2 +- cmd/global-heal.go | 6 +++--- cmd/peer-rest-server.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cmd/admin-handlers.go b/cmd/admin-handlers.go index 1adc651d6..df927ed43 100644 --- a/cmd/admin-handlers.go +++ b/cmd/admin-handlers.go @@ -1102,7 +1102,7 @@ func (a adminAPIHandlers) HealHandler(w http.ResponseWriter, r *http.Request) { // If no ObjectLayer is provided no set status is returned. func getAggregatedBackgroundHealState(ctx context.Context, o ObjectLayer) (madmin.BgHealState, error) { // Get local heal status first - bgHealStates, ok := getBackgroundHealStatus(ctx, o) + bgHealStates, ok := getLocalBackgroundHealStatus(ctx, o) if !ok { return bgHealStates, errServerNotInitialized } diff --git a/cmd/global-heal.go b/cmd/global-heal.go index abd508f06..a47fe7efd 100644 --- a/cmd/global-heal.go +++ b/cmd/global-heal.go @@ -70,8 +70,8 @@ func newBgHealSequence() *healSequence { } } -// getBackgroundHealStatus will return the -func getBackgroundHealStatus(ctx context.Context, o ObjectLayer) (madmin.BgHealState, bool) { +// getLocalBackgroundHealStatus will return the heal status of the local node +func getLocalBackgroundHealStatus(ctx context.Context, o ObjectLayer) (madmin.BgHealState, bool) { if globalBackgroundHealState == nil { return madmin.BgHealState{}, false } @@ -105,7 +105,7 @@ func getBackgroundHealStatus(ctx context.Context, o ObjectLayer) (madmin.BgHealS return status, true } - si := o.StorageInfo(ctx) + si := o.LocalStorageInfo(ctx) indexed := make(map[string][]madmin.Disk) for _, disk := range si.Disks { diff --git a/cmd/peer-rest-server.go b/cmd/peer-rest-server.go index 633e2135a..ce6731624 100644 --- a/cmd/peer-rest-server.go +++ b/cmd/peer-rest-server.go @@ -1029,7 +1029,7 @@ func (s *peerRESTServer) BackgroundHealStatusHandler(w http.ResponseWriter, r *h } ctx := newContext(r, w, "BackgroundHealStatus") - state, ok := getBackgroundHealStatus(ctx, newObjectLayerFn()) + state, ok := getLocalBackgroundHealStatus(ctx, newObjectLayerFn()) if !ok { s.writeErrorResponse(w, errServerNotInitialized) return diff --git a/go.mod b/go.mod index 12d7a9e25..d0d2bad75 100644 --- a/go.mod +++ b/go.mod @@ -49,7 +49,7 @@ require ( github.com/minio/dperf v0.4.2 github.com/minio/highwayhash v1.0.2 github.com/minio/kes v0.22.2 - github.com/minio/madmin-go/v2 v2.0.6 + github.com/minio/madmin-go/v2 v2.0.7 github.com/minio/minio-go/v7 v7.0.45 github.com/minio/pkg v1.5.8 github.com/minio/selfupdate v0.5.0 diff --git a/go.sum b/go.sum index 4eaf16a86..aa1aea182 100644 --- a/go.sum +++ b/go.sum @@ -770,8 +770,8 @@ github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLT github.com/minio/kes v0.22.2 h1:9NdgTx+TFJco0Pqdrq8WZbrTZVv0ichg+sbPRQiJ2HU= github.com/minio/kes v0.22.2/go.mod h1:J9sD6Pe8obPt7+JXFcznkWaYaj9pBWCfN9U9j//NsNw= github.com/minio/madmin-go v1.6.6/go.mod h1:ATvkBOLiP3av4D++2v1UEHC/QzsGtgXD5kYvvRYzdKs= -github.com/minio/madmin-go/v2 v2.0.6 h1:d0cfiH5SkC8vZHgRtcki8j37fb3FF65cTdjUdfBR8ks= -github.com/minio/madmin-go/v2 v2.0.6/go.mod h1:5aFi/VLWBHC2DEFfGIlUmAeJhaF4ZAjuYpEWZFU14Zw= +github.com/minio/madmin-go/v2 v2.0.7 h1:4md3j370GBxNR71SzTU7GSbQEg+SdB4LgL42QGzszfI= +github.com/minio/madmin-go/v2 v2.0.7/go.mod h1:5aFi/VLWBHC2DEFfGIlUmAeJhaF4ZAjuYpEWZFU14Zw= github.com/minio/mc v0.0.0-20221224152138-176072dee43d h1:etzZIWQ3NFrxzwnvjczETWMcgoja9ZKLFLIfQzvpqP8= github.com/minio/mc v0.0.0-20221224152138-176072dee43d/go.mod h1:af4hDQUHwu8az+6TyEKXa2Yd+lvMDVgnc9/kstHPZY8= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=