allow quorum fileInfo to pick same parityBlocks (#17454)

Bonus: allow replication to proceed for 503 errors such as
with error code SlowDownRead
This commit is contained in:
Harshavardhana
2023-06-18 18:20:15 -07:00
committed by GitHub
parent 35ef35b5c1
commit 1443b5927a
19 changed files with 339 additions and 271 deletions

View File

@@ -106,6 +106,38 @@ type ErasureInfo struct {
Checksums []ChecksumInfo `json:"checksum,omitempty"`
}
// Equal equates current erasure info with newer erasure info.
// returns false if one of the following check fails
// - erasure algorithm is different
// - data blocks are different
// - parity blocks are different
// - block size is different
// - distribution array size is different
// - distribution indexes are different
func (ei ErasureInfo) Equal(nei ErasureInfo) bool {
if ei.Algorithm != nei.Algorithm {
return false
}
if ei.DataBlocks != nei.DataBlocks {
return false
}
if ei.ParityBlocks != nei.ParityBlocks {
return false
}
if ei.BlockSize != nei.BlockSize {
return false
}
if len(ei.Distribution) != len(nei.Distribution) {
return false
}
for i, ecindex := range ei.Distribution {
if ecindex != nei.Distribution[i] {
return false
}
}
return true
}
// BitrotAlgorithm specifies a algorithm used for bitrot protection.
type BitrotAlgorithm uint