1
0
mirror of https://github.com/minio/minio synced 2024-07-08 19:56:05 +00:00

XL/heal: Should skip healing if CreateFile() failed on the part which needed healing. (#1693)

Fixes #1684
This commit is contained in:
Krishna Srinivas 2016-05-20 00:02:47 +05:30 committed by Harshavardhana
parent 537568f9f9
commit dc36594ef4
2 changed files with 14 additions and 17 deletions

View File

@ -89,10 +89,6 @@ func (xl XL) writeErasure(volume, path string, reader *io.PipeReader, wcloser *w
xl.cleanupCreateFileOps(volume, path, append(writers, metadataWriters...)...)
reader.CloseWithError(err)
return
} else if err == errVolumeNotFound {
xl.cleanupCreateFileOps(volume, path, append(writers, metadataWriters...)...)
reader.CloseWithError(err)
return
}
createFileError++

View File

@ -55,19 +55,6 @@ func (xl XL) healFile(volume string, path string) error {
}
}
// Check if there is atleast one part that needs to be healed.
atleastOneHeal := false
for _, healNeeded := range needsHeal {
if healNeeded {
atleastOneHeal = true
break
}
}
if !atleastOneHeal {
// Return if healing not needed anywhere.
return nil
}
// create writers for parts where healing is needed.
for index, healNeeded := range needsHeal {
if !healNeeded {
@ -81,6 +68,20 @@ func (xl XL) healFile(volume string, path string) error {
continue
}
}
// Check if there is atleast one part that needs to be healed.
atleastOneHeal := false
for _, healNeeded := range needsHeal {
if healNeeded {
atleastOneHeal = true
break
}
}
if !atleastOneHeal {
// Return if healing not needed anywhere.
return nil
}
var totalLeft = metadata.Stat.Size
for totalLeft > 0 {
// Figure out the right blockSize.