mirror of https://github.com/minio/minio.git
avoid locks for internal and invalid buckets in MakeBucket() (#16302)
This commit is contained in:
parent
de0b43de32
commit
b882310e2b
|
@ -707,7 +707,7 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
||||||
opts := MakeBucketOptions{
|
opts := MakeBucketOptions{
|
||||||
LockEnabled: config.ObjectLockEnabled == "Enabled",
|
LockEnabled: config.ObjectLockEnabled == "Enabled",
|
||||||
}
|
}
|
||||||
err = objectAPI.MakeBucketWithLocation(ctx, bucket, opts)
|
err = objectAPI.MakeBucket(ctx, bucket, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if _, ok := err.(BucketExists); !ok {
|
if _, ok := err.(BucketExists); !ok {
|
||||||
rpt.SetStatus(bucket, fileName, err)
|
rpt.SetStatus(bucket, fileName, err)
|
||||||
|
@ -768,7 +768,7 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if _, ok := bucketMap[bucket]; !ok {
|
if _, ok := bucketMap[bucket]; !ok {
|
||||||
if err = objectAPI.MakeBucketWithLocation(ctx, bucket, MakeBucketOptions{}); err != nil {
|
if err = objectAPI.MakeBucket(ctx, bucket, MakeBucketOptions{}); err != nil {
|
||||||
if _, ok := err.(BucketExists); !ok {
|
if _, ok := err.(BucketExists); !ok {
|
||||||
rpt.SetStatus(bucket, fileName, err)
|
rpt.SetStatus(bucket, fileName, err)
|
||||||
continue
|
continue
|
||||||
|
@ -820,7 +820,7 @@ func (a adminAPIHandlers) ImportBucketMetadataHandler(w http.ResponseWriter, r *
|
||||||
bucket, fileName := slc[0], slc[1]
|
bucket, fileName := slc[0], slc[1]
|
||||||
// create bucket if it does not exist yet.
|
// create bucket if it does not exist yet.
|
||||||
if _, ok := bucketMap[bucket]; !ok {
|
if _, ok := bucketMap[bucket]; !ok {
|
||||||
err = objectAPI.MakeBucketWithLocation(ctx, bucket, MakeBucketOptions{})
|
err = objectAPI.MakeBucket(ctx, bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if _, ok := err.(BucketExists); !ok {
|
if _, ok := err.(BucketExists); !ok {
|
||||||
rpt.SetStatus(bucket, "", err)
|
rpt.SetStatus(bucket, "", err)
|
||||||
|
|
|
@ -114,9 +114,6 @@ func (a adminAPIHandlers) SRPeerBucketOps(w http.ResponseWriter, r *http.Request
|
||||||
default:
|
default:
|
||||||
err = errSRInvalidRequest(errInvalidArgument)
|
err = errSRInvalidRequest(errInvalidArgument)
|
||||||
case madmin.MakeWithVersioningBktOp:
|
case madmin.MakeWithVersioningBktOp:
|
||||||
_, isLockEnabled := r.Form["lockEnabled"]
|
|
||||||
_, isVersioningEnabled := r.Form["versioningEnabled"]
|
|
||||||
_, isForceCreate := r.Form["forceCreate"]
|
|
||||||
createdAtStr := strings.TrimSpace(r.Form.Get("createdAt"))
|
createdAtStr := strings.TrimSpace(r.Form.Get("createdAt"))
|
||||||
createdAt, cerr := time.Parse(time.RFC3339Nano, createdAtStr)
|
createdAt, cerr := time.Parse(time.RFC3339Nano, createdAtStr)
|
||||||
if cerr != nil {
|
if cerr != nil {
|
||||||
|
@ -124,27 +121,18 @@ func (a adminAPIHandlers) SRPeerBucketOps(w http.ResponseWriter, r *http.Request
|
||||||
}
|
}
|
||||||
|
|
||||||
opts := MakeBucketOptions{
|
opts := MakeBucketOptions{
|
||||||
Location: r.Form.Get("location"),
|
LockEnabled: r.Form.Get("lockEnabled") == "true",
|
||||||
LockEnabled: isLockEnabled,
|
VersioningEnabled: r.Form.Get("versioningEnabled") == "true",
|
||||||
VersioningEnabled: isVersioningEnabled,
|
ForceCreate: r.Form.Get("forceCreate") == "true",
|
||||||
ForceCreate: isForceCreate,
|
|
||||||
CreatedAt: createdAt,
|
CreatedAt: createdAt,
|
||||||
}
|
}
|
||||||
err = globalSiteReplicationSys.PeerBucketMakeWithVersioningHandler(ctx, bucket, opts)
|
err = globalSiteReplicationSys.PeerBucketMakeWithVersioningHandler(ctx, bucket, opts)
|
||||||
case madmin.ConfigureReplBktOp:
|
case madmin.ConfigureReplBktOp:
|
||||||
err = globalSiteReplicationSys.PeerBucketConfigureReplHandler(ctx, bucket)
|
err = globalSiteReplicationSys.PeerBucketConfigureReplHandler(ctx, bucket)
|
||||||
case madmin.DeleteBucketBktOp:
|
case madmin.DeleteBucketBktOp, madmin.ForceDeleteBucketBktOp:
|
||||||
_, noRecreate := r.Form["noRecreate"]
|
|
||||||
err = globalSiteReplicationSys.PeerBucketDeleteHandler(ctx, bucket, DeleteBucketOptions{
|
err = globalSiteReplicationSys.PeerBucketDeleteHandler(ctx, bucket, DeleteBucketOptions{
|
||||||
Force: false,
|
Force: operation == madmin.ForceDeleteBucketBktOp,
|
||||||
NoRecreate: noRecreate,
|
NoRecreate: r.Form.Get("noRecreate") == "true",
|
||||||
SRDeleteOp: getSRBucketDeleteOp(true),
|
|
||||||
})
|
|
||||||
case madmin.ForceDeleteBucketBktOp:
|
|
||||||
_, noRecreate := r.Form["noRecreate"]
|
|
||||||
err = globalSiteReplicationSys.PeerBucketDeleteHandler(ctx, bucket, DeleteBucketOptions{
|
|
||||||
Force: true,
|
|
||||||
NoRecreate: noRecreate,
|
|
||||||
SRDeleteOp: getSRBucketDeleteOp(true),
|
SRDeleteOp: getSRBucketDeleteOp(true),
|
||||||
})
|
})
|
||||||
case madmin.PurgeDeletedBucketOp:
|
case madmin.PurgeDeletedBucketOp:
|
||||||
|
|
|
@ -1319,7 +1319,7 @@ func (a adminAPIHandlers) ObjectSpeedTestHandler(w http.ResponseWriter, r *http.
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeObjectPerfBucket(ctx context.Context, objectAPI ObjectLayer, bucketName string) (bucketExists bool, err error) {
|
func makeObjectPerfBucket(ctx context.Context, objectAPI ObjectLayer, bucketName string) (bucketExists bool, err error) {
|
||||||
if err = objectAPI.MakeBucketWithLocation(ctx, bucketName, MakeBucketOptions{}); err != nil {
|
if err = objectAPI.MakeBucket(ctx, bucketName, MakeBucketOptions{}); err != nil {
|
||||||
if _, ok := err.(BucketExists); !ok {
|
if _, ok := err.(BucketExists); !ok {
|
||||||
// Only BucketExists error can be ignored.
|
// Only BucketExists error can be ignored.
|
||||||
return false, err
|
return false, err
|
||||||
|
|
|
@ -35,7 +35,7 @@ func runPutObjectBenchmark(b *testing.B, obj ObjectLayer, objSize int) {
|
||||||
// obtains random bucket name.
|
// obtains random bucket name.
|
||||||
bucket := getRandomBucketName()
|
bucket := getRandomBucketName()
|
||||||
// create bucket.
|
// create bucket.
|
||||||
err = obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{})
|
err = obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ func runPutObjectPartBenchmark(b *testing.B, obj ObjectLayer, partSize int) {
|
||||||
object := getRandomObjectName()
|
object := getRandomObjectName()
|
||||||
|
|
||||||
// create bucket.
|
// create bucket.
|
||||||
err = obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{})
|
err = obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,7 @@ func runPutObjectBenchmarkParallel(b *testing.B, obj ObjectLayer, objSize int) {
|
||||||
// obtains random bucket name.
|
// obtains random bucket name.
|
||||||
bucket := getRandomBucketName()
|
bucket := getRandomBucketName()
|
||||||
// create bucket.
|
// create bucket.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -773,7 +773,6 @@ func (api objectAPIHandlers) PutBucketHandler(w http.ResponseWriter, r *http.Req
|
||||||
}
|
}
|
||||||
|
|
||||||
opts := MakeBucketOptions{
|
opts := MakeBucketOptions{
|
||||||
Location: location,
|
|
||||||
LockEnabled: objectLockEnabled,
|
LockEnabled: objectLockEnabled,
|
||||||
ForceCreate: forceCreate,
|
ForceCreate: forceCreate,
|
||||||
}
|
}
|
||||||
|
@ -785,7 +784,7 @@ func (api objectAPIHandlers) PutBucketHandler(w http.ResponseWriter, r *http.Req
|
||||||
// exists elsewhere
|
// exists elsewhere
|
||||||
if err == dns.ErrNoEntriesFound || err == dns.ErrNotImplemented {
|
if err == dns.ErrNoEntriesFound || err == dns.ErrNotImplemented {
|
||||||
// Proceed to creating a bucket.
|
// Proceed to creating a bucket.
|
||||||
if err = objectAPI.MakeBucketWithLocation(ctx, bucket, opts); err != nil {
|
if err = objectAPI.MakeBucket(ctx, bucket, opts); err != nil {
|
||||||
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -837,7 +836,7 @@ func (api objectAPIHandlers) PutBucketHandler(w http.ResponseWriter, r *http.Req
|
||||||
}
|
}
|
||||||
|
|
||||||
// Proceed to creating a bucket.
|
// Proceed to creating a bucket.
|
||||||
if err := objectAPI.MakeBucketWithLocation(ctx, bucket, opts); err != nil {
|
if err := objectAPI.MakeBucket(ctx, bucket, opts); err != nil {
|
||||||
if _, ok := err.(BucketExists); ok {
|
if _, ok := err.(BucketExists); ok {
|
||||||
// Though bucket exists locally, we send the site-replication
|
// Though bucket exists locally, we send the site-replication
|
||||||
// hook to ensure all sites have this bucket. If the hook
|
// hook to ensure all sites have this bucket. If the hook
|
||||||
|
|
|
@ -107,7 +107,7 @@ func getAnonWriteOnlyObjectPolicy(bucketName, prefix string) *policy.Policy {
|
||||||
|
|
||||||
// Wrapper for calling Create Bucket and ensure we get one and only one success.
|
// Wrapper for calling Create Bucket and ensure we get one and only one success.
|
||||||
func TestCreateBucket(t *testing.T) {
|
func TestCreateBucket(t *testing.T) {
|
||||||
ExecObjectLayerAPITest(t, testCreateBucket, []string{"MakeBucketWithLocation"})
|
ExecObjectLayerAPITest(t, testCreateBucket, []string{"MakeBucket"})
|
||||||
}
|
}
|
||||||
|
|
||||||
// testCreateBucket - Test for calling Create Bucket and ensure we get one and only one success.
|
// testCreateBucket - Test for calling Create Bucket and ensure we get one and only one success.
|
||||||
|
@ -127,7 +127,7 @@ func testCreateBucket(obj ObjectLayer, instanceType, bucketName string, apiRoute
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
// Sync start.
|
// Sync start.
|
||||||
<-start
|
<-start
|
||||||
if err := obj.MakeBucketWithLocation(GlobalContext, bucketName1, MakeBucketOptions{}); err != nil {
|
if err := obj.MakeBucket(GlobalContext, bucketName1, MakeBucketOptions{}); err != nil {
|
||||||
if _, ok := err.(BucketExists); !ok {
|
if _, ok := err.(BucketExists); !ok {
|
||||||
t.Logf("unexpected error: %T: %v", err, err)
|
t.Logf("unexpected error: %T: %v", err, err)
|
||||||
return
|
return
|
||||||
|
@ -162,7 +162,7 @@ func testPutBucketPolicyHandler(obj ObjectLayer, instanceType, bucketName string
|
||||||
credentials auth.Credentials, t *testing.T,
|
credentials auth.Credentials, t *testing.T,
|
||||||
) {
|
) {
|
||||||
bucketName1 := fmt.Sprintf("%s-1", bucketName)
|
bucketName1 := fmt.Sprintf("%s-1", bucketName)
|
||||||
if err := obj.MakeBucketWithLocation(GlobalContext, bucketName1, MakeBucketOptions{}); err != nil {
|
if err := obj.MakeBucket(GlobalContext, bucketName1, MakeBucketOptions{}); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/minio/minio-go/v7/pkg/s3utils"
|
|
||||||
"github.com/minio/minio/internal/logger"
|
"github.com/minio/minio/internal/logger"
|
||||||
"github.com/minio/minio/internal/sync/errgroup"
|
"github.com/minio/minio/internal/sync/errgroup"
|
||||||
)
|
)
|
||||||
|
@ -35,16 +34,7 @@ var bucketMetadataOpIgnoredErrs = append(bucketOpIgnoredErrs, errVolumeNotFound)
|
||||||
// Bucket operations
|
// Bucket operations
|
||||||
|
|
||||||
// MakeBucket - make a bucket.
|
// MakeBucket - make a bucket.
|
||||||
func (er erasureObjects) MakeBucketWithLocation(ctx context.Context, bucket string, opts MakeBucketOptions) error {
|
func (er erasureObjects) MakeBucket(ctx context.Context, bucket string, opts MakeBucketOptions) error {
|
||||||
defer NSUpdated(bucket, slashSeparator)
|
|
||||||
|
|
||||||
// Verify if bucket is valid.
|
|
||||||
if !isMinioMetaBucketName(bucket) {
|
|
||||||
if err := s3utils.CheckValidBucketNameStrict(bucket); err != nil {
|
|
||||||
return BucketNameInvalid{Bucket: bucket}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
storageDisks := er.getDisks()
|
storageDisks := er.getDisks()
|
||||||
|
|
||||||
g := errgroup.WithNErrs(len(storageDisks))
|
g := errgroup.WithNErrs(len(storageDisks))
|
||||||
|
@ -149,9 +139,6 @@ func (er erasureObjects) GetBucketInfo(ctx context.Context, bucket string, opts
|
||||||
|
|
||||||
// DeleteBucket - deletes a bucket.
|
// DeleteBucket - deletes a bucket.
|
||||||
func (er erasureObjects) DeleteBucket(ctx context.Context, bucket string, opts DeleteBucketOptions) error {
|
func (er erasureObjects) DeleteBucket(ctx context.Context, bucket string, opts DeleteBucketOptions) error {
|
||||||
// Collect if all disks report volume not found.
|
|
||||||
defer NSUpdated(bucket, slashSeparator)
|
|
||||||
|
|
||||||
storageDisks := er.getDisks()
|
storageDisks := er.getDisks()
|
||||||
|
|
||||||
g := errgroup.WithNErrs(len(storageDisks))
|
g := errgroup.WithNErrs(len(storageDisks))
|
||||||
|
|
|
@ -223,7 +223,7 @@ func TestListOnlineDisks(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bucket := "bucket"
|
bucket := "bucket"
|
||||||
err = obj.MakeBucketWithLocation(ctx, "bucket", MakeBucketOptions{})
|
err = obj.MakeBucket(ctx, "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to make a bucket %v", err)
|
t.Fatalf("Failed to make a bucket %v", err)
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ func TestListOnlineDisksSmallObjects(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bucket := "bucket"
|
bucket := "bucket"
|
||||||
err = obj.MakeBucketWithLocation(ctx, "bucket", MakeBucketOptions{})
|
err = obj.MakeBucket(ctx, "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to make a bucket %v", err)
|
t.Fatalf("Failed to make a bucket %v", err)
|
||||||
}
|
}
|
||||||
|
@ -519,7 +519,7 @@ func TestDisksWithAllParts(t *testing.T) {
|
||||||
z := obj.(*erasureServerPools)
|
z := obj.(*erasureServerPools)
|
||||||
s := z.serverPools[0].sets[0]
|
s := z.serverPools[0].sets[0]
|
||||||
erasureDisks := s.getDisks()
|
erasureDisks := s.getDisks()
|
||||||
err = obj.MakeBucketWithLocation(ctx, "bucket", MakeBucketOptions{})
|
err = obj.MakeBucket(ctx, "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to make a bucket %v", err)
|
t.Fatalf("Failed to make a bucket %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,7 +244,7 @@ func TestHealing(t *testing.T) {
|
||||||
er := z.serverPools[0].sets[0]
|
er := z.serverPools[0].sets[0]
|
||||||
|
|
||||||
// Create "bucket"
|
// Create "bucket"
|
||||||
err = obj.MakeBucketWithLocation(ctx, "bucket", MakeBucketOptions{})
|
err = obj.MakeBucket(ctx, "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -398,7 +398,7 @@ func TestHealingVersioned(t *testing.T) {
|
||||||
er := z.serverPools[0].sets[0]
|
er := z.serverPools[0].sets[0]
|
||||||
|
|
||||||
// Create "bucket"
|
// Create "bucket"
|
||||||
err = obj.MakeBucketWithLocation(ctx, "bucket", MakeBucketOptions{VersioningEnabled: true})
|
err = obj.MakeBucket(ctx, "bucket", MakeBucketOptions{VersioningEnabled: true})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -581,7 +581,7 @@ func TestHealingDanglingObject(t *testing.T) {
|
||||||
object := getRandomObjectName()
|
object := getRandomObjectName()
|
||||||
data := bytes.Repeat([]byte("a"), 128*1024)
|
data := bytes.Repeat([]byte("a"), 128*1024)
|
||||||
|
|
||||||
err = objLayer.MakeBucketWithLocation(ctx, bucket, MakeBucketOptions{})
|
err = objLayer.MakeBucket(ctx, bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to make a bucket - %v", err)
|
t.Fatalf("Failed to make a bucket - %v", err)
|
||||||
}
|
}
|
||||||
|
@ -776,7 +776,7 @@ func TestHealCorrectQuorum(t *testing.T) {
|
||||||
data := bytes.Repeat([]byte("a"), 5*1024*1024)
|
data := bytes.Repeat([]byte("a"), 5*1024*1024)
|
||||||
var opts ObjectOptions
|
var opts ObjectOptions
|
||||||
|
|
||||||
err = objLayer.MakeBucketWithLocation(ctx, bucket, MakeBucketOptions{})
|
err = objLayer.MakeBucket(ctx, bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to make a bucket - %v", err)
|
t.Fatalf("Failed to make a bucket - %v", err)
|
||||||
}
|
}
|
||||||
|
@ -907,7 +907,7 @@ func TestHealObjectCorruptedPools(t *testing.T) {
|
||||||
data := bytes.Repeat([]byte("a"), 5*1024*1024)
|
data := bytes.Repeat([]byte("a"), 5*1024*1024)
|
||||||
var opts ObjectOptions
|
var opts ObjectOptions
|
||||||
|
|
||||||
err = objLayer.MakeBucketWithLocation(ctx, bucket, MakeBucketOptions{})
|
err = objLayer.MakeBucket(ctx, bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to make a bucket - %v", err)
|
t.Fatalf("Failed to make a bucket - %v", err)
|
||||||
}
|
}
|
||||||
|
@ -1084,7 +1084,7 @@ func TestHealObjectCorruptedXLMeta(t *testing.T) {
|
||||||
data := bytes.Repeat([]byte("a"), 5*1024*1024)
|
data := bytes.Repeat([]byte("a"), 5*1024*1024)
|
||||||
var opts ObjectOptions
|
var opts ObjectOptions
|
||||||
|
|
||||||
err = objLayer.MakeBucketWithLocation(ctx, bucket, MakeBucketOptions{})
|
err = objLayer.MakeBucket(ctx, bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to make a bucket - %v", err)
|
t.Fatalf("Failed to make a bucket - %v", err)
|
||||||
}
|
}
|
||||||
|
@ -1227,7 +1227,7 @@ func TestHealObjectCorruptedParts(t *testing.T) {
|
||||||
data := bytes.Repeat([]byte("a"), 5*1024*1024)
|
data := bytes.Repeat([]byte("a"), 5*1024*1024)
|
||||||
var opts ObjectOptions
|
var opts ObjectOptions
|
||||||
|
|
||||||
err = objLayer.MakeBucketWithLocation(ctx, bucket, MakeBucketOptions{})
|
err = objLayer.MakeBucket(ctx, bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to make a bucket - %v", err)
|
t.Fatalf("Failed to make a bucket - %v", err)
|
||||||
}
|
}
|
||||||
|
@ -1384,7 +1384,7 @@ func TestHealObjectErasure(t *testing.T) {
|
||||||
data := bytes.Repeat([]byte("a"), 5*1024*1024)
|
data := bytes.Repeat([]byte("a"), 5*1024*1024)
|
||||||
var opts ObjectOptions
|
var opts ObjectOptions
|
||||||
|
|
||||||
err = obj.MakeBucketWithLocation(ctx, bucket, MakeBucketOptions{})
|
err = obj.MakeBucket(ctx, bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to make a bucket - %v", err)
|
t.Fatalf("Failed to make a bucket - %v", err)
|
||||||
}
|
}
|
||||||
|
@ -1481,7 +1481,7 @@ func TestHealEmptyDirectoryErasure(t *testing.T) {
|
||||||
object := "empty-dir/"
|
object := "empty-dir/"
|
||||||
var opts ObjectOptions
|
var opts ObjectOptions
|
||||||
|
|
||||||
err = obj.MakeBucketWithLocation(ctx, bucket, MakeBucketOptions{})
|
err = obj.MakeBucket(ctx, bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to make a bucket - %v", err)
|
t.Fatalf("Failed to make a bucket - %v", err)
|
||||||
}
|
}
|
||||||
|
@ -1582,7 +1582,7 @@ func TestHealLastDataShard(t *testing.T) {
|
||||||
}
|
}
|
||||||
var opts ObjectOptions
|
var opts ObjectOptions
|
||||||
|
|
||||||
err = obj.MakeBucketWithLocation(ctx, bucket, MakeBucketOptions{})
|
err = obj.MakeBucket(ctx, bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to make a bucket - %v", err)
|
t.Fatalf("Failed to make a bucket - %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ func TestRepeatPutObjectPart(t *testing.T) {
|
||||||
defer objLayer.Shutdown(context.Background())
|
defer objLayer.Shutdown(context.Background())
|
||||||
defer removeRoots(disks)
|
defer removeRoots(disks)
|
||||||
|
|
||||||
err = objLayer.MakeBucketWithLocation(ctx, "bucket1", MakeBucketOptions{})
|
err = objLayer.MakeBucket(ctx, "bucket1", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ func TestErasureDeleteObjectBasic(t *testing.T) {
|
||||||
}
|
}
|
||||||
defer xl.Shutdown(context.Background())
|
defer xl.Shutdown(context.Background())
|
||||||
|
|
||||||
err = xl.MakeBucketWithLocation(ctx, "bucket", MakeBucketOptions{})
|
err = xl.MakeBucket(ctx, "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ func TestDeleteObjectsVersioned(t *testing.T) {
|
||||||
{bucketName, "dir/obj1"},
|
{bucketName, "dir/obj1"},
|
||||||
}
|
}
|
||||||
|
|
||||||
err = obj.MakeBucketWithLocation(ctx, bucketName, MakeBucketOptions{
|
err = obj.MakeBucket(ctx, bucketName, MakeBucketOptions{
|
||||||
VersioningEnabled: true,
|
VersioningEnabled: true,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -244,7 +244,7 @@ func TestErasureDeleteObjectsErasureSet(t *testing.T) {
|
||||||
{bucketName, "obj_4"},
|
{bucketName, "obj_4"},
|
||||||
}
|
}
|
||||||
|
|
||||||
err := erasureSets.MakeBucketWithLocation(ctx, bucketName, MakeBucketOptions{})
|
err := erasureSets.MakeBucket(ctx, bucketName, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -305,7 +305,7 @@ func TestErasureDeleteObjectDiskNotFound(t *testing.T) {
|
||||||
xl := z.serverPools[0].sets[0]
|
xl := z.serverPools[0].sets[0]
|
||||||
|
|
||||||
// Create "bucket"
|
// Create "bucket"
|
||||||
err = obj.MakeBucketWithLocation(ctx, "bucket", MakeBucketOptions{})
|
err = obj.MakeBucket(ctx, "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ func TestErasureDeleteObjectDiskNotFoundErasure4(t *testing.T) {
|
||||||
xl := z.serverPools[0].sets[0]
|
xl := z.serverPools[0].sets[0]
|
||||||
|
|
||||||
// Create "bucket"
|
// Create "bucket"
|
||||||
err = obj.MakeBucketWithLocation(ctx, "bucket", MakeBucketOptions{})
|
err = obj.MakeBucket(ctx, "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -434,7 +434,7 @@ func TestErasureDeleteObjectDiskNotFoundErr(t *testing.T) {
|
||||||
xl := z.serverPools[0].sets[0]
|
xl := z.serverPools[0].sets[0]
|
||||||
|
|
||||||
// Create "bucket"
|
// Create "bucket"
|
||||||
err = obj.MakeBucketWithLocation(ctx, "bucket", MakeBucketOptions{})
|
err = obj.MakeBucket(ctx, "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -505,7 +505,7 @@ func TestGetObjectNoQuorum(t *testing.T) {
|
||||||
xl := z.serverPools[0].sets[0]
|
xl := z.serverPools[0].sets[0]
|
||||||
|
|
||||||
// Create "bucket"
|
// Create "bucket"
|
||||||
err = obj.MakeBucketWithLocation(ctx, "bucket", MakeBucketOptions{})
|
err = obj.MakeBucket(ctx, "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -614,7 +614,7 @@ func TestHeadObjectNoQuorum(t *testing.T) {
|
||||||
xl := z.serverPools[0].sets[0]
|
xl := z.serverPools[0].sets[0]
|
||||||
|
|
||||||
// Create "bucket"
|
// Create "bucket"
|
||||||
err = obj.MakeBucketWithLocation(ctx, "bucket", MakeBucketOptions{})
|
err = obj.MakeBucket(ctx, "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -692,7 +692,7 @@ func TestPutObjectNoQuorum(t *testing.T) {
|
||||||
xl := z.serverPools[0].sets[0]
|
xl := z.serverPools[0].sets[0]
|
||||||
|
|
||||||
// Create "bucket"
|
// Create "bucket"
|
||||||
err = obj.MakeBucketWithLocation(ctx, "bucket", MakeBucketOptions{})
|
err = obj.MakeBucket(ctx, "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -755,7 +755,7 @@ func TestPutObjectNoQuorumSmall(t *testing.T) {
|
||||||
xl := z.serverPools[0].sets[0]
|
xl := z.serverPools[0].sets[0]
|
||||||
|
|
||||||
// Create "bucket"
|
// Create "bucket"
|
||||||
err = obj.MakeBucketWithLocation(ctx, "bucket", MakeBucketOptions{})
|
err = obj.MakeBucket(ctx, "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -824,7 +824,7 @@ func TestPutObjectSmallInlineData(t *testing.T) {
|
||||||
object := "object"
|
object := "object"
|
||||||
|
|
||||||
// Create "bucket"
|
// Create "bucket"
|
||||||
err = obj.MakeBucketWithLocation(ctx, bucket, MakeBucketOptions{})
|
err = obj.MakeBucket(ctx, bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -892,7 +892,7 @@ func testObjectQuorumFromMeta(obj ObjectLayer, instanceType string, dirs []strin
|
||||||
ctx, cancel := context.WithCancel(GlobalContext)
|
ctx, cancel := context.WithCancel(GlobalContext)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
err := obj.MakeBucketWithLocation(ctx, bucket, MakeBucketOptions{})
|
err := obj.MakeBucket(ctx, bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to make a bucket %v", err)
|
t.Fatalf("Failed to make a bucket %v", err)
|
||||||
}
|
}
|
||||||
|
@ -1091,7 +1091,7 @@ func TestGetObjectInlineNotInline(t *testing.T) {
|
||||||
defer removeRoots(fsDirs)
|
defer removeRoots(fsDirs)
|
||||||
|
|
||||||
// Create a testbucket
|
// Create a testbucket
|
||||||
err = objLayer.MakeBucketWithLocation(ctx, "testbucket", MakeBucketOptions{})
|
err = objLayer.MakeBucket(ctx, "testbucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -1161,7 +1161,7 @@ func TestGetObjectWithOutdatedDisks(t *testing.T) {
|
||||||
|
|
||||||
for i, testCase := range testCases {
|
for i, testCase := range testCases {
|
||||||
// Step 1: create a bucket
|
// Step 1: create a bucket
|
||||||
err = z.MakeBucketWithLocation(ctx, testCase.bucket, MakeBucketOptions{VersioningEnabled: testCase.versioned})
|
err = z.MakeBucket(ctx, testCase.bucket, MakeBucketOptions{VersioningEnabled: testCase.versioned})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Test %d: Failed to create a bucket: %v", i+1, err)
|
t.Fatalf("Test %d: Failed to create a bucket: %v", i+1, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1240,7 +1240,7 @@ func (z *erasureServerPools) StartDecommission(ctx context.Context, idx int) (er
|
||||||
pathJoin(minioMetaBucket, bucketMetaPrefix),
|
pathJoin(minioMetaBucket, bucketMetaPrefix),
|
||||||
} {
|
} {
|
||||||
var bucketExists BucketExists
|
var bucketExists BucketExists
|
||||||
if err = z.MakeBucketWithLocation(ctx, metaBucket, MakeBucketOptions{}); err != nil {
|
if err = z.MakeBucket(ctx, metaBucket, MakeBucketOptions{}); err != nil {
|
||||||
if !errors.As(err, &bucketExists) {
|
if !errors.As(err, &bucketExists) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ import (
|
||||||
|
|
||||||
"github.com/dustin/go-humanize"
|
"github.com/dustin/go-humanize"
|
||||||
"github.com/minio/madmin-go/v2"
|
"github.com/minio/madmin-go/v2"
|
||||||
|
"github.com/minio/minio-go/v7/pkg/s3utils"
|
||||||
"github.com/minio/minio-go/v7/pkg/set"
|
"github.com/minio/minio-go/v7/pkg/set"
|
||||||
"github.com/minio/minio-go/v7/pkg/tags"
|
"github.com/minio/minio-go/v7/pkg/tags"
|
||||||
"github.com/minio/minio/internal/bucket/lifecycle"
|
"github.com/minio/minio/internal/bucket/lifecycle"
|
||||||
|
@ -687,20 +688,29 @@ func (z *erasureServerPools) NSScanner(ctx context.Context, bf *bloomFilter, upd
|
||||||
return firstErr
|
return firstErr
|
||||||
}
|
}
|
||||||
|
|
||||||
// MakeBucketWithLocation - creates a new bucket across all serverPools simultaneously
|
// MakeBucket - creates a new bucket across all serverPools simultaneously
|
||||||
// even if one of the sets fail to create buckets, we proceed all the successful
|
// even if one of the sets fail to create buckets, we proceed all the successful
|
||||||
// operations.
|
// operations.
|
||||||
func (z *erasureServerPools) MakeBucketWithLocation(ctx context.Context, bucket string, opts MakeBucketOptions) error {
|
func (z *erasureServerPools) MakeBucket(ctx context.Context, bucket string, opts MakeBucketOptions) error {
|
||||||
|
defer NSUpdated(bucket, slashSeparator)
|
||||||
|
|
||||||
g := errgroup.WithNErrs(len(z.serverPools))
|
g := errgroup.WithNErrs(len(z.serverPools))
|
||||||
|
|
||||||
// Lock the bucket name before creating.
|
if !isMinioMetaBucketName(bucket) {
|
||||||
lk := z.NewNSLock(minioMetaTmpBucket, bucket+".lck")
|
// Verify if bucket is valid.
|
||||||
lkctx, err := lk.GetLock(ctx, globalOperationTimeout)
|
if err := s3utils.CheckValidBucketNameStrict(bucket); err != nil {
|
||||||
if err != nil {
|
return BucketNameInvalid{Bucket: bucket}
|
||||||
return err
|
}
|
||||||
|
|
||||||
|
// Lock the bucket name before creating.
|
||||||
|
lk := z.NewNSLock(minioMetaTmpBucket, bucket+".lck")
|
||||||
|
lkctx, err := lk.GetLock(ctx, globalOperationTimeout)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
ctx = lkctx.Context()
|
||||||
|
defer lk.Unlock(lkctx.Cancel)
|
||||||
}
|
}
|
||||||
ctx = lkctx.Context()
|
|
||||||
defer lk.Unlock(lkctx.Cancel)
|
|
||||||
|
|
||||||
// Create buckets in parallel across all sets.
|
// Create buckets in parallel across all sets.
|
||||||
for index := range z.serverPools {
|
for index := range z.serverPools {
|
||||||
|
@ -709,7 +719,7 @@ func (z *erasureServerPools) MakeBucketWithLocation(ctx context.Context, bucket
|
||||||
if z.IsSuspended(index) {
|
if z.IsSuspended(index) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return z.serverPools[index].MakeBucketWithLocation(ctx, bucket, opts)
|
return z.serverPools[index].MakeBucket(ctx, bucket, opts)
|
||||||
}, index)
|
}, index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1644,6 +1654,8 @@ func (z *erasureServerPools) IsTaggingSupported() bool {
|
||||||
// even if one of the serverPools fail to delete buckets, we proceed to
|
// even if one of the serverPools fail to delete buckets, we proceed to
|
||||||
// undo a successful operation.
|
// undo a successful operation.
|
||||||
func (z *erasureServerPools) DeleteBucket(ctx context.Context, bucket string, opts DeleteBucketOptions) error {
|
func (z *erasureServerPools) DeleteBucket(ctx context.Context, bucket string, opts DeleteBucketOptions) error {
|
||||||
|
defer NSUpdated(bucket, slashSeparator)
|
||||||
|
|
||||||
g := errgroup.WithNErrs(len(z.serverPools))
|
g := errgroup.WithNErrs(len(z.serverPools))
|
||||||
|
|
||||||
// Delete buckets in parallel across all serverPools.
|
// Delete buckets in parallel across all serverPools.
|
||||||
|
@ -1724,7 +1736,7 @@ func undoDeleteBucketServerPools(ctx context.Context, bucket string, serverPools
|
||||||
index := index
|
index := index
|
||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
if errs[index] == nil {
|
if errs[index] == nil {
|
||||||
return serverPools[index].MakeBucketWithLocation(ctx, bucket, MakeBucketOptions{})
|
return serverPools[index].MakeBucket(ctx, bucket, MakeBucketOptions{})
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}, index)
|
}, index)
|
||||||
|
|
|
@ -679,14 +679,14 @@ func (s *erasureSets) Shutdown(ctx context.Context) error {
|
||||||
|
|
||||||
// MakeBucketLocation - creates a new bucket across all sets simultaneously,
|
// MakeBucketLocation - creates a new bucket across all sets simultaneously,
|
||||||
// then return the first encountered error
|
// then return the first encountered error
|
||||||
func (s *erasureSets) MakeBucketWithLocation(ctx context.Context, bucket string, opts MakeBucketOptions) error {
|
func (s *erasureSets) MakeBucket(ctx context.Context, bucket string, opts MakeBucketOptions) error {
|
||||||
g := errgroup.WithNErrs(len(s.sets))
|
g := errgroup.WithNErrs(len(s.sets))
|
||||||
|
|
||||||
// Create buckets in parallel across all sets.
|
// Create buckets in parallel across all sets.
|
||||||
for index := range s.sets {
|
for index := range s.sets {
|
||||||
index := index
|
index := index
|
||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
return s.sets[index].MakeBucketWithLocation(ctx, bucket, opts)
|
return s.sets[index].MakeBucket(ctx, bucket, opts)
|
||||||
}, index)
|
}, index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -815,7 +815,7 @@ func undoDeleteBucketSets(ctx context.Context, bucket string, sets []*erasureObj
|
||||||
index := index
|
index := index
|
||||||
g.Go(func() error {
|
g.Go(func() error {
|
||||||
if errs[index] == nil {
|
if errs[index] == nil {
|
||||||
return sets[index].MakeBucketWithLocation(ctx, bucket, MakeBucketOptions{})
|
return sets[index].MakeBucket(ctx, bucket, MakeBucketOptions{})
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}, index)
|
}, index)
|
||||||
|
|
|
@ -84,7 +84,7 @@ func testDeleteObject(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, testCase := range testCases {
|
for i, testCase := range testCases {
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), testCase.bucketName, MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), testCase.bucketName, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ func TestGetObjectInfo(t *testing.T) {
|
||||||
// Testing GetObjectInfo().
|
// Testing GetObjectInfo().
|
||||||
func testGetObjectInfo(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
func testGetObjectInfo(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
// This bucket is used for testing getObjectInfo operations.
|
// This bucket is used for testing getObjectInfo operations.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), "test-getobjectinfo", MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), "test-getobjectinfo", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,6 @@ type TransitionOptions struct {
|
||||||
|
|
||||||
// MakeBucketOptions represents bucket options for ObjectLayer bucket operations
|
// MakeBucketOptions represents bucket options for ObjectLayer bucket operations
|
||||||
type MakeBucketOptions struct {
|
type MakeBucketOptions struct {
|
||||||
Location string
|
|
||||||
LockEnabled bool
|
LockEnabled bool
|
||||||
VersioningEnabled bool
|
VersioningEnabled bool
|
||||||
ForceCreate bool // Create buckets even if they are already created.
|
ForceCreate bool // Create buckets even if they are already created.
|
||||||
|
@ -200,7 +199,7 @@ type ObjectLayer interface {
|
||||||
LocalStorageInfo(ctx context.Context) StorageInfo
|
LocalStorageInfo(ctx context.Context) StorageInfo
|
||||||
|
|
||||||
// Bucket operations.
|
// Bucket operations.
|
||||||
MakeBucketWithLocation(ctx context.Context, bucket string, opts MakeBucketOptions) error
|
MakeBucket(ctx context.Context, bucket string, opts MakeBucketOptions) error
|
||||||
GetBucketInfo(ctx context.Context, bucket string, opts BucketOptions) (bucketInfo BucketInfo, err error)
|
GetBucketInfo(ctx context.Context, bucket string, opts BucketOptions) (bucketInfo BucketInfo, err error)
|
||||||
ListBuckets(ctx context.Context, opts BucketOptions) (buckets []BucketInfo, err error)
|
ListBuckets(ctx context.Context, opts BucketOptions) (buckets []BucketInfo, err error)
|
||||||
DeleteBucket(ctx context.Context, bucket string, opts DeleteBucketOptions) error
|
DeleteBucket(ctx context.Context, bucket string, opts DeleteBucketOptions) error
|
||||||
|
|
|
@ -41,7 +41,7 @@ func testListObjectsVersionedFolders(obj ObjectLayer, instanceType string, t1 Te
|
||||||
"test-bucket-files",
|
"test-bucket-files",
|
||||||
}
|
}
|
||||||
for _, bucket := range testBuckets {
|
for _, bucket := range testBuckets {
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{
|
err := obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{
|
||||||
VersioningEnabled: true,
|
VersioningEnabled: true,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -331,7 +331,7 @@ func _testListObjects(obj ObjectLayer, instanceType string, t1 TestErrHandler, v
|
||||||
6: "test-bucket-custom-delimiter",
|
6: "test-bucket-custom-delimiter",
|
||||||
}
|
}
|
||||||
for _, bucket := range testBuckets {
|
for _, bucket := range testBuckets {
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{
|
err := obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{
|
||||||
VersioningEnabled: versioned,
|
VersioningEnabled: versioned,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1036,7 +1036,7 @@ func testDeleteObjectVersion(obj ObjectLayer, instanceType string, t1 TestErrHan
|
||||||
"bucket-suspended-version-id",
|
"bucket-suspended-version-id",
|
||||||
}
|
}
|
||||||
for _, bucket := range testBuckets {
|
for _, bucket := range testBuckets {
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{
|
err := obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{
|
||||||
VersioningEnabled: true,
|
VersioningEnabled: true,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1123,7 +1123,7 @@ func testListObjectVersions(obj ObjectLayer, instanceType string, t1 TestErrHand
|
||||||
"test-bucket-max-keys-prefixes",
|
"test-bucket-max-keys-prefixes",
|
||||||
}
|
}
|
||||||
for _, bucket := range testBuckets {
|
for _, bucket := range testBuckets {
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{VersioningEnabled: true})
|
err := obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{VersioningEnabled: true})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
}
|
}
|
||||||
|
@ -1753,7 +1753,7 @@ func testListObjectsContinuation(obj ObjectLayer, instanceType string, t1 TestEr
|
||||||
"test-bucket-list-object-continuation-2",
|
"test-bucket-list-object-continuation-2",
|
||||||
}
|
}
|
||||||
for _, bucket := range testBuckets {
|
for _, bucket := range testBuckets {
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
}
|
}
|
||||||
|
@ -1908,7 +1908,7 @@ func BenchmarkListObjects(b *testing.B) {
|
||||||
|
|
||||||
bucket := "ls-benchmark-bucket"
|
bucket := "ls-benchmark-bucket"
|
||||||
// Create a bucket.
|
// Create a bucket.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ func testObjectNewMultipartUpload(obj ObjectLayer, instanceType string, t TestEr
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create bucket before intiating NewMultipartUpload.
|
// Create bucket before intiating NewMultipartUpload.
|
||||||
err = obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{})
|
err = obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// failed to create newbucket, abort.
|
// failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
@ -89,7 +89,7 @@ func testObjectAbortMultipartUpload(obj ObjectLayer, instanceType string, t Test
|
||||||
object := "minio-object"
|
object := "minio-object"
|
||||||
opts := ObjectOptions{}
|
opts := ObjectOptions{}
|
||||||
// Create bucket before intiating NewMultipartUpload.
|
// Create bucket before intiating NewMultipartUpload.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// failed to create newbucket, abort.
|
// failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
@ -136,7 +136,7 @@ func testObjectAPIIsUploadIDExists(obj ObjectLayer, instanceType string, t TestE
|
||||||
object := "minio-object"
|
object := "minio-object"
|
||||||
|
|
||||||
// Create bucket before intiating NewMultipartUpload.
|
// Create bucket before intiating NewMultipartUpload.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
@ -168,7 +168,7 @@ func testObjectAPIPutObjectPart(obj ObjectLayer, instanceType string, t TestErrH
|
||||||
object := "minio-object"
|
object := "minio-object"
|
||||||
opts := ObjectOptions{}
|
opts := ObjectOptions{}
|
||||||
// Create bucket before intiating NewMultipartUpload.
|
// Create bucket before intiating NewMultipartUpload.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
@ -181,7 +181,7 @@ func testObjectAPIPutObjectPart(obj ObjectLayer, instanceType string, t TestErrH
|
||||||
}
|
}
|
||||||
uploadID := res.UploadID
|
uploadID := res.UploadID
|
||||||
// Creating a dummy bucket for tests.
|
// Creating a dummy bucket for tests.
|
||||||
err = obj.MakeBucketWithLocation(context.Background(), "unused-bucket", MakeBucketOptions{})
|
err = obj.MakeBucket(context.Background(), "unused-bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
@ -316,7 +316,7 @@ func testListMultipartUploads(obj ObjectLayer, instanceType string, t TestErrHan
|
||||||
// objectNames[0].
|
// objectNames[0].
|
||||||
// uploadIds [0].
|
// uploadIds [0].
|
||||||
// Create bucket before initiating NewMultipartUpload.
|
// Create bucket before initiating NewMultipartUpload.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucketNames[0], MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucketNames[0], MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
@ -334,7 +334,7 @@ func testListMultipartUploads(obj ObjectLayer, instanceType string, t TestErrHan
|
||||||
// objectNames[0].
|
// objectNames[0].
|
||||||
// uploadIds [1-3].
|
// uploadIds [1-3].
|
||||||
// Bucket to test for mutiple upload Id's for a given object.
|
// Bucket to test for mutiple upload Id's for a given object.
|
||||||
err = obj.MakeBucketWithLocation(context.Background(), bucketNames[1], MakeBucketOptions{})
|
err = obj.MakeBucket(context.Background(), bucketNames[1], MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
@ -355,7 +355,7 @@ func testListMultipartUploads(obj ObjectLayer, instanceType string, t TestErrHan
|
||||||
// bucketnames[2].
|
// bucketnames[2].
|
||||||
// objectNames[0-2].
|
// objectNames[0-2].
|
||||||
// uploadIds [4-9].
|
// uploadIds [4-9].
|
||||||
err = obj.MakeBucketWithLocation(context.Background(), bucketNames[2], MakeBucketOptions{})
|
err = obj.MakeBucket(context.Background(), bucketNames[2], MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
@ -1197,7 +1197,7 @@ func testListObjectPartsDiskNotFound(obj ObjectLayer, instanceType string, disks
|
||||||
// objectNames[0].
|
// objectNames[0].
|
||||||
// uploadIds [0].
|
// uploadIds [0].
|
||||||
// Create bucket before intiating NewMultipartUpload.
|
// Create bucket before intiating NewMultipartUpload.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucketNames[0], MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucketNames[0], MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
@ -1441,7 +1441,7 @@ func testListObjectParts(obj ObjectLayer, instanceType string, t TestErrHandler)
|
||||||
// objectNames[0].
|
// objectNames[0].
|
||||||
// uploadIds [0].
|
// uploadIds [0].
|
||||||
// Create bucket before intiating NewMultipartUpload.
|
// Create bucket before intiating NewMultipartUpload.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucketNames[0], MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucketNames[0], MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
@ -1682,7 +1682,7 @@ func testObjectCompleteMultipartUpload(obj ObjectLayer, instanceType string, t T
|
||||||
// objectNames[0].
|
// objectNames[0].
|
||||||
// uploadIds [0].
|
// uploadIds [0].
|
||||||
// Create bucket before intiating NewMultipartUpload.
|
// Create bucket before intiating NewMultipartUpload.
|
||||||
err = obj.MakeBucketWithLocation(context.Background(), bucketNames[0], MakeBucketOptions{})
|
err = obj.MakeBucket(context.Background(), bucketNames[0], MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err)
|
t.Fatalf("%s : %s", instanceType, err)
|
||||||
|
|
|
@ -47,14 +47,14 @@ func testObjectAPIPutObject(obj ObjectLayer, instanceType string, t TestErrHandl
|
||||||
object := "minio-object"
|
object := "minio-object"
|
||||||
|
|
||||||
// Create bucket.
|
// Create bucket.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creating a dummy bucket for tests.
|
// Creating a dummy bucket for tests.
|
||||||
err = obj.MakeBucketWithLocation(context.Background(), "unused-bucket", MakeBucketOptions{})
|
err = obj.MakeBucket(context.Background(), "unused-bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
@ -223,14 +223,14 @@ func testObjectAPIPutObjectDiskNotFound(obj ObjectLayer, instanceType string, di
|
||||||
object := "minio-object"
|
object := "minio-object"
|
||||||
|
|
||||||
// Create bucket.
|
// Create bucket.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creating a dummy bucket for tests.
|
// Creating a dummy bucket for tests.
|
||||||
err = obj.MakeBucketWithLocation(context.Background(), "unused-bucket", MakeBucketOptions{})
|
err = obj.MakeBucket(context.Background(), "unused-bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
@ -335,7 +335,7 @@ func testObjectAPIPutObjectStaleFiles(obj ObjectLayer, instanceType string, disk
|
||||||
object := "minio-object"
|
object := "minio-object"
|
||||||
|
|
||||||
// Create bucket.
|
// Create bucket.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
@ -380,7 +380,7 @@ func testObjectAPIMultipartPutObjectStaleFiles(obj ObjectLayer, instanceType str
|
||||||
object := "minio-object"
|
object := "minio-object"
|
||||||
|
|
||||||
// Create bucket.
|
// Create bucket.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucket, MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucket, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
|
|
@ -77,7 +77,7 @@ func TestMakeBucket(t *testing.T) {
|
||||||
|
|
||||||
// Tests validate bucket creation.
|
// Tests validate bucket creation.
|
||||||
func testMakeBucket(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
func testMakeBucket(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), "bucket-unknown", MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), "bucket-unknown", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ func TestMultipartObjectCreation(t *testing.T) {
|
||||||
// Tests validate creation of part files during Multipart operation.
|
// Tests validate creation of part files during Multipart operation.
|
||||||
func testMultipartObjectCreation(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
func testMultipartObjectCreation(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
var opts ObjectOptions
|
var opts ObjectOptions
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), "bucket", MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ func TestMultipartObjectAbort(t *testing.T) {
|
||||||
// Tests validate abortion of Multipart operation.
|
// Tests validate abortion of Multipart operation.
|
||||||
func testMultipartObjectAbort(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
func testMultipartObjectAbort(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
var opts ObjectOptions
|
var opts ObjectOptions
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), "bucket", MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ func TestMultipleObjectCreation(t *testing.T) {
|
||||||
func testMultipleObjectCreation(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
func testMultipleObjectCreation(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
objects := make(map[string][]byte)
|
objects := make(map[string][]byte)
|
||||||
var opts ObjectOptions
|
var opts ObjectOptions
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), "bucket", MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ func TestPaging(t *testing.T) {
|
||||||
|
|
||||||
// Tests validate creation of objects and the order of listing using various filters for ListObjects operation.
|
// Tests validate creation of objects and the order of listing using various filters for ListObjects operation.
|
||||||
func testPaging(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
func testPaging(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
obj.MakeBucketWithLocation(context.Background(), "bucket", MakeBucketOptions{})
|
obj.MakeBucket(context.Background(), "bucket", MakeBucketOptions{})
|
||||||
result, err := obj.ListObjects(context.Background(), "bucket", "", "", "", 0)
|
result, err := obj.ListObjects(context.Background(), "bucket", "", "", "", 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
|
@ -443,7 +443,7 @@ func TestObjectOverwriteWorks(t *testing.T) {
|
||||||
|
|
||||||
// Tests validate overwriting of an existing object.
|
// Tests validate overwriting of an existing object.
|
||||||
func testObjectOverwriteWorks(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
func testObjectOverwriteWorks(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), "bucket", MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
|
@ -497,11 +497,11 @@ func TestBucketRecreateFails(t *testing.T) {
|
||||||
|
|
||||||
// Tests validate that recreation of the bucket fails.
|
// Tests validate that recreation of the bucket fails.
|
||||||
func testBucketRecreateFails(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
func testBucketRecreateFails(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), "string", MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), "string", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
err = obj.MakeBucketWithLocation(context.Background(), "string", MakeBucketOptions{})
|
err = obj.MakeBucket(context.Background(), "string", MakeBucketOptions{})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatalf("%s: Expected error but found nil.", instanceType)
|
t.Fatalf("%s: Expected error but found nil.", instanceType)
|
||||||
}
|
}
|
||||||
|
@ -602,7 +602,7 @@ func testPutObject(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
length := int64(len(content))
|
length := int64(len(content))
|
||||||
readerEOF := newTestReaderEOF(content)
|
readerEOF := newTestReaderEOF(content)
|
||||||
readerNoEOF := newTestReaderNoEOF(content)
|
readerNoEOF := newTestReaderNoEOF(content)
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), "bucket", MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
|
@ -642,7 +642,7 @@ func TestPutObjectInSubdir(t *testing.T) {
|
||||||
|
|
||||||
// Tests validate PutObject with subdirectory prefix.
|
// Tests validate PutObject with subdirectory prefix.
|
||||||
func testPutObjectInSubdir(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
func testPutObjectInSubdir(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), "bucket", MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
|
@ -684,7 +684,7 @@ func testListBuckets(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add one and test exists.
|
// add one and test exists.
|
||||||
err = obj.MakeBucketWithLocation(context.Background(), "bucket1", MakeBucketOptions{})
|
err = obj.MakeBucket(context.Background(), "bucket1", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
|
@ -698,7 +698,7 @@ func testListBuckets(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add two and test exists.
|
// add two and test exists.
|
||||||
err = obj.MakeBucketWithLocation(context.Background(), "bucket2", MakeBucketOptions{})
|
err = obj.MakeBucket(context.Background(), "bucket2", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
|
@ -712,7 +712,7 @@ func testListBuckets(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// add three and test exists + prefix.
|
// add three and test exists + prefix.
|
||||||
err = obj.MakeBucketWithLocation(context.Background(), "bucket22", MakeBucketOptions{})
|
err = obj.MakeBucket(context.Background(), "bucket22", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
|
@ -736,11 +736,11 @@ func testListBucketsOrder(obj ObjectLayer, instanceType string, t TestErrHandler
|
||||||
// if implementation contains a map, order of map keys will vary.
|
// if implementation contains a map, order of map keys will vary.
|
||||||
// this ensures they return in the same order each time.
|
// this ensures they return in the same order each time.
|
||||||
// add one and test exists.
|
// add one and test exists.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), "bucket1", MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), "bucket1", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
err = obj.MakeBucketWithLocation(context.Background(), "bucket2", MakeBucketOptions{})
|
err = obj.MakeBucket(context.Background(), "bucket2", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
|
@ -789,7 +789,7 @@ func TestNonExistantObjectInBucket(t *testing.T) {
|
||||||
|
|
||||||
// Tests validate that GetObject fails on a non-existent bucket as expected.
|
// Tests validate that GetObject fails on a non-existent bucket as expected.
|
||||||
func testNonExistantObjectInBucket(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
func testNonExistantObjectInBucket(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), "bucket", MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
|
@ -817,7 +817,7 @@ func TestGetDirectoryReturnsObjectNotFound(t *testing.T) {
|
||||||
// Tests validate that GetObject on an existing directory fails as expected.
|
// Tests validate that GetObject on an existing directory fails as expected.
|
||||||
func testGetDirectoryReturnsObjectNotFound(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
func testGetDirectoryReturnsObjectNotFound(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
bucketName := "bucket"
|
bucketName := "bucket"
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucketName, MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucketName, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
|
@ -859,7 +859,7 @@ func TestContentType(t *testing.T) {
|
||||||
|
|
||||||
// Test content-type.
|
// Test content-type.
|
||||||
func testContentType(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
func testContentType(obj ObjectLayer, instanceType string, t TestErrHandler) {
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), "bucket", MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), "bucket", MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
t.Fatalf("%s: <ERROR> %s", instanceType, err)
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,7 +141,7 @@ func testPostPolicyBucketHandler(obj ObjectLayer, instanceType string, t TestErr
|
||||||
// objectNames[0].
|
// objectNames[0].
|
||||||
// uploadIds [0].
|
// uploadIds [0].
|
||||||
// Create bucket before initiating NewMultipartUpload.
|
// Create bucket before initiating NewMultipartUpload.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucketName, MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucketName, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
@ -460,7 +460,7 @@ func testPostPolicyBucketHandlerRedirect(obj ObjectLayer, instanceType string, t
|
||||||
curTime := UTCNow()
|
curTime := UTCNow()
|
||||||
curTimePlus5Min := curTime.Add(time.Minute * 5)
|
curTimePlus5Min := curTime.Add(time.Minute * 5)
|
||||||
|
|
||||||
err = obj.MakeBucketWithLocation(context.Background(), bucketName, MakeBucketOptions{})
|
err = obj.MakeBucket(context.Background(), bucketName, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Failed to create newbucket, abort.
|
// Failed to create newbucket, abort.
|
||||||
t.Fatalf("%s : %s", instanceType, err.Error())
|
t.Fatalf("%s : %s", instanceType, err.Error())
|
||||||
|
|
|
@ -682,9 +682,6 @@ func (c *SiteReplicationSys) MakeBucketHook(ctx context.Context, bucket string,
|
||||||
}
|
}
|
||||||
|
|
||||||
optsMap := make(map[string]string)
|
optsMap := make(map[string]string)
|
||||||
if opts.Location != "" {
|
|
||||||
optsMap["location"] = opts.Location
|
|
||||||
}
|
|
||||||
if opts.LockEnabled {
|
if opts.LockEnabled {
|
||||||
optsMap["lockEnabled"] = "true"
|
optsMap["lockEnabled"] = "true"
|
||||||
optsMap["versioningEnabled"] = "true"
|
optsMap["versioningEnabled"] = "true"
|
||||||
|
@ -780,7 +777,7 @@ func (c *SiteReplicationSys) PeerBucketMakeWithVersioningHandler(ctx context.Con
|
||||||
return errServerNotInitialized
|
return errServerNotInitialized
|
||||||
}
|
}
|
||||||
|
|
||||||
err := objAPI.MakeBucketWithLocation(ctx, bucket, opts)
|
err := objAPI.MakeBucket(ctx, bucket, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Check if this is a bucket exists error.
|
// Check if this is a bucket exists error.
|
||||||
_, ok1 := err.(BucketExists)
|
_, ok1 := err.(BucketExists)
|
||||||
|
@ -3209,7 +3206,6 @@ func (c *SiteReplicationSys) SiteReplicationMetaInfo(ctx context.Context, objAPI
|
||||||
Bucket: bucket,
|
Bucket: bucket,
|
||||||
CreatedAt: bucketInfo.Created.UTC(),
|
CreatedAt: bucketInfo.Created.UTC(),
|
||||||
DeletedAt: bucketInfo.Deleted.UTC(),
|
DeletedAt: bucketInfo.Deleted.UTC(),
|
||||||
Location: globalSite.Region,
|
|
||||||
}
|
}
|
||||||
if !bucketExists {
|
if !bucketExists {
|
||||||
info.Buckets[bucket] = bms
|
info.Buckets[bucket] = bms
|
||||||
|
@ -4280,11 +4276,6 @@ func (c *SiteReplicationSys) healBucket(ctx context.Context, objAPI ObjectLayer,
|
||||||
if isMakeBucket {
|
if isMakeBucket {
|
||||||
var opts MakeBucketOptions
|
var opts MakeBucketOptions
|
||||||
optsMap := make(map[string]string)
|
optsMap := make(map[string]string)
|
||||||
if bStatus.Location != "" {
|
|
||||||
optsMap["location"] = bStatus.Location
|
|
||||||
opts.Location = bStatus.Location
|
|
||||||
}
|
|
||||||
|
|
||||||
optsMap["versioningEnabled"] = "true"
|
optsMap["versioningEnabled"] = "true"
|
||||||
opts.VersioningEnabled = true
|
opts.VersioningEnabled = true
|
||||||
opts.CreatedAt = bStatus.CreatedAt
|
opts.CreatedAt = bStatus.CreatedAt
|
||||||
|
|
|
@ -1547,7 +1547,7 @@ func initAPIHandlerTest(ctx context.Context, obj ObjectLayer, endpoints []string
|
||||||
bucketName := getRandomBucketName()
|
bucketName := getRandomBucketName()
|
||||||
|
|
||||||
// Create bucket.
|
// Create bucket.
|
||||||
err := obj.MakeBucketWithLocation(context.Background(), bucketName, MakeBucketOptions{})
|
err := obj.MakeBucket(context.Background(), bucketName, MakeBucketOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// failed to create newbucket, return err.
|
// failed to create newbucket, return err.
|
||||||
return "", nil, err
|
return "", nil, err
|
||||||
|
|
Loading…
Reference in New Issue