From 3591a90150bfad8d3f370d3d432f523b83743daf 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, 6 insertions(+), 6 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 0ea0c8976a..07541c441e 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/minio/cli v1.24.2 github.com/minio/colorjson v1.0.8 github.com/minio/filepath v1.0.0 - github.com/minio/madmin-go/v3 v3.0.60 + github.com/minio/madmin-go/v3 v3.0.63 github.com/minio/minio-go/v7 v7.0.75 github.com/minio/pkg/v3 v3.0.11 github.com/minio/selfupdate v0.6.0 diff --git a/go.sum b/go.sum index 0492323780..57978f1844 100644 --- a/go.sum +++ b/go.sum @@ -136,8 +136,8 @@ 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.60 h1:Vy9t7Mti22EcqqQyYRcvtLJmluaA3VINhBzaDBsT8h8= -github.com/minio/madmin-go/v3 v3.0.60/go.mod h1:IFAwr0XMrdsLovxAdCcuq/eoL4nRuMVQQv0iubJANQw= +github.com/minio/madmin-go/v3 v3.0.63 h1:ERJRxEI/FFRh8MDi4Z+3DKe4sONkQ0g+OkNzRpk7qxk= +github.com/minio/madmin-go/v3 v3.0.63/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.75 h1:0uLrB6u6teY2Jt+cJUVi9cTvDRuBKWSRzSAcznRkwlE=