mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -05:00
remove checking for BucketInfo() peer call for every PUT() (#18464)
we already validate if the bucket doesn't exist in RenameData() which can handle this cleanly, instead of making a network call and returning errors.
This commit is contained in:
parent
22d59e757d
commit
0a286153bb
@ -970,7 +970,7 @@ func (z *erasureServerPools) GetObjectInfo(ctx context.Context, bucket, object s
|
|||||||
// PutObject - writes an object to least used erasure pool.
|
// PutObject - writes an object to least used erasure pool.
|
||||||
func (z *erasureServerPools) PutObject(ctx context.Context, bucket string, object string, data *PutObjReader, opts ObjectOptions) (ObjectInfo, error) {
|
func (z *erasureServerPools) PutObject(ctx context.Context, bucket string, object string, data *PutObjReader, opts ObjectOptions) (ObjectInfo, error) {
|
||||||
// Validate put object input args.
|
// Validate put object input args.
|
||||||
if err := checkPutObjectArgs(ctx, bucket, object, z); err != nil {
|
if err := checkPutObjectArgs(ctx, bucket, object); err != nil {
|
||||||
return ObjectInfo{}, err
|
return ObjectInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,6 @@ func checkObjectArgs(ctx context.Context, bucket, object string, obj ObjectLayer
|
|||||||
// This is done on purpose since the order of errors is
|
// This is done on purpose since the order of errors is
|
||||||
// important here bucket does not exist error should
|
// important here bucket does not exist error should
|
||||||
// happen before we return an error for invalid object name.
|
// happen before we return an error for invalid object name.
|
||||||
// FIXME: should be moved to handler layer.
|
|
||||||
if err := checkBucketExist(ctx, bucket, obj); err != nil {
|
if err := checkBucketExist(ctx, bucket, obj); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -170,16 +169,7 @@ func checkObjectArgs(ctx context.Context, bucket, object string, obj ObjectLayer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Checks for PutObject arguments validity, also validates if bucket exists.
|
// Checks for PutObject arguments validity, also validates if bucket exists.
|
||||||
func checkPutObjectArgs(ctx context.Context, bucket, object string, obj getBucketInfoI) error {
|
func checkPutObjectArgs(ctx context.Context, bucket, object string) error {
|
||||||
// Verify if bucket exists before validating object name.
|
|
||||||
// This is done on purpose since the order of errors is
|
|
||||||
// important here bucket does not exist error should
|
|
||||||
// happen before we return an error for invalid object name.
|
|
||||||
// FIXME: should be moved to handler layer.
|
|
||||||
if err := checkBucketExist(ctx, bucket, obj); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := checkObjectNameForLengthAndSlash(bucket, object); err != nil {
|
if err := checkObjectNameForLengthAndSlash(bucket, object); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user