mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
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:
parent
e152b2a975
commit
a0fb0c1835
@ -19,6 +19,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"math"
|
||||
"net/http"
|
||||
|
||||
@ -46,11 +47,14 @@ func (sys *BucketObjectLockSys) Get(bucketName string) (r objectlock.Retention,
|
||||
|
||||
config, _, err := globalBucketMetadataSys.GetObjectLockConfig(bucketName)
|
||||
if err != nil {
|
||||
if _, ok := err.(BucketObjectLockConfigNotFound); ok {
|
||||
if errors.Is(err, BucketObjectLockConfigNotFound{Bucket: bucketName}) {
|
||||
return r, nil
|
||||
}
|
||||
if errors.Is(err, errInvalidArgument) {
|
||||
return r, err
|
||||
}
|
||||
logger.CriticalIf(context.Background(), err)
|
||||
return r, err
|
||||
|
||||
}
|
||||
return config.ToRetention(), nil
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user