Handle uptime for single-node instances differnt from distributed setup (#3726)

master
Krishnan Parthasarathi 8 years ago committed by Harshavardhana
parent 1b4bb94ac4
commit 1ad96ee09f
  1. 12
      cmd/admin-rpc-client.go

@ -287,6 +287,13 @@ func (ts uptimeSlice) Swap(i, j int) {
// getPeerUptimes - returns the uptime since the last time read quorum // getPeerUptimes - returns the uptime since the last time read quorum
// was established on success. Otherwise returns errXLReadQuorum. // was established on success. Otherwise returns errXLReadQuorum.
func getPeerUptimes(peers adminPeers) (time.Duration, error) { func getPeerUptimes(peers adminPeers) (time.Duration, error) {
// In a single node Erasure or FS backend setup the uptime of
// the setup is the uptime of the single minio server
// instance.
if !globalIsDistXL {
return time.Now().UTC().Sub(globalBootTime), nil
}
uptimes := make(uptimeSlice, len(peers)) uptimes := make(uptimeSlice, len(peers))
// Get up time of all servers. // Get up time of all servers.
@ -320,8 +327,9 @@ func getPeerUptimes(peers adminPeers) (time.Duration, error) {
} }
} }
// This implies there weren't read quorum number of servers up. // Less than readQuorum "Admin.Uptime" RPC call returned
if latestUptime == time.Duration(0) { // successfully, so read-quorum unavailable.
if validCount < readQuorum {
return time.Duration(0), InsufficientReadQuorum{} return time.Duration(0), InsufficientReadQuorum{}
} }

Loading…
Cancel
Save