do not expect 'speedtest' to be a bucket (#14199)

fixes #14196
This commit is contained in:
Harshavardhana 2022-01-27 08:13:03 -08:00 committed by GitHub
parent d6dd17a483
commit cf407f7176
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 10 deletions

View File

@ -978,8 +978,7 @@ func (a adminAPIHandlers) SpeedtestHandler(w http.ResponseWriter, r *http.Reques
} }
deleteBucket := func() { deleteBucket := func() {
loc := pathJoin(minioMetaSpeedTestBucket, minioMetaSpeedTestBucketPrefix) objectAPI.DeleteBucket(context.Background(), pathJoin(minioMetaBucket, "speedtest"), DeleteBucketOptions{
objectAPI.DeleteBucket(context.Background(), loc, DeleteBucketOptions{
Force: true, Force: true,
NoRecreate: true, NoRecreate: true,
}) })

View File

@ -61,10 +61,7 @@ const (
// MinIO tmp meta prefix. // MinIO tmp meta prefix.
minioMetaTmpBucket = minioMetaBucket + "/tmp" minioMetaTmpBucket = minioMetaBucket + "/tmp"
// MinIO tmp meta prefix for deleted objects. // MinIO tmp meta prefix for deleted objects.
minioMetaTmpDeletedBucket = minioMetaTmpBucket + "/.trash" minioMetaTmpDeletedBucket = minioMetaTmpBucket + "/.trash"
minioMetaSpeedTestBucket = minioMetaBucket + "/speedtest"
minioMetaSpeedTestBucketPrefix = "objects/"
// DNS separator (period), used for bucket name validation. // DNS separator (period), used for bucket name validation.
dnsDelimiter = "." dnsDelimiter = "."
// On compressed files bigger than this; // On compressed files bigger than this;

View File

@ -1168,7 +1168,6 @@ func selfSpeedtest(ctx context.Context, size, concurrent int, duration time.Dura
var totalBytesWritten uint64 var totalBytesWritten uint64
var totalBytesRead uint64 var totalBytesRead uint64
bucket := minioMetaSpeedTestBucket
objCountPerThread := make([]uint64, concurrent) objCountPerThread := make([]uint64, concurrent)
uploadsCtx, uploadsCancel := context.WithCancel(context.Background()) uploadsCtx, uploadsCancel := context.WithCancel(context.Background())
defer uploadsCancel() defer uploadsCancel()
@ -1178,7 +1177,7 @@ func selfSpeedtest(ctx context.Context, size, concurrent int, duration time.Dura
uploadsCancel() uploadsCancel()
}() }()
objNamePrefix := minioMetaSpeedTestBucketPrefix + uuid.New().String() objNamePrefix := "speedtest/objects/" + uuid.New().String()
wg.Add(concurrent) wg.Add(concurrent)
for i := 0; i < concurrent; i++ { for i := 0; i < concurrent; i++ {
@ -1198,7 +1197,7 @@ func selfSpeedtest(ctx context.Context, size, concurrent int, duration time.Dura
return return
} }
reader := NewPutObjReader(hashReader) reader := NewPutObjReader(hashReader)
objInfo, err := objAPI.PutObject(uploadsCtx, bucket, fmt.Sprintf("%s.%d.%d", objInfo, err := objAPI.PutObject(uploadsCtx, minioMetaBucket, fmt.Sprintf("%s.%d.%d",
objNamePrefix, i, objCountPerThread[i]), reader, ObjectOptions{ objNamePrefix, i, objCountPerThread[i]), reader, ObjectOptions{
UserDefined: map[string]string{ UserDefined: map[string]string{
xhttp.AmzStorageClass: storageClass, xhttp.AmzStorageClass: storageClass,
@ -1245,7 +1244,7 @@ func selfSpeedtest(ctx context.Context, size, concurrent int, duration time.Dura
if objCountPerThread[i] == j { if objCountPerThread[i] == j {
j = 0 j = 0
} }
r, err := objAPI.GetObjectNInfo(downloadsCtx, bucket, fmt.Sprintf("%s.%d.%d", r, err := objAPI.GetObjectNInfo(downloadsCtx, minioMetaBucket, fmt.Sprintf("%s.%d.%d",
objNamePrefix, i, j), nil, nil, noLock, ObjectOptions{}) objNamePrefix, i, j), nil, nil, noLock, ObjectOptions{})
if err != nil { if err != nil {
if !contextCanceled(downloadsCtx) { if !contextCanceled(downloadsCtx) {