mirror of
https://github.com/minio/minio.git
synced 2025-11-09 21:49:46 -05:00
Fix storage class related issues (#5322)
- Add storage class metadata validation for request header - Change storage class header values to be consistent with AWS S3 - Refactor internal method to take only the reqd argument
This commit is contained in:
committed by
Harshavardhana
parent
f25ec31565
commit
545a9e4a82
@@ -26,10 +26,16 @@ import (
|
||||
const (
|
||||
// metadata entry for storage class
|
||||
amzStorageClass = "x-amz-storage-class"
|
||||
// Canonical metadata entry for storage class
|
||||
amzStorageClassCanonical = "X-Amz-Storage-Class"
|
||||
// Reduced redundancy storage class
|
||||
reducedRedundancyStorageClass = "MINIO_STORAGE_CLASS_RRS"
|
||||
reducedRedundancyStorageClass = "REDUCED_REDUNDANCY"
|
||||
// Standard storage class
|
||||
standardStorageClass = "MINIO_STORAGE_CLASS_STANDARD"
|
||||
standardStorageClass = "STANDARD"
|
||||
// Reduced redundancy storage class environment variable
|
||||
reducedRedundancyStorageClassEnv = "MINIO_STORAGE_CLASS_RRS"
|
||||
// Standard storage class environment variable
|
||||
standardStorageClassEnv = "MINIO_STORAGE_CLASS_STANDARD"
|
||||
// Supported storage class scheme is EC
|
||||
supportedStorageClassScheme = "EC"
|
||||
// Minimum parity disks
|
||||
@@ -48,6 +54,12 @@ type storageClassConfig struct {
|
||||
RRS string `json:"rrs"`
|
||||
}
|
||||
|
||||
// Validate if storage class in metadata
|
||||
// Only Standard and RRS Storage classes are supported
|
||||
func isValidStorageClassMeta(sc string) bool {
|
||||
return sc == reducedRedundancyStorageClass || sc == standardStorageClass
|
||||
}
|
||||
|
||||
// Parses given storageClassEnv and returns a storageClass structure.
|
||||
// Supported Storage Class format is "Scheme:Number of parity disks".
|
||||
// Currently only supported scheme is "EC".
|
||||
@@ -142,8 +154,7 @@ func validateSSParity(ssParity, rrsParity int) (err error) {
|
||||
// -- 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
|
||||
func getDrivesCount(sc string, disks []StorageAPI) (data, parity int) {
|
||||
totalDisks := len(disks)
|
||||
func getRedundancyCount(sc string, totalDisks int) (data, parity int) {
|
||||
parity = totalDisks / 2
|
||||
switch sc {
|
||||
case reducedRedundancyStorageClass:
|
||||
|
||||
Reference in New Issue
Block a user