mirror of
https://github.com/pgsty/minio.git
synced 2026-08-09 07:43:29 +03:00
xl: add quorum support for create file
This commit is contained in:
+3
-4
@@ -82,10 +82,9 @@ type quorumDisk struct {
|
||||
index int
|
||||
}
|
||||
|
||||
// getReadFileQuorumDisks - get the current quorum disks.
|
||||
func (xl XL) getReadFileQuorumDisks(volume, path string) (quorumDisks []quorumDisk) {
|
||||
// getQuorumDisks - get the current quorum disks.
|
||||
func (xl XL) getQuorumDisks(volume, path string) (quorumDisks []quorumDisk, higherVersion int64) {
|
||||
diskVersionMap := xl.getMetaFileVersionMap(volume, path)
|
||||
higherVersion := int64(0)
|
||||
for diskIndex, formatVersion := range diskVersionMap {
|
||||
if formatVersion > higherVersion {
|
||||
higherVersion = formatVersion
|
||||
@@ -142,7 +141,7 @@ func (xl XL) ReadFile(volume, path string, offset int64) (io.ReadCloser, error)
|
||||
defer xl.unlockNS(volume, path, readLock)
|
||||
|
||||
// Check read quorum.
|
||||
quorumDisks := xl.getReadFileQuorumDisks(volume, path)
|
||||
quorumDisks, _ := xl.getQuorumDisks(volume, path)
|
||||
if len(quorumDisks) < xl.readQuorum {
|
||||
return nil, errReadQuorum
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user