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.
This commit is contained in:
Harshavardhana 2020-12-23 09:26:40 -08:00 committed by GitHub
parent 5982965839
commit 6a66f142d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 11 deletions

View File

@ -113,8 +113,6 @@ func (sCfg *Config) UnmarshalJSON(data []byte) error {
// acceptable quorum expected for list operations // acceptable quorum expected for list operations
func (sCfg Config) GetListQuorum() int { func (sCfg Config) GetListQuorum() int {
switch sCfg.ListQuorum { switch sCfg.ListQuorum {
case "optimal":
return 3
case "reduced": case "reduced":
return 2 return 2
case "disk": case "disk":
@ -123,7 +121,7 @@ func (sCfg Config) GetListQuorum() int {
case "strict": case "strict":
return -1 return -1
} }
// Defaults to 3 drives per set. // Defaults to 3 drives per set, defaults to "optimal" value
return 3 return 3
} }

View File

@ -595,16 +595,11 @@ func (er *erasureObjects) listPath(ctx context.Context, o listPathOptions) (entr
}() }()
askDisks := o.AskDisks askDisks := o.AskDisks
if askDisks == -1 {
askDisks = getReadQuorum(er.SetDriveCount())
}
listingQuorum := askDisks - 1 listingQuorum := askDisks - 1
// Special case: ask all disks if the drive count is 4 // Special case: ask all disks if the drive count is 4
if er.SetDriveCount() == 4 { if askDisks == -1 || er.SetDriveCount() == 4 {
askDisks = len(disks) askDisks = len(disks) // with 'strict' quorum list on all online disks.
listingQuorum = 2 listingQuorum = getReadQuorum(er.SetDriveCount())
} }
if len(disks) < askDisks { if len(disks) < askDisks {