mirror of
https://github.com/minio/minio.git
synced 2025-11-20 01:50:24 -05:00
Fix Readiness check (#8681)
- Remove goroutine-check in Readiness check - Bring in quorum check for readiness Fixes #8385 Co-authored-by: Harshavardhana <harsha@minio.io>
This commit is contained in:
committed by
Nitish Tiwari
parent
b2044dd22f
commit
5d09233115
@@ -1656,3 +1656,30 @@ func (s *xlSets) GetMetrics(ctx context.Context) (*Metrics, error) {
|
||||
logger.LogIf(ctx, NotImplemented{})
|
||||
return &Metrics{}, NotImplemented{}
|
||||
}
|
||||
|
||||
// IsReady - Returns true if more than n/2 disks (quorum) are online
|
||||
func (s *xlSets) IsReady(_ context.Context) bool {
|
||||
s.xlDisksMu.RLock()
|
||||
defer s.xlDisksMu.RUnlock()
|
||||
|
||||
var activeDisks int
|
||||
for i := 0; i < s.setCount; i++ {
|
||||
for j := 0; j < s.drivesPerSet; j++ {
|
||||
if s.xlDisks[i][j] == nil {
|
||||
continue
|
||||
}
|
||||
if !s.xlLockers[i][j].IsOnline() {
|
||||
continue
|
||||
}
|
||||
if s.xlDisks[i][j].IsOnline() {
|
||||
activeDisks++
|
||||
}
|
||||
// Return if more than n/2 disks are online.
|
||||
if activeDisks > len(s.endpoints)/2 {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
// Disks are not ready
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user