mirror of
https://github.com/pgsty/minio.git
synced 2026-08-10 08:13:28 +03: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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user