From a81c242ee501dd8f0a6034ed9e699f1ff1622847 Mon Sep 17 00:00:00 2001 From: Anis Eleuch Date: Mon, 12 Aug 2024 15:37:56 +0100 Subject: [PATCH] heal: Adapt the status based on a new Finished flag In a new MinIO version, Healing can be set to false while HealInfo is not nil. This indicates that the drive was healed and the healing is finished. This commit adapts the code with the new concept. This will not break with older MinIO versions since those versions will already remove .healing.bin, in that case Healing will be false, HealInfo will be nil. --- cmd/admin-heal.go | 6 +++--- go.mod | 2 ++ go.sum | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cmd/admin-heal.go b/cmd/admin-heal.go index 858c7e1dd9..5c08dd8fbb 100644 --- a/cmd/admin-heal.go +++ b/cmd/admin-heal.go @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2022 MinIO, Inc. +// Copyright (c) 2015-2024 MinIO, Inc. // // This file is part of MinIO Object Storage stack // @@ -398,7 +398,7 @@ func (s verboseBackgroundHealStatusMessage) String() string { stateText = console.Colorize("DiskFailed", d.State) } fmt.Fprintf(&msg, " + %s : %s\n", d.DrivePath, stateText) - if d.Healing && d.HealInfo != nil { + if d.Healing && d.HealInfo != nil && !d.HealInfo.Finished { now := time.Now().UTC() scanSpeed := float64(d.UsedSpace) / float64(now.Sub(d.HealInfo.Started)) remainingTime := time.Duration(float64(setsStatus[setIndex{d.PoolIndex, d.SetIndex}].maxUsedSpace-d.UsedSpace) / scanSpeed) @@ -495,7 +495,7 @@ func (s shortBackgroundHealStatusMessage) String() string { continue } - if disk.HealInfo != nil { + if disk.HealInfo != nil && !disk.HealInfo.Finished { missingInSet++ diskSet := setIndex{pool: disk.PoolIndex, set: disk.SetIndex} diff --git a/go.mod b/go.mod index fd55882a46..2e1f2fb8e3 100644 --- a/go.mod +++ b/go.mod @@ -119,3 +119,5 @@ require ( google.golang.org/grpc v1.65.0 // indirect google.golang.org/protobuf v1.34.2 // indirect ) + +replace github.com/minio/madmin-go/v3 => github.com/vadmeste/madmin-go/v3 v3.0.0-20240812132301-2f1172f311fb diff --git a/go.sum b/go.sum index b3605b532f..68b9a8c451 100644 --- a/go.sum +++ b/go.sum @@ -139,8 +139,6 @@ github.com/minio/colorjson v1.0.8 h1:AS6gEQ1dTRYHmC4xuoodPDRILHP/9Wz5wYUGDQfPLpg github.com/minio/colorjson v1.0.8/go.mod h1:wrs39G/4kqNlGjwqHvPlAnXuc2tlPszo6JKdSBCLN8w= github.com/minio/filepath v1.0.0 h1:fvkJu1+6X+ECRA6G3+JJETj4QeAYO9sV43I79H8ubDY= github.com/minio/filepath v1.0.0/go.mod h1:/nRZA2ldl5z6jT9/KQuvZcQlxZIMQoFFQPvEXx9T/Bw= -github.com/minio/madmin-go/v3 v3.0.58 h1:CUhb6FsBvgPfP1iOWvMGqlrB1epYpJw0i/yGXPH12WQ= -github.com/minio/madmin-go/v3 v3.0.58/go.mod h1:IFAwr0XMrdsLovxAdCcuq/eoL4nRuMVQQv0iubJANQw= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= github.com/minio/minio-go/v7 v7.0.73 h1:qr2vi96Qm7kZ4v7LLebjte+MQh621fFWnv93p12htEo= @@ -234,6 +232,8 @@ github.com/tklauser/go-sysconf v0.3.14 h1:g5vzr9iPFFz24v2KZXs/pvpvh8/V9Fw6vQK5ZZ github.com/tklauser/go-sysconf v0.3.14/go.mod h1:1ym4lWMLUOhuBOPGtRcJm7tEGX4SCYNEEEtghGG/8uY= github.com/tklauser/numcpus v0.8.0 h1:Mx4Wwe/FjZLeQsK/6kt2EOepwwSl7SmJrK5bV/dXYgY= github.com/tklauser/numcpus v0.8.0/go.mod h1:ZJZlAY+dmR4eut8epnzf0u/VwodKmryxR8txiloSqBE= +github.com/vadmeste/madmin-go/v3 v3.0.0-20240812132301-2f1172f311fb h1:Awgr0nBATt+lK0IDXw20/R2bfWL2svRTfhWNzsAVzBQ= +github.com/vadmeste/madmin-go/v3 v3.0.0-20240812132301-2f1172f311fb/go.mod h1:IFAwr0XMrdsLovxAdCcuq/eoL4nRuMVQQv0iubJANQw= github.com/vbauerster/mpb/v8 v8.7.3 h1:n/mKPBav4FFWp5fH4U0lPpXfiOmCEgl5Yx/NM3tKJA0= github.com/vbauerster/mpb/v8 v8.7.3/go.mod h1:9nFlNpDGVoTmQ4QvNjSLtwLmAFjwmq0XaAF26toHGNM= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=