Skip to content

Commit

Permalink
heal: Adapt the status based on a new Finished flag
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Anis Eleuch committed Aug 21, 2024
1 parent 690f3f8 commit 3591a90
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions cmd/admin-heal.go
Original file line number Diff line number Diff line change
@@ -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
//
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 3591a90

Please sign in to comment.