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.
master
Harshavardhana 4 years ago committed by GitHub
parent 5982965839
commit 6a66f142d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      cmd/config/api/api.go
  2. 11
      cmd/metacache-set.go

@ -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
} }

@ -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 {

Loading…
Cancel
Save