panic if replication config could not be read from disk (#15685)

If replication config could not be read from bucket metadata for some
reason, issue a panic so that unexpected replication outcomes can
be avoided for replicated buckets.

For similar reasons, adding a panic while fetching object-lock config
if it failed for reason other than non-existence of config.
This commit is contained in:
Poorna
2022-09-13 21:23:33 -07:00
committed by GitHub
parent e152b2a975
commit a0fb0c1835
2 changed files with 13 additions and 3 deletions
+7 -1
View File
@@ -81,6 +81,12 @@ func getReplicationConfig(ctx context.Context, bucketName string) (rc *replicati
}
rCfg, _, err := globalBucketMetadataSys.GetReplicationConfig(ctx, bucketName)
if err != nil {
if errors.Is(err, BucketReplicationConfigNotFound{Bucket: bucketName}) || errors.Is(err, errInvalidArgument) {
return rCfg, err
}
logger.CriticalIf(ctx, err)
}
return rCfg, err
}
@@ -2325,7 +2331,7 @@ func QueueReplicationHeal(ctx context.Context, bucket string, oi ObjectInfo) {
if oi.VersionID == "" || oi.ModTime.IsZero() {
return
}
rcfg, _, _ := globalBucketMetadataSys.GetReplicationConfig(ctx, bucket)
rcfg, _ := getReplicationConfig(ctx, bucket)
tgts, _ := globalBucketTargetSys.ListBucketTargets(ctx, bucket)
queueReplicationHeal(ctx, bucket, oi, replicationConfig{
Config: rcfg,