From 29edb4ccfe0e893e1675ee5bc1539de4df2e0086 Mon Sep 17 00:00:00 2001 From: Poorna Date: Thu, 2 Jun 2022 12:34:03 -0700 Subject: [PATCH] fix: site replication bucket heal to not panic if replication config is missing (#15025) --- cmd/site-replication.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cmd/site-replication.go b/cmd/site-replication.go index a159733cf..370c42e8c 100644 --- a/cmd/site-replication.go +++ b/cmd/site-replication.go @@ -3991,14 +3991,21 @@ func (c *SiteReplicationSys) healBucketReplicationConfig(ctx context.Context, ob } rcfg, _, err := globalBucketMetadataSys.GetReplicationConfig(ctx, bucket) if err != nil { + _, ok := err.(BucketReplicationConfigNotFound) + if !ok { + return err + } replMismatch = true } - // validate remote targets on current cluster for this bucket - _, apiErr := validateReplicationDestination(ctx, bucket, rcfg, false) - if apiErr != noError { - replMismatch = true + if rcfg != nil { + // validate remote targets on current cluster for this bucket + _, apiErr := validateReplicationDestination(ctx, bucket, rcfg, false) + if apiErr != noError { + replMismatch = true + } } + if replMismatch { err := c.PeerBucketConfigureReplHandler(ctx, bucket) if err != nil {