Skip to content

Commit

Permalink
heal: Add hidden --pool and --set to heal a particular ES (#4971)
Browse files Browse the repository at this point in the history
--pool and --set are hidden flags. They could be used to heal a
particular erasure set. --pool and --set start with 1 (not indexes)
  • Loading branch information
vadmeste authored Jul 2, 2024
1 parent f5b325d commit e0d2e95
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
28 changes: 28 additions & 0 deletions cmd/admin-heal.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ const (
)

var adminHealFlags = []cli.Flag{
cli.IntFlag{
Name: "pool",
Usage: "heal only the given pool",
Hidden: true,
},
cli.IntFlag{
Name: "set",
Usage: "heal only the given set",
Hidden: true,
},
cli.StringFlag{
Name: "scan",
Usage: "select the healing scan mode (normal/deep)",
Expand Down Expand Up @@ -668,6 +678,24 @@ func mainAdminHeal(ctx *cli.Context) error {
Recreate: ctx.Bool("rewrite"),
}

if ctx.IsSet("pool") {
p := ctx.Int("pool")
if p < 1 {
fatalIf(errInvalidArgument(), "--pool takes a non zero positive number.")
}
p--
opts.Pool = &p
}

if ctx.IsSet("set") {
s := ctx.Int("set")
if s < 1 {
fatalIf(errInvalidArgument(), "--set takes a non zero positive number.")
}
s--
opts.Set = &s
}

forceStart := ctx.Bool("force-start")
forceStop := ctx.Bool("force-stop")
if forceStop {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ require (
github.com/charmbracelet/lipgloss v0.10.0
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/juju/ratelimit v1.0.2
github.com/minio/madmin-go/v3 v3.0.55-0.20240603092915-420a67132c32
github.com/minio/madmin-go/v3 v3.0.58-0.20240701162942-671010069ecb
github.com/minio/pkg/v3 v3.0.0
github.com/minio/selfupdate v0.6.0
github.com/muesli/reflow v0.3.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ 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.55-0.20240603092915-420a67132c32 h1:9se7/S4AlN2k/B1E7A8m1m07DM3p0JnIOzVhDuAV2PI=
github.com/minio/madmin-go/v3 v3.0.55-0.20240603092915-420a67132c32/go.mod h1:IFAwr0XMrdsLovxAdCcuq/eoL4nRuMVQQv0iubJANQw=
github.com/minio/madmin-go/v3 v3.0.58-0.20240701162942-671010069ecb h1:6Hx1+R0GR79Vt4gOKgadH4OG8tkrq/UNyxfmR1C7C14=
github.com/minio/madmin-go/v3 v3.0.58-0.20240701162942-671010069ecb/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.72-0.20240618070918-0b004e328e1e h1:Ye/gsaKgKD9lg1BgjG5fsGZdKevVpJO9bzqQg7badV8=
Expand Down

0 comments on commit e0d2e95

Please sign in to comment.