HealBucket was double counting endpoints (#6707)

Endpoint comparisons blindly without looking
if its local is wrong because the actual drive
for a local disk is always going to provide just
the path without the HTTP endpoint.

Add code such that this is taken care properly in
all situations. Without this PR HealBucket() would
wrongly conclude that the healing doesn't have quorum
when there are larger number of local disks involved.

Fixes #6703
master
Harshavardhana 6 years ago committed by kannappanr
parent ea73accefd
commit 3f643acb99
  1. 20
      cmd/xl-sets.go

@ -1202,8 +1202,14 @@ func (s *xlSets) HealBucket(ctx context.Context, bucket string, dryRun bool) (re
for _, endpoint := range s.endpoints {
var foundBefore bool
for _, v := range res.Before.Drives {
if v.Endpoint == endpoint.String() {
foundBefore = true
if endpoint.IsLocal {
if v.Endpoint == endpoint.Path {
foundBefore = true
}
} else {
if v.Endpoint == endpoint.String() {
foundBefore = true
}
}
}
if !foundBefore {
@ -1215,8 +1221,14 @@ func (s *xlSets) HealBucket(ctx context.Context, bucket string, dryRun bool) (re
}
var foundAfter bool
for _, v := range res.After.Drives {
if v.Endpoint == endpoint.String() {
foundAfter = true
if endpoint.IsLocal {
if v.Endpoint == endpoint.Path {
foundAfter = true
}
} else {
if v.Endpoint == endpoint.String() {
foundAfter = true
}
}
}
if !foundAfter {

Loading…
Cancel
Save