site replication turn off retry login for admin API calls (#18039)

additionally also mark site offline if n/w is down
This commit is contained in:
Poorna 2023-09-15 18:01:47 -07:00 committed by GitHub
parent ce05bb69dc
commit b733e6e83c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -113,9 +113,10 @@ func init() {
shardDiskTimeDelta = 1 * time.Minute shardDiskTimeDelta = 1 * time.Minute
} }
// All minio-go API operations shall be performed only once, // All minio-go and madmin-go API operations shall be performed only once,
// another way to look at this is we are turning off retries. // another way to look at this is we are turning off retries.
minio.MaxRetry = 1 minio.MaxRetry = 1
madmin.MaxRetry = 1
} }
const consolePrefix = "CONSOLE_" const consolePrefix = "CONSOLE_"

View File

@ -35,6 +35,7 @@ import (
"time" "time"
"github.com/minio/madmin-go/v3" "github.com/minio/madmin-go/v3"
"github.com/minio/minio-go/v7"
minioClient "github.com/minio/minio-go/v7" minioClient "github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials" "github.com/minio/minio-go/v7/pkg/credentials"
"github.com/minio/minio-go/v7/pkg/replication" "github.com/minio/minio-go/v7/pkg/replication"
@ -2119,6 +2120,13 @@ func (c *SiteReplicationSys) concDo(selfActionFn func() error, peerActionFn func
errMap := make(map[string]error, len(c.state.Peers)) errMap := make(map[string]error, len(c.state.Peers))
for i, depID := range depIDs { for i, depID := range depIDs {
errMap[depID] = errs[i] errMap[depID] = errs[i]
if errs[i] != nil && minio.IsNetworkOrHostDown(errs[i], true) {
ep := c.state.Peers[depID].Endpoint
epURL, _ := url.Parse(ep)
if !globalBucketTargetSys.isOffline(epURL) {
globalBucketTargetSys.markOffline(epURL)
}
}
} }
return c.newConcErr(errMap, actionName) return c.newConcErr(errMap, actionName)
} }