XL/metadata: use new hashOrder algorithm for newXLMeta. (#2147)

This commit is contained in:
Harshavardhana 2016-07-08 15:28:09 -07:00
parent 63b3f1dcfd
commit 6266328a85
5 changed files with 9 additions and 10 deletions

View File

@ -4,9 +4,9 @@ language: go
os: os:
- linux - linux
## Turning off for now. - osx
# - osx
# osx_image: xcode7.2 osx_image: xcode7.2
env: env:
- ARCH=x86_64 - ARCH=x86_64

View File

@ -107,9 +107,8 @@ type xlMetaV1 struct {
Parts []objectPartInfo `json:"parts,omitempty"` Parts []objectPartInfo `json:"parts,omitempty"`
} }
// newXLMetaV1 - initializes new xlMetaV1, adds version, allocates a // newXLMetaV1 - initializes new xlMetaV1, adds version, allocates a fresh erasure info.
// fresh erasure info. func newXLMetaV1(object string, dataBlocks, parityBlocks int) (xlMeta xlMetaV1) {
func newXLMetaV1(dataBlocks, parityBlocks int) (xlMeta xlMetaV1) {
xlMeta = xlMetaV1{} xlMeta = xlMetaV1{}
xlMeta.Version = "1.0.0" xlMeta.Version = "1.0.0"
xlMeta.Format = "xl" xlMeta.Format = "xl"
@ -119,7 +118,7 @@ func newXLMetaV1(dataBlocks, parityBlocks int) (xlMeta xlMetaV1) {
DataBlocks: dataBlocks, DataBlocks: dataBlocks,
ParityBlocks: parityBlocks, ParityBlocks: parityBlocks,
BlockSize: blockSizeV1, BlockSize: blockSizeV1,
Distribution: hashOrder(time.Now().UTC().String(), dataBlocks+parityBlocks), Distribution: hashOrder(object, dataBlocks+parityBlocks),
} }
return xlMeta return xlMeta
} }

View File

@ -39,7 +39,7 @@ func TestXLMetaV1(t *testing.T) {
} }
// Create a XLMetaV1 structure to test on. // Create a XLMetaV1 structure to test on.
meta := newXLMetaV1(8, 8) meta := newXLMetaV1("minio", 8, 8)
// Add 5 parts. // Add 5 parts.
for _, test := range testCases { for _, test := range testCases {

View File

@ -252,7 +252,7 @@ func (xl xlObjects) ListMultipartUploads(bucket, prefix, keyMarker, uploadIDMark
// all the disks. `uploads.json` carries metadata regarding on going // all the disks. `uploads.json` carries metadata regarding on going
// multipart operation on the object. // multipart operation on the object.
func (xl xlObjects) newMultipartUpload(bucket string, object string, meta map[string]string) (uploadID string, err error) { func (xl xlObjects) newMultipartUpload(bucket string, object string, meta map[string]string) (uploadID string, err error) {
xlMeta := newXLMetaV1(xl.dataBlocks, xl.parityBlocks) xlMeta := newXLMetaV1(object, xl.dataBlocks, xl.parityBlocks)
// If not set default to "application/octet-stream" // If not set default to "application/octet-stream"
if meta["content-type"] == "" { if meta["content-type"] == "" {
contentType := "application/octet-stream" contentType := "application/octet-stream"

View File

@ -368,7 +368,7 @@ func (xl xlObjects) PutObject(bucket string, object string, size int64, data io.
tempObj := uniqueID tempObj := uniqueID
// Initialize xl meta. // Initialize xl meta.
xlMeta := newXLMetaV1(xl.dataBlocks, xl.parityBlocks) xlMeta := newXLMetaV1(object, xl.dataBlocks, xl.parityBlocks)
// Read metadata associated with the object from all disks. // Read metadata associated with the object from all disks.
partsMetadata, errs := xl.readAllXLMetadata(bucket, object) partsMetadata, errs := xl.readAllXLMetadata(bucket, object)