mirror of
https://github.com/minio/minio.git
synced 2025-01-25 13:43:17 -05:00
healthcheck cluster endpoint should honor write/readQuorum per pool (#15053)
This commit is contained in:
parent
f71b56a5d0
commit
b0d7332a0c
@ -2082,11 +2082,14 @@ func (z *erasureServerPools) ReadHealth(ctx context.Context) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
b := z.BackendInfo()
|
b := z.BackendInfo()
|
||||||
readQuorum := b.StandardSCData[0]
|
poolReadQuorums := make([]int, len(b.StandardSCData))
|
||||||
|
for i, data := range b.StandardSCData {
|
||||||
|
poolReadQuorums[i] = data
|
||||||
|
}
|
||||||
|
|
||||||
for poolIdx := range erasureSetUpCount {
|
for poolIdx := range erasureSetUpCount {
|
||||||
for setIdx := range erasureSetUpCount[poolIdx] {
|
for setIdx := range erasureSetUpCount[poolIdx] {
|
||||||
if erasureSetUpCount[poolIdx][setIdx] < readQuorum {
|
if erasureSetUpCount[poolIdx][setIdx] < poolReadQuorums[poolIdx] {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2123,9 +2126,12 @@ func (z *erasureServerPools) Health(ctx context.Context, opts HealthOptions) Hea
|
|||||||
reqInfo := (&logger.ReqInfo{}).AppendTags("maintenance", strconv.FormatBool(opts.Maintenance))
|
reqInfo := (&logger.ReqInfo{}).AppendTags("maintenance", strconv.FormatBool(opts.Maintenance))
|
||||||
|
|
||||||
b := z.BackendInfo()
|
b := z.BackendInfo()
|
||||||
writeQuorum := b.StandardSCData[0]
|
poolWriteQuorums := make([]int, len(b.StandardSCData))
|
||||||
if writeQuorum == b.StandardSCParity {
|
for i, data := range b.StandardSCData {
|
||||||
writeQuorum++
|
poolWriteQuorums[i] = data
|
||||||
|
if data == b.StandardSCParity {
|
||||||
|
poolWriteQuorums[i] = data + 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var aggHealStateResult madmin.BgHealState
|
var aggHealStateResult madmin.BgHealState
|
||||||
@ -2149,34 +2155,44 @@ func (z *erasureServerPools) Health(ctx context.Context, opts HealthOptions) Hea
|
|||||||
|
|
||||||
for poolIdx := range erasureSetUpCount {
|
for poolIdx := range erasureSetUpCount {
|
||||||
for setIdx := range erasureSetUpCount[poolIdx] {
|
for setIdx := range erasureSetUpCount[poolIdx] {
|
||||||
if erasureSetUpCount[poolIdx][setIdx] < writeQuorum {
|
if erasureSetUpCount[poolIdx][setIdx] < poolWriteQuorums[poolIdx] {
|
||||||
logger.LogIf(logger.SetReqInfo(ctx, reqInfo),
|
logger.LogIf(logger.SetReqInfo(ctx, reqInfo),
|
||||||
fmt.Errorf("Write quorum may be lost on pool: %d, set: %d, expected write quorum: %d",
|
fmt.Errorf("Write quorum may be lost on pool: %d, set: %d, expected write quorum: %d",
|
||||||
poolIdx, setIdx, writeQuorum))
|
poolIdx, setIdx, poolWriteQuorums[poolIdx]))
|
||||||
return HealthResult{
|
return HealthResult{
|
||||||
Healthy: false,
|
Healthy: false,
|
||||||
HealingDrives: len(aggHealStateResult.HealDisks),
|
HealingDrives: len(aggHealStateResult.HealDisks),
|
||||||
PoolID: poolIdx,
|
PoolID: poolIdx,
|
||||||
SetID: setIdx,
|
SetID: setIdx,
|
||||||
WriteQuorum: writeQuorum,
|
WriteQuorum: poolWriteQuorums[poolIdx],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var maximumWriteQuorum int
|
||||||
|
for _, writeQuorum := range poolWriteQuorums {
|
||||||
|
if maximumWriteQuorum == 0 {
|
||||||
|
maximumWriteQuorum = writeQuorum
|
||||||
|
}
|
||||||
|
if writeQuorum > maximumWriteQuorum {
|
||||||
|
maximumWriteQuorum = writeQuorum
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// when maintenance is not specified we don't have
|
// when maintenance is not specified we don't have
|
||||||
// to look at the healing side of the code.
|
// to look at the healing side of the code.
|
||||||
if !opts.Maintenance {
|
if !opts.Maintenance {
|
||||||
return HealthResult{
|
return HealthResult{
|
||||||
Healthy: true,
|
Healthy: true,
|
||||||
WriteQuorum: writeQuorum,
|
WriteQuorum: maximumWriteQuorum,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return HealthResult{
|
return HealthResult{
|
||||||
Healthy: len(aggHealStateResult.HealDisks) == 0,
|
Healthy: len(aggHealStateResult.HealDisks) == 0,
|
||||||
HealingDrives: len(aggHealStateResult.HealDisks),
|
HealingDrives: len(aggHealStateResult.HealDisks),
|
||||||
WriteQuorum: writeQuorum,
|
WriteQuorum: maximumWriteQuorum,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user