mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
fix: use NumVersions for list resolver (#12599)
also do not incorrectly double count objExists unless its selected and it matches with previous entry. Bonus: change listQuorum to match with AskDisks to ensure that we atleast by default choose all the "drives" that we asked is consistent.
This commit is contained in:
parent
3137dc2eb3
commit
a6ad965799
@ -61,7 +61,6 @@ func (er erasureObjects) getOnlineDisks() (newDisks []StorageAPI) {
|
||||
}
|
||||
di, err := disks[i-1].DiskInfo(context.Background())
|
||||
if err != nil || di.Healing {
|
||||
|
||||
// - Do not consume disks which are not reachable
|
||||
// unformatted or simply not accessible for some reason.
|
||||
//
|
||||
|
@ -80,6 +80,12 @@ func (e *metaCacheEntry) matches(other *metaCacheEntry, bucket string) bool {
|
||||
return eErr == oErr
|
||||
}
|
||||
|
||||
// check both fileInfo's have same number of versions, if not skip
|
||||
// the `other` entry.
|
||||
if eFi.NumVersions != oFi.NumVersions {
|
||||
return false
|
||||
}
|
||||
|
||||
return eFi.ModTime.Equal(oFi.ModTime) && eFi.Size == oFi.Size && eFi.VersionID == oFi.VersionID
|
||||
}
|
||||
|
||||
@ -202,12 +208,12 @@ func (m metaCacheEntries) resolve(r *metadataResolutionParams) (selected *metaCa
|
||||
|
||||
dirExists := 0
|
||||
objExists := 0
|
||||
var selFIV *FileInfo
|
||||
for i := range m {
|
||||
entry := &m[i]
|
||||
if entry.name == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
if entry.isDir() {
|
||||
dirExists++
|
||||
selected = entry
|
||||
@ -215,19 +221,18 @@ func (m metaCacheEntries) resolve(r *metadataResolutionParams) (selected *metaCa
|
||||
}
|
||||
|
||||
// Get new entry metadata
|
||||
fiv, err := entry.fileInfo(r.bucket)
|
||||
if err != nil {
|
||||
if _, err := entry.fileInfo(r.bucket); err != nil {
|
||||
continue
|
||||
}
|
||||
|
||||
objExists++
|
||||
if selFIV == nil {
|
||||
if selected == nil {
|
||||
objExists++
|
||||
selected = entry
|
||||
selFIV = fiv
|
||||
continue
|
||||
}
|
||||
|
||||
if selected.matches(entry, r.bucket) {
|
||||
objExists++
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
@ -572,8 +572,11 @@ func (er *erasureObjects) listPath(ctx context.Context, o listPathOptions) (entr
|
||||
}()
|
||||
|
||||
askDisks := o.AskDisks
|
||||
listingQuorum := askDisks - 1
|
||||
// Special case: ask all disks if the drive count is 4
|
||||
if askDisks == 0 {
|
||||
askDisks = globalAPIConfig.getListQuorum()
|
||||
}
|
||||
// make sure atleast default '3' lists object is present.
|
||||
listingQuorum := askDisks
|
||||
if askDisks == -1 || er.setDriveCount == 4 {
|
||||
askDisks = len(disks) // with 'strict' quorum list on all online disks.
|
||||
listingQuorum = getReadQuorum(er.setDriveCount)
|
||||
|
Loading…
Reference in New Issue
Block a user