mirror of
https://github.com/minio/minio.git
synced 2025-11-12 14:51:36 -05:00
XL: Bring in support for object versions written during writeQuorum. (#1762)
Erasure is initialized as needed depending on the quorum and onlineDisks. This way we can manage the quorum at the object layer.
This commit is contained in:
committed by
Harshavardhana
parent
cae4782973
commit
553fdb9211
@@ -33,18 +33,21 @@ func (e erasure) ReadFile(volume, path string, startOffset int64, totalSize int6
|
||||
}
|
||||
|
||||
var rwg = &sync.WaitGroup{}
|
||||
var errs = make([]error, len(e.storageDisks))
|
||||
|
||||
readers := make([]io.ReadCloser, len(e.storageDisks))
|
||||
for index, disk := range e.storageDisks {
|
||||
if disk == nil {
|
||||
continue
|
||||
}
|
||||
rwg.Add(1)
|
||||
go func(index int, disk StorageAPI) {
|
||||
defer rwg.Done()
|
||||
// If disk.ReadFile returns error and we don't have read
|
||||
// quorum it will be taken care as ReedSolomon.Reconstruct()
|
||||
// will fail later.
|
||||
offset := int64(0)
|
||||
if reader, err := disk.ReadFile(volume, path, offset); err == nil {
|
||||
readers[index] = reader
|
||||
} else {
|
||||
errs[index] = err
|
||||
}
|
||||
}(index, disk)
|
||||
}
|
||||
@@ -52,6 +55,13 @@ func (e erasure) ReadFile(volume, path string, startOffset int64, totalSize int6
|
||||
// Wait for all readers.
|
||||
rwg.Wait()
|
||||
|
||||
// For any errors in reader, we should just error out.
|
||||
for _, err := range errs {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize pipe.
|
||||
pipeReader, pipeWriter := io.Pipe()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user