Assume standard storage class if not set in metadata (#5370)

If STANDARD storage class is set before starting up Minio server, 
but x-amz-storage-class metadata field is not set in a PutObject 
request, Minio server defaults to N/2 data and N/2 parity disks.

This PR changes the behaviour to use data and parity disks set in
STANDARD storage class, even if x-amz-storage-class metadata 
field is not present in PutObject requests.
This commit is contained in:
Nitish Tiwari
2018-01-11 14:58:12 +05:30
committed by GitHub
parent f413224b24
commit 1b721d76b1
4 changed files with 22 additions and 5 deletions
+5 -3
View File
@@ -182,11 +182,13 @@ func validateSSParity(ssParity, rrsParity int) (err error) {
// Returns the data and parity drive count based on storage class
// If storage class is set using the env vars MINIO_STORAGE_CLASS_RRS and MINIO_STORAGE_CLASS_STANDARD
// or config.json fields
// -- corresponding values are returned
// If storage class is not set using environment variables, default values are returned
// If storage class is not set during startup, default values are returned
// -- Default for Reduced Redundancy Storage class is, parity = 2 and data = N-Parity
// -- Default for Standard Storage class is, parity = N/2, data = N/2
// If storage class is not present in metadata, default value is data = N/2, parity = N/2
// If storage class is empty
// -- standard storage class is assumed and corresponding data and parity is returned
func getRedundancyCount(sc string, totalDisks int) (data, parity int) {
parity = totalDisks / 2
switch sc {
@@ -198,7 +200,7 @@ func getRedundancyCount(sc string, totalDisks int) (data, parity int) {
// else fall back to default value
parity = defaultRRSParity
}
case standardStorageClass:
case standardStorageClass, "":
if globalStandardStorageClass.Parity != 0 {
// set the standard parity if available
parity = globalStandardStorageClass.Parity