mirror of
https://github.com/minio/minio.git
synced 2024-12-26 07:05:55 -05:00
Fix duplicate map allocation
This commit is contained in:
parent
8ce44bfbd1
commit
3d61ba5930
@ -295,14 +295,7 @@ func (memory *memoryDriver) createObject(bucket, key, contentType, expectedMD5Su
|
|||||||
}
|
}
|
||||||
|
|
||||||
memory.lock.Lock()
|
memory.lock.Lock()
|
||||||
memoryObject := make(map[string]drivers.ObjectMetadata)
|
storedBucket.objectMetadata[objectKey] = newObject
|
||||||
switch {
|
|
||||||
case len(storedBucket.objectMetadata) == 0:
|
|
||||||
storedBucket.objectMetadata = memoryObject
|
|
||||||
storedBucket.objectMetadata[objectKey] = newObject
|
|
||||||
default:
|
|
||||||
storedBucket.objectMetadata[objectKey] = newObject
|
|
||||||
}
|
|
||||||
memory.storedBuckets[bucket] = storedBucket
|
memory.storedBuckets[bucket] = storedBucket
|
||||||
memory.lock.Unlock()
|
memory.lock.Unlock()
|
||||||
return newObject.Md5, nil
|
return newObject.Md5, nil
|
||||||
@ -336,6 +329,7 @@ func (memory *memoryDriver) CreateBucket(bucketName, acl string) error {
|
|||||||
var newBucket = storedBucket{}
|
var newBucket = storedBucket{}
|
||||||
newBucket.objectMetadata = make(map[string]drivers.ObjectMetadata)
|
newBucket.objectMetadata = make(map[string]drivers.ObjectMetadata)
|
||||||
newBucket.multiPartSession = make(map[string]multiPartSession)
|
newBucket.multiPartSession = make(map[string]multiPartSession)
|
||||||
|
newBucket.partMetadata = make(map[string]drivers.PartMetadata)
|
||||||
newBucket.bucketMetadata = drivers.BucketMetadata{}
|
newBucket.bucketMetadata = drivers.BucketMetadata{}
|
||||||
newBucket.bucketMetadata.Name = bucketName
|
newBucket.bucketMetadata.Name = bucketName
|
||||||
newBucket.bucketMetadata.Created = time.Now().UTC()
|
newBucket.bucketMetadata.Created = time.Now().UTC()
|
||||||
|
@ -24,7 +24,6 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"sort"
|
"sort"
|
||||||
@ -192,14 +191,7 @@ func (memory *memoryDriver) createObjectPart(bucket, key, uploadID string, partI
|
|||||||
}
|
}
|
||||||
|
|
||||||
memory.lock.Lock()
|
memory.lock.Lock()
|
||||||
memoryPart := make(map[string]drivers.PartMetadata)
|
storedBucket.partMetadata[partKey] = newPart
|
||||||
switch {
|
|
||||||
case len(storedBucket.partMetadata) == 0:
|
|
||||||
storedBucket.partMetadata = memoryPart
|
|
||||||
storedBucket.partMetadata[partKey] = newPart
|
|
||||||
default:
|
|
||||||
storedBucket.partMetadata[partKey] = newPart
|
|
||||||
}
|
|
||||||
multiPartSession := storedBucket.multiPartSession[key]
|
multiPartSession := storedBucket.multiPartSession[key]
|
||||||
multiPartSession.totalParts++
|
multiPartSession.totalParts++
|
||||||
storedBucket.multiPartSession[key] = multiPartSession
|
storedBucket.multiPartSession[key] = multiPartSession
|
||||||
@ -398,9 +390,6 @@ func (memory *memoryDriver) ListObjectParts(bucket, key string, resources driver
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (memory *memoryDriver) expiredPart(a ...interface{}) {
|
func (memory *memoryDriver) expiredPart(a ...interface{}) {
|
||||||
cacheStats := memory.multiPartObjects.Stats()
|
|
||||||
log.Printf("CurrentSize: %d, CurrentItems: %d, TotalExpirations: %d",
|
|
||||||
cacheStats.Bytes, cacheStats.Items, cacheStats.Expired)
|
|
||||||
key := a[0].(string)
|
key := a[0].(string)
|
||||||
// loop through all buckets
|
// loop through all buckets
|
||||||
for _, storedBucket := range memory.storedBuckets {
|
for _, storedBucket := range memory.storedBuckets {
|
||||||
|
Loading…
Reference in New Issue
Block a user