mirror of
https://github.com/pgsty/minio.git
synced 2026-08-08 23:33:30 +03:00
allow forcibly creating metadata on buckets (#14820)
introduce x-minio-force-create environment variable to force create a bucket and its metadata as required, it is useful in some situations when bucket metadata needs recovery.
This commit is contained in:
@@ -55,6 +55,11 @@ func (er erasureObjects) MakeBucketWithLocation(ctx context.Context, bucket stri
|
||||
g.Go(func() error {
|
||||
if storageDisks[index] != nil {
|
||||
if err := storageDisks[index].MakeVol(ctx, bucket); err != nil {
|
||||
if opts.ForceCreate && errors.Is(err, errVolumeExists) {
|
||||
// No need to return error when force create was
|
||||
// requested.
|
||||
return nil
|
||||
}
|
||||
if !errors.Is(err, errVolumeExists) {
|
||||
logger.LogIf(ctx, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user