Improve reconnection logic, allow jitters. (#3502)

Attempt a reconnect also if disk not found.

This is needed since any network operation error
is converted to disk not found but we also need
to make sure if disk is really not available. 

Additionally we also need to retry more than
once because the server might be in startup
sequence which would render other servers to
wrongly think that the server is offline.
This commit is contained in:
Harshavardhana
2016-12-29 03:13:51 -08:00
committed by GitHub
parent 00baec1746
commit 41cf580bb1
7 changed files with 106 additions and 71 deletions

View File

@@ -65,6 +65,9 @@ func init() {
// Enable caching.
setMaxMemory()
// Tests don't need to retry.
globalMaxStorageRetryThreshold = 1
}
func prepareFS() (ObjectLayer, string, error) {
@@ -1945,6 +1948,12 @@ func ExecObjectLayerTest(t TestErrHandler, objTest objTestType) {
// ExecObjectLayerDiskAlteredTest - executes object layer tests while altering
// disks in between tests. Creates XL ObjectLayer instance and runs test for XL layer.
func ExecObjectLayerDiskAlteredTest(t *testing.T, objTest objTestDiskNotFoundType) {
configPath, err := newTestConfig("us-east-1")
if err != nil {
t.Fatal("Failed to create config directory", err)
}
defer removeAll(configPath)
objLayer, fsDirs, err := prepareXL()
if err != nil {
t.Fatalf("Initialization of object layer failed for XL setup: %s", err)