mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -05:00
heal: Fix first entry on dangling (#14495)
Instead of the first, the last entry was returned pointerizing the range value.
This commit is contained in:
parent
21d8298fe1
commit
8a274169da
@ -382,6 +382,13 @@ func TestHealingDanglingObject(t *testing.T) {
|
|||||||
copy(disks, newDisks)
|
copy(disks, newDisks)
|
||||||
objLayer.(*erasureServerPools).serverPools[0].erasureDisksMu.Unlock()
|
objLayer.(*erasureServerPools).serverPools[0].erasureDisksMu.Unlock()
|
||||||
}
|
}
|
||||||
|
getDisk := func(n int) StorageAPI {
|
||||||
|
objLayer.(*erasureServerPools).serverPools[0].erasureDisksMu.Lock()
|
||||||
|
disk := disks[n]
|
||||||
|
objLayer.(*erasureServerPools).serverPools[0].erasureDisksMu.Unlock()
|
||||||
|
return disk
|
||||||
|
}
|
||||||
|
|
||||||
// Remove 4 disks.
|
// Remove 4 disks.
|
||||||
setDisks(nil, nil, nil, nil)
|
setDisks(nil, nil, nil, nil)
|
||||||
|
|
||||||
@ -440,8 +447,8 @@ func TestHealingDanglingObject(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setDisks(orgDisks[:4]...)
|
setDisks(orgDisks[:4]...)
|
||||||
|
disk := getDisk(0)
|
||||||
fileInfoPreHeal, err = disks[0].ReadVersion(context.Background(), bucket, object, "", false)
|
fileInfoPreHeal, err = disk.ReadVersion(context.Background(), bucket, object, "", false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -458,7 +465,8 @@ func TestHealingDanglingObject(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fileInfoPostHeal, err = disks[0].ReadVersion(context.Background(), bucket, object, "", false)
|
disk = getDisk(0)
|
||||||
|
fileInfoPostHeal, err = disk.ReadVersion(context.Background(), bucket, object, "", false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -488,7 +496,8 @@ func TestHealingDanglingObject(t *testing.T) {
|
|||||||
|
|
||||||
setDisks(orgDisks[:4]...)
|
setDisks(orgDisks[:4]...)
|
||||||
|
|
||||||
fileInfoPreHeal, err = disks[0].ReadVersion(context.Background(), bucket, object, "", false)
|
disk = getDisk(0)
|
||||||
|
fileInfoPreHeal, err = disk.ReadVersion(context.Background(), bucket, object, "", false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -505,7 +514,8 @@ func TestHealingDanglingObject(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fileInfoPostHeal, err = disks[0].ReadVersion(context.Background(), bucket, object, "", false)
|
disk = getDisk(0)
|
||||||
|
fileInfoPostHeal, err = disk.ReadVersion(context.Background(), bucket, object, "", false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -389,11 +389,11 @@ func (m metaCacheEntries) resolve(r *metadataResolutionParams) (selected *metaCa
|
|||||||
|
|
||||||
// firstFound returns the first found and the number of set entries.
|
// firstFound returns the first found and the number of set entries.
|
||||||
func (m metaCacheEntries) firstFound() (first *metaCacheEntry, n int) {
|
func (m metaCacheEntries) firstFound() (first *metaCacheEntry, n int) {
|
||||||
for _, entry := range m {
|
for i, entry := range m {
|
||||||
if entry.name != "" {
|
if entry.name != "" {
|
||||||
n++
|
n++
|
||||||
if first == nil {
|
if first == nil {
|
||||||
first = &entry
|
first = &m[i]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user