From 18e23bafd97d1ffda365b7279fc3808b64e5b702 Mon Sep 17 00:00:00 2001 From: Poorna Date: Wed, 13 Sep 2023 10:58:38 -0700 Subject: [PATCH] replication resync: report only the on-disk status (#18017) Avoid reporting in-memory status since results can vary if different nodes are queried, resync always runs at a single node. --- cmd/bucket-replication-handlers.go | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/cmd/bucket-replication-handlers.go b/cmd/bucket-replication-handlers.go index 4481dc6da..2e8b080ad 100644 --- a/cmd/bucket-replication-handlers.go +++ b/cmd/bucket-replication-handlers.go @@ -476,27 +476,17 @@ func (api objectAPIHandlers) ResetBucketReplicationStatusHandler(w http.Response writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) return } - var tgtStats map[string]TargetReplicationResyncStatus - globalReplicationPool.resyncer.RLock() - brs, ok := globalReplicationPool.resyncer.statusMap[bucket] - if ok { - tgtStats = brs.cloneTgtStats() - } - globalReplicationPool.resyncer.RUnlock() - if !ok { - brs, err = loadBucketResyncMetadata(ctx, bucket, objectAPI) - if err != nil { - writeErrorResponse(ctx, w, errorCodes.ToAPIErrWithErr(ErrBadRequest, InvalidArgument{ - Bucket: bucket, - Err: fmt.Errorf("No replication resync status available for %s", arn), - }), r.URL) - return - } - tgtStats = brs.cloneTgtStats() + brs, err := loadBucketResyncMetadata(ctx, bucket, objectAPI) + if err != nil { + writeErrorResponse(ctx, w, errorCodes.ToAPIErrWithErr(ErrBadRequest, InvalidArgument{ + Bucket: bucket, + Err: fmt.Errorf("replication resync status not available for %s (%s)", arn, err.Error()), + }), r.URL) + return } var rinfo ResyncTargetsInfo - for tarn, st := range tgtStats { + for tarn, st := range brs.TargetsMap { if arn != "" && tarn != arn { continue }