fix: site replication bucket heal to not panic if replication config is missing (#15025)

This commit is contained in:
Poorna 2022-06-02 12:34:03 -07:00 committed by GitHub
parent 197d6fb644
commit 29edb4ccfe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 4 deletions

View File

@ -3991,14 +3991,21 @@ func (c *SiteReplicationSys) healBucketReplicationConfig(ctx context.Context, ob
} }
rcfg, _, err := globalBucketMetadataSys.GetReplicationConfig(ctx, bucket) rcfg, _, err := globalBucketMetadataSys.GetReplicationConfig(ctx, bucket)
if err != nil { if err != nil {
_, ok := err.(BucketReplicationConfigNotFound)
if !ok {
return err
}
replMismatch = true replMismatch = true
} }
if rcfg != nil {
// validate remote targets on current cluster for this bucket // validate remote targets on current cluster for this bucket
_, apiErr := validateReplicationDestination(ctx, bucket, rcfg, false) _, apiErr := validateReplicationDestination(ctx, bucket, rcfg, false)
if apiErr != noError { if apiErr != noError {
replMismatch = true replMismatch = true
} }
}
if replMismatch { if replMismatch {
err := c.PeerBucketConfigureReplHandler(ctx, bucket) err := c.PeerBucketConfigureReplHandler(ctx, bucket)
if err != nil { if err != nil {