mirror of
https://github.com/minio/minio.git
synced 2025-11-23 11:07:50 -05:00
XL: Do not rely on getLoadBalancedQuorumDisks for NS consistency. (#2243)
The reason is any function relying on `getLoadBalancedQuorumDisks` cannot possibly have an idempotent behavior. The problem comes from given a set of N disks returning just a shuffled N/2 disks. In case of a scenario where we have N/2 number of failed disks, the returned value of `getLoadBalancedQuorumDisks` is not equal to the same failed disks so essentially calls using such disks might succeed or fail randomly at different intervals in time. This proposal change is we move to `getLoadBalancedDisks()` and use the shuffled N disks as a whole. Since most of the time we might hit a good disk since we are not reducing our solution space. This also provides consistent behavior for all the functions which rely on shuffled disks. Fixes #2242
This commit is contained in:
committed by
Anand Babu (AB) Periasamy
parent
41f4f2806d
commit
a0635dcdd9
@@ -21,15 +21,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// getLoadBalancedQuorumDisks - fetches load balanced sufficiently
|
||||
// randomized quorum disk slice.
|
||||
func (xl xlObjects) getLoadBalancedQuorumDisks() (disks []StorageAPI) {
|
||||
// It is okay to have readQuorum disks.
|
||||
return xl.getLoadBalancedDisks()[0 : xl.readQuorum-1]
|
||||
}
|
||||
|
||||
// getLoadBalancedDisks - fetches load balanced (sufficiently
|
||||
// randomized) disk slice.
|
||||
// getLoadBalancedDisks - fetches load balanced (sufficiently randomized) disk slice.
|
||||
func (xl xlObjects) getLoadBalancedDisks() (disks []StorageAPI) {
|
||||
// Based on the random shuffling return back randomized disks.
|
||||
for _, i := range hashOrder(time.Now().UTC().String(), len(xl.storageDisks)) {
|
||||
@@ -60,7 +52,7 @@ func (xl xlObjects) parentDirIsObject(bucket, parent string) bool {
|
||||
// isObject - returns `true` if the prefix is an object i.e if
|
||||
// `xl.json` exists at the leaf, false otherwise.
|
||||
func (xl xlObjects) isObject(bucket, prefix string) (ok bool) {
|
||||
for _, disk := range xl.getLoadBalancedQuorumDisks() {
|
||||
for _, disk := range xl.getLoadBalancedDisks() {
|
||||
if disk == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user