From 157721f694898962d83306fbd2825920142d7dd9 Mon Sep 17 00:00:00 2001 From: Praveen raj Mani Date: Thu, 2 Jan 2020 18:35:01 +0530 Subject: [PATCH] Fix readiness to return 200 for read-only mode (#8728) - We should declare a cluster ready even if read quorum is achieved (atleast n/2 disks are online). - Such that, all the zones should have enough read quorum. Thus making the cluster ready for reads. --- cmd/healthcheck-handler.go | 2 +- cmd/xl-sets.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/healthcheck-handler.go b/cmd/healthcheck-handler.go index 6bbe92505..f181a87ec 100644 --- a/cmd/healthcheck-handler.go +++ b/cmd/healthcheck-handler.go @@ -26,7 +26,7 @@ import ( // ReadinessCheckHandler -- Checks if the quorum number of disks are available. // For FS - Checks if the backend disk is available -// For Zones - Checks if all the zones have enough quorum +// For Zones - Checks if all the zones have enough read quorum func ReadinessCheckHandler(w http.ResponseWriter, r *http.Request) { ctx := newContext(r, w, "ReadinessCheckHandler") diff --git a/cmd/xl-sets.go b/cmd/xl-sets.go index 6ce6b1e3f..33858c00b 100644 --- a/cmd/xl-sets.go +++ b/cmd/xl-sets.go @@ -1657,7 +1657,7 @@ func (s *xlSets) GetMetrics(ctx context.Context) (*Metrics, error) { return &Metrics{}, NotImplemented{} } -// IsReady - Returns true if more than n/2 disks (quorum) are online +// IsReady - Returns true if atleast n/2 disks (read quorum) are online func (s *xlSets) IsReady(_ context.Context) bool { s.xlDisksMu.RLock() defer s.xlDisksMu.RUnlock() @@ -1674,8 +1674,8 @@ func (s *xlSets) IsReady(_ context.Context) bool { if s.xlDisks[i][j].IsOnline() { activeDisks++ } - // Return if more than n/2 disks are online. - if activeDisks > len(s.endpoints)/2 { + // Return true if read quorum is available. + if activeDisks >= len(s.endpoints)/2 { return true } }