@ -1750,15 +1750,15 @@ func (z *erasureZones) Walk(ctx context.Context, bucket, prefix string, results
return err
return err
}
}
if opts . WalkVersions {
var zoneDrivesPerSet [ ] int
var zonesEntryChs [ ] [ ] FileInfoVersionsCh
for _ , zone := range z . zones {
for _ , zone := range z . zones {
zonesEntryChs = append ( zonesEntryChs , zone . startMergeWalksVersions ( ctx , bucket , prefix , "" , true , ctx . Done ( ) ) )
zoneDrivesPerSet = append ( zoneDrivesPerSet , zone . listTolerancePerSet - 2 )
}
}
var zoneDrivesPerSet [ ] int
if opts . WalkVersions {
var zonesEntryChs [ ] [ ] FileInfoVersionsCh
for _ , zone := range z . zones {
for _ , zone := range z . zones {
zoneDrivesPerSet = append ( zoneDrivesPerSet , zone . setDriveCount )
zonesEntryChs = append ( zonesEntryChs , zone . startMergeWalksVersions ( ctx , bucket , prefix , "" , true , ctx . Done ( ) ) )
}
}
var zonesEntriesInfos [ ] [ ] FileInfoVersions
var zonesEntriesInfos [ ] [ ] FileInfoVersions
@ -1772,20 +1772,17 @@ func (z *erasureZones) Walk(ctx context.Context, bucket, prefix string, results
defer close ( results )
defer close ( results )
for {
for {
entry , quorumCount , zoneIndex , ok := lexicallySortedEntryZoneVersions ( zonesEntryChs , zonesEntriesInfos , zonesEntriesValid )
entry , quorumCount , _ , ok := lexicallySortedEntryZoneVersions ( zonesEntryChs , zonesEntriesInfos , zonesEntriesValid )
if ! ok {
if ! ok {
// We have reached EOF across all entryChs, break the loop.
// We have reached EOF across all entryChs, break the loop.
return
return
}
}
if quorumCount >= zoneDrivesPerSet [ zoneIndex ] / 2 {
if quorumCount > 0 {
// Read quorum exists proceed
for _ , version := range entry . Versions {
for _ , version := range entry . Versions {
results <- version . ToObjectInfo ( bucket , version . Name )
results <- version . ToObjectInfo ( bucket , version . Name )
}
}
}
}
// skip entries which do not have quorum
}
}
} ( )
} ( )
@ -1793,10 +1790,8 @@ func (z *erasureZones) Walk(ctx context.Context, bucket, prefix string, results
}
}
zonesEntryChs := make ( [ ] [ ] FileInfoCh , 0 , len ( z . zones ) )
zonesEntryChs := make ( [ ] [ ] FileInfoCh , 0 , len ( z . zones ) )
zoneDrivesPerSet := make ( [ ] int , 0 , len ( z . zones ) )
for _ , zone := range z . zones {
for _ , zone := range z . zones {
zonesEntryChs = append ( zonesEntryChs , zone . startMergeWalks ( ctx , bucket , prefix , "" , true , ctx . Done ( ) ) )
zonesEntryChs = append ( zonesEntryChs , zone . startMergeWalks ( ctx , bucket , prefix , "" , true , ctx . Done ( ) ) )
zoneDrivesPerSet = append ( zoneDrivesPerSet , zone . setDriveCount )
}
}
zonesEntriesInfos := make ( [ ] [ ] FileInfo , 0 , len ( zonesEntryChs ) )
zonesEntriesInfos := make ( [ ] [ ] FileInfo , 0 , len ( zonesEntryChs ) )
@ -1810,17 +1805,15 @@ func (z *erasureZones) Walk(ctx context.Context, bucket, prefix string, results
defer close ( results )
defer close ( results )
for {
for {
entry , quorumCount , zoneIndex , ok := lexicallySortedEntryZone ( zonesEntryChs , zonesEntriesInfos , zonesEntriesValid )
entry , quorumCount , _ , ok := lexicallySortedEntryZone ( zonesEntryChs , zonesEntriesInfos , zonesEntriesValid )
if ! ok {
if ! ok {
// We have reached EOF across all entryChs, break the loop.
// We have reached EOF across all entryChs, break the loop.
return
return
}
}
if quorumCount >= zoneDrivesPerSet [ zoneIndex ] / 2 {
if quorumCount > 0 {
// Read quorum exists proceed
results <- entry . ToObjectInfo ( bucket , entry . Name )
results <- entry . ToObjectInfo ( bucket , entry . Name )
}
}
// skip entries which do not have quorum
}
}
} ( )
} ( )
@ -1859,6 +1852,7 @@ func (z *erasureZones) HealObjects(ctx context.Context, bucket, prefix string, o
if ! ok {
if ! ok {
break
break
}
}
// Indicate that first attempt was a success and subsequent loop
// Indicate that first attempt was a success and subsequent loop
// knows that its not our first attempt at 'prefix'
// knows that its not our first attempt at 'prefix'
err = nil
err = nil
@ -1866,6 +1860,7 @@ func (z *erasureZones) HealObjects(ctx context.Context, bucket, prefix string, o
if zoneIndex >= len ( zoneDrivesPerSet ) || zoneIndex < 0 {
if zoneIndex >= len ( zoneDrivesPerSet ) || zoneIndex < 0 {
return fmt . Errorf ( "invalid zone index returned: %d" , zoneIndex )
return fmt . Errorf ( "invalid zone index returned: %d" , zoneIndex )
}
}
if quorumCount == zoneDrivesPerSet [ zoneIndex ] && opts . ScanMode == madmin . HealNormalScan {
if quorumCount == zoneDrivesPerSet [ zoneIndex ] && opts . ScanMode == madmin . HealNormalScan {
// Skip good entries.
// Skip good entries.
continue
continue