mirror of
https://github.com/minio/minio.git
synced 2026-02-11 13:20:16 -05:00
Optimize background heal status to use LocalStorageInfo (#16414)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user