mirror of
https://github.com/minio/minio.git
synced 2025-01-13 07:53:21 -05:00
Fixing a race in NewMultipartUpload() session for simultaneous requests, observed at play.minio.io
This commit is contained in:
parent
eb34634e81
commit
c41ebf7535
@ -334,6 +334,7 @@ func (memory *memoryDriver) CreateBucket(bucketName, acl string) error {
|
||||
}
|
||||
var newBucket = storedBucket{}
|
||||
newBucket.objectMetadata = make(map[string]drivers.ObjectMetadata)
|
||||
newBucket.multiPartSession = make(map[string]multiPartSession)
|
||||
newBucket.bucketMetadata = drivers.BucketMetadata{}
|
||||
newBucket.bucketMetadata.Name = bucketName
|
||||
newBucket.bucketMetadata.Created = time.Now().UTC()
|
||||
@ -540,13 +541,11 @@ func (memory *memoryDriver) NewMultipartUpload(bucket, key, contentType string)
|
||||
uploadIDSum := sha512.Sum512(id)
|
||||
uploadID := base64.URLEncoding.EncodeToString(uploadIDSum[:])[:47]
|
||||
|
||||
storedBucket.multiPartSession = make(map[string]multiPartSession)
|
||||
storedBucket.multiPartSession[key] = multiPartSession{
|
||||
memory.storedBuckets[bucket].multiPartSession[key] = multiPartSession{
|
||||
uploadID: uploadID,
|
||||
initiated: time.Now(),
|
||||
totalParts: 0,
|
||||
}
|
||||
memory.storedBuckets[bucket] = storedBucket
|
||||
memory.lock.Unlock()
|
||||
|
||||
return uploadID, nil
|
||||
|
Loading…
Reference in New Issue
Block a user