From 3f643acb99deaf5dcfbafe9680f08cf3a14dee61 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 26 Oct 2018 10:25:52 -0700 Subject: [PATCH] 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 --- cmd/xl-sets.go | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/cmd/xl-sets.go b/cmd/xl-sets.go index 308661c12..44b0f843a 100644 --- a/cmd/xl-sets.go +++ b/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 {