mirror of
https://github.com/minio/minio.git
synced 2025-05-21 17:43:48 -04:00
isServerResolvable its sufficient to check server is reachable (#11609)
using isServerResolvable for expiration can lead to chicken and egg problems, a lock might expire knowingly when server is booting up causing perpetual locks getting expired.
This commit is contained in:
parent
6e5c61d917
commit
2a79ea0332
@ -33,7 +33,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Lock maintenance interval.
|
// Lock maintenance interval.
|
||||||
lockMaintenanceInterval = 15 * time.Second
|
lockMaintenanceInterval = 1 * time.Minute
|
||||||
|
|
||||||
// Lock validity check interval.
|
// Lock validity check interval.
|
||||||
lockValidityCheckInterval = 30 * time.Second
|
lockValidityCheckInterval = 30 * time.Second
|
||||||
@ -353,7 +353,7 @@ func startLockMaintenance(ctx context.Context) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize a new ticker with 15secs between each ticks.
|
// Initialize a new ticker with 1 minute between each ticks.
|
||||||
lkTimer := time.NewTimer(lockMaintenanceInterval)
|
lkTimer := time.NewTimer(lockMaintenanceInterval)
|
||||||
// Stop the timer upon returning.
|
// Stop the timer upon returning.
|
||||||
defer lkTimer.Stop()
|
defer lkTimer.Stop()
|
||||||
@ -362,8 +362,7 @@ func startLockMaintenance(ctx context.Context) {
|
|||||||
|
|
||||||
// Start with random sleep time, so as to avoid
|
// Start with random sleep time, so as to avoid
|
||||||
// "synchronous checks" between servers
|
// "synchronous checks" between servers
|
||||||
duration := time.Duration(r.Float64() * float64(lockMaintenanceInterval))
|
time.Sleep(time.Duration(r.Float64() * float64(lockMaintenanceInterval)))
|
||||||
time.Sleep(duration)
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
// Verifies every minute for locks held more than 2 minutes.
|
// Verifies every minute for locks held more than 2 minutes.
|
||||||
|
@ -205,14 +205,6 @@ func isServerResolvable(endpoint Endpoint, timeout time.Duration) error {
|
|||||||
}
|
}
|
||||||
xhttp.DrainBody(resp.Body)
|
xhttp.DrainBody(resp.Body)
|
||||||
|
|
||||||
if resp.StatusCode != http.StatusOK {
|
|
||||||
return StorageErr(resp.Status)
|
|
||||||
}
|
|
||||||
|
|
||||||
if resp.Header.Get(xhttp.MinIOServerStatus) == unavailable {
|
|
||||||
return StorageErr(unavailable)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user