fix: for delete marked objects choose appropriate parity (#17287)

This commit is contained in:
Harshavardhana 2023-05-26 09:57:44 -07:00 committed by GitHub
parent 65cba212e8
commit d5059840ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -448,7 +448,7 @@ func commonParity(parities []int, defaultParityCount int) int {
occMap[p]++
}
var maxOcc, commonParity int
var maxOcc, cparity int
for parity, occ := range occMap {
if parity == -1 {
// Ignore non defined parity
@ -468,7 +468,7 @@ func commonParity(parities []int, defaultParityCount int) int {
if occ > maxOcc {
maxOcc = occ
commonParity = parity
cparity = parity
}
}
@ -476,7 +476,7 @@ func commonParity(parities []int, defaultParityCount int) int {
// Did not found anything useful
return -1
}
return commonParity
return cparity
}
func listObjectParities(partsMetadata []FileInfo, errs []error) (parities []int) {
@ -490,7 +490,9 @@ func listObjectParities(partsMetadata []FileInfo, errs []error) (parities []int)
parities[index] = -1
continue
}
if !metadata.Deleted {
if metadata.Deleted {
parities[index] = len(partsMetadata) / 2
} else {
parities[index] = metadata.Erasure.ParityBlocks
}
}