with xlv2 format we never had to fill in checksumInfo() (#17963)

- this PR avoids sending a large ChecksumInfo slice
  when its not needed

- also for a file with XLV2 format there is no reason
  to allocate Checksum slice while reading
This commit is contained in:
Harshavardhana
2023-09-01 13:45:58 -07:00
committed by GitHub
parent 6a8d8f34a5
commit 18b3655c99
5 changed files with 5 additions and 39 deletions

View File

@@ -41,17 +41,6 @@ const minIOErasureUpgraded = "x-minio-internal-erasure-upgraded"
const erasureAlgorithm = "rs-vandermonde"
// AddChecksumInfo adds a checksum of a part.
func (e *ErasureInfo) AddChecksumInfo(ckSumInfo ChecksumInfo) {
for i, sum := range e.Checksums {
if sum.PartNumber == ckSumInfo.PartNumber {
e.Checksums[i] = ckSumInfo
return
}
}
e.Checksums = append(e.Checksums, ckSumInfo)
}
// GetChecksumInfo - get checksum of a part.
func (e ErasureInfo) GetChecksumInfo(partNumber int) (ckSum ChecksumInfo) {
for _, sum := range e.Checksums {
@@ -60,7 +49,7 @@ func (e ErasureInfo) GetChecksumInfo(partNumber int) (ckSum ChecksumInfo) {
return sum
}
}
return ChecksumInfo{}
return ChecksumInfo{Algorithm: DefaultBitrotAlgorithm}
}
// ShardFileSize - returns final erasure size from original size.