From 6a66f142d4bf99fcc2c09965d42f832dab1a5b08 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 23 Dec 2020 09:26:40 -0800 Subject: [PATCH] fix: strict quorum in list should list on all drives (#11157) current implementation was incorrect, it in-fact assumed only read quorum number of disks. in-fact that value is only meant for read quorum good entries from all online disks. This PR fixes this behavior properly. --- cmd/config/api/api.go | 4 +--- cmd/metacache-set.go | 11 +++-------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/cmd/config/api/api.go b/cmd/config/api/api.go index 5e2db2834..dd37d2aff 100644 --- a/cmd/config/api/api.go +++ b/cmd/config/api/api.go @@ -113,8 +113,6 @@ func (sCfg *Config) UnmarshalJSON(data []byte) error { // acceptable quorum expected for list operations func (sCfg Config) GetListQuorum() int { switch sCfg.ListQuorum { - case "optimal": - return 3 case "reduced": return 2 case "disk": @@ -123,7 +121,7 @@ func (sCfg Config) GetListQuorum() int { case "strict": return -1 } - // Defaults to 3 drives per set. + // Defaults to 3 drives per set, defaults to "optimal" value return 3 } diff --git a/cmd/metacache-set.go b/cmd/metacache-set.go index 8a7ab0c85..5c7c2f1d0 100644 --- a/cmd/metacache-set.go +++ b/cmd/metacache-set.go @@ -595,16 +595,11 @@ func (er *erasureObjects) listPath(ctx context.Context, o listPathOptions) (entr }() askDisks := o.AskDisks - if askDisks == -1 { - askDisks = getReadQuorum(er.SetDriveCount()) - } - listingQuorum := askDisks - 1 - // Special case: ask all disks if the drive count is 4 - if er.SetDriveCount() == 4 { - askDisks = len(disks) - listingQuorum = 2 + if askDisks == -1 || er.SetDriveCount() == 4 { + askDisks = len(disks) // with 'strict' quorum list on all online disks. + listingQuorum = getReadQuorum(er.SetDriveCount()) } if len(disks) < askDisks {