mirror of
https://github.com/minio/minio.git
synced 2025-01-24 13:13:16 -05:00
Read from the disks in parallel during object read
This commit is contained in:
parent
55d22fa8d6
commit
e1280779ed
@ -543,13 +543,25 @@ func (b bucket) decodeEncodedData(totalLeft, blockSize int64, readers map[int]io
|
|||||||
return nil, iodine.New(err, nil)
|
return nil, iodine.New(err, nil)
|
||||||
}
|
}
|
||||||
encodedBytes := make([][]byte, encoder.k+encoder.m)
|
encodedBytes := make([][]byte, encoder.k+encoder.m)
|
||||||
|
|
||||||
|
errCh := make(chan error)
|
||||||
|
var errRet error
|
||||||
|
|
||||||
for i, reader := range readers {
|
for i, reader := range readers {
|
||||||
var bytesBuffer bytes.Buffer
|
go func(i int, reader io.Reader) {
|
||||||
_, err := io.CopyN(&bytesBuffer, reader, int64(curChunkSize))
|
encodedBytes[i] = make([]byte, curChunkSize)
|
||||||
|
_, err := io.ReadFull(reader, encodedBytes[i])
|
||||||
|
errCh <- err
|
||||||
|
}(i, reader)
|
||||||
|
}
|
||||||
|
for range readers {
|
||||||
|
err := <-errCh
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, iodine.New(err, nil)
|
errRet = err
|
||||||
}
|
}
|
||||||
encodedBytes[i] = bytesBuffer.Bytes()
|
}
|
||||||
|
if errRet != nil {
|
||||||
|
return nil, iodine.New(errRet, nil)
|
||||||
}
|
}
|
||||||
decodedData, err := encoder.Decode(encodedBytes, int(curBlockSize))
|
decodedData, err := encoder.Decode(encodedBytes, int(curBlockSize))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user