Properly restart fresh disk healing when failed in some places (#16413)

This commit is contained in:
Anis Elleuch
2023-01-14 00:36:46 +01:00
committed by GitHub
parent c8e1154f1e
commit beb1924437
2 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -176,11 +176,12 @@ func (ahs *allHealState) getHealLocalDiskEndpoints() Endpoints {
return endpoints return endpoints
} }
func (ahs *allHealState) markDiskForHealing(ep Endpoint) { // Set, in the memory, the state of the disk as currently healing or not
func (ahs *allHealState) setDiskHealingStatus(ep Endpoint, healing bool) {
ahs.Lock() ahs.Lock()
defer ahs.Unlock() defer ahs.Unlock()
ahs.healLocalDisks[ep] = true ahs.healLocalDisks[ep] = healing
} }
func (ahs *allHealState) pushHealLocalDisks(healLocalDisks ...Endpoint) { func (ahs *allHealState) pushHealLocalDisks(healLocalDisks ...Endpoint) {
+2 -1
View File
@@ -441,9 +441,10 @@ func monitorLocalDisksAndHeal(ctx context.Context, z *erasureServerPools) {
for _, disk := range healDisks { for _, disk := range healDisks {
go func(disk Endpoint) { go func(disk Endpoint) {
globalBackgroundHealState.markDiskForHealing(disk) globalBackgroundHealState.setDiskHealingStatus(disk, true)
err := healFreshDisk(ctx, z, disk) err := healFreshDisk(ctx, z, disk)
if err != nil { if err != nil {
globalBackgroundHealState.setDiskHealingStatus(disk, false)
printEndpointError(disk, err, false) printEndpointError(disk, err, false)
return return
} }