diff --git a/cmd/common-main.go b/cmd/common-main.go index 9093e3c76..9c026db2c 100644 --- a/cmd/common-main.go +++ b/cmd/common-main.go @@ -153,15 +153,6 @@ func handleCommonEnvVars() { globalCacheExpiry = expiry } - if intervalStr := os.Getenv("MINIO_USAGE_CHECK_INTERVAL"); intervalStr != "" { - interval, err := parseDuration(intervalStr) - if err != nil { - logger.Fatal(uiErrInvalidUsageCheckIntervalValue(err), "Invalid MINIO_USAGE_CHECK_INTERVAL value (`%s`)", intervalStr) - } - globalUsageCheckInterval = interval - globalIsEnvUsageCheck = true - } - // In place update is true by default if the MINIO_UPDATE is not set // or is not set to 'off', if MINIO_UPDATE is set to 'off' then // in-place update is off. diff --git a/cmd/config-current.go b/cmd/config-current.go index 649157a8a..9d74b2ad7 100644 --- a/cmd/config-current.go +++ b/cmd/config-current.go @@ -21,7 +21,6 @@ import ( "fmt" "reflect" "sync" - "time" "github.com/minio/minio/cmd/logger" @@ -105,17 +104,6 @@ func (s *serverConfig) GetBrowser() bool { return bool(s.Browser) } -// Set new usage configuration, currently only supports configuring -// usage check interval. -func (s *serverConfig) SetUsageConfig(checkUsageInterval time.Duration) { - s.Usage = usageConfig{checkUsageInterval} -} - -// Get current usage configuration. -func (s *serverConfig) GetUsageConfig() usageConfig { - return s.Usage -} - // SetCacheConfig sets the current cache config func (s *serverConfig) SetCacheConfig(drives, exclude []string, expiry int) { s.Cache.Drives = drives @@ -153,8 +141,6 @@ func (s *serverConfig) ConfigDiff(t *serverConfig) string { return "StorageClass configuration differs" case !reflect.DeepEqual(s.Cache, t.Cache): return "Cache configuration differs" - case !reflect.DeepEqual(s.Usage, t.Usage): - return "Usage configuration differs" case !reflect.DeepEqual(s.Notify.AMQP, t.Notify.AMQP): return "AMQP Notification configuration differs" case !reflect.DeepEqual(s.Notify.NATS, t.Notify.NATS): @@ -200,7 +186,6 @@ func newServerConfig() *serverConfig { Exclude: []string{}, Expiry: globalCacheExpiry, }, - Usage: usageConfig{globalDefaultUsageCheckInterval}, Notify: notifier{}, } @@ -261,10 +246,6 @@ func newConfig() error { srvCfg.SetCacheConfig(globalCacheDrives, globalCacheExcludes, globalCacheExpiry) } - if globalIsEnvUsageCheck { - srvCfg.SetUsageConfig(globalUsageCheckInterval) - } - // hold the mutex lock before a new config is assigned. // Save the new config globally. // unlock the mutex. @@ -358,9 +339,6 @@ func loadConfig() error { globalCacheExcludes = cacheConf.Exclude globalCacheExpiry = cacheConf.Expiry } - if !globalIsEnvUsageCheck { - globalUsageCheckInterval = globalServerConfig.GetUsageConfig().UsageCheckInterval - } globalServerConfigMu.Unlock() return nil diff --git a/cmd/config-migrate.go b/cmd/config-migrate.go index 861058d72..67ac52b68 100644 --- a/cmd/config-migrate.go +++ b/cmd/config-migrate.go @@ -2062,10 +2062,6 @@ func migrateV23ToV24() error { srvConfig.Cache.Exclude = cv23.Cache.Exclude srvConfig.Cache.Expiry = cv23.Cache.Expiry - // Init usage config. For future migration, usage config needs - // to be copied over from previous version. - srvConfig.Usage = usageConfig{globalDefaultUsageCheckInterval} - if err = quick.Save(configFile, srvConfig); err != nil { return fmt.Errorf("Failed to migrate config from ā€˜%sā€™ to ā€˜%sā€™. %v", cv23.Version, srvConfig.Version, err) } diff --git a/cmd/config-versions.go b/cmd/config-versions.go index ac5a8113e..e1c25db31 100644 --- a/cmd/config-versions.go +++ b/cmd/config-versions.go @@ -603,8 +603,8 @@ type serverConfigV23 struct { Notify notifier `json:"notify"` } -// serverConfigV24 is just like version '23' with addition of usage interval -// field. +// serverConfigV24 is just like version '23', we had to revert +// the changes which were made in 6fb06045028b7a57c37c60a612c8e50735279ab4 // // IMPORTANT NOTE: When updating this struct make sure that // serverConfig.ConfigDiff() is updated as necessary. @@ -623,9 +623,6 @@ type serverConfigV24 struct { // Cache configuration Cache CacheConfig `json:"cache"` - // Usage configuration - Usage usageConfig `json:"usage"` - // Notification queue configuration. Notify notifier `json:"notify"` } diff --git a/cmd/disk-usage.go b/cmd/disk-usage.go index 4ef6e94f2..f120273f9 100644 --- a/cmd/disk-usage.go +++ b/cmd/disk-usage.go @@ -18,56 +18,8 @@ package cmd import ( "context" - "encoding/json" - "fmt" - "time" ) -// Captures configurable parameters of usage check. -type usageConfig struct { - UsageCheckInterval time.Duration -} - -// MarshalJSON - encodes to JSON data. -func (u usageConfig) MarshalJSON() ([]byte, error) { - type _usageConfig struct { - UsageCheckInterval string `json:"interval"` - } - return json.Marshal(_usageConfig{u.UsageCheckInterval.String()}) -} - -// parseDuration - parse duration string -func parseDuration(dStr string) (time.Duration, error) { - d, err := time.ParseDuration(dStr) - if err != nil { - return d, err - } - if d < globalMinimumUsageCheckInterval { - return d, fmt.Errorf("interval %s is not allowed, minimum required value is %s", - d, globalMinimumUsageCheckInterval) - } - return d, nil -} - -// UnmarshalJSON - decodes JSON data. -func (u *usageConfig) UnmarshalJSON(data []byte) error { - type _usageConfig struct { - UsageCheckInterval string `json:"interval"` - } - var u1 = _usageConfig{} - if err := json.Unmarshal(data, &u1); err != nil { - return err - } - if !globalIsEnvUsageCheck { - d, err := parseDuration(u1.UsageCheckInterval) - if err != nil { - return err - } - u.UsageCheckInterval = d - } - return nil -} - // getDiskUsage walks the file tree rooted at root, calling usageFn // for each file or directory in the tree, including root. func getDiskUsage(ctx context.Context, root string, usageFn usageFunc) error { diff --git a/cmd/globals.go b/cmd/globals.go index c4005d071..7a8f5414e 100644 --- a/cmd/globals.go +++ b/cmd/globals.go @@ -188,14 +188,10 @@ var ( globalCacheExpiry = 90 // Add new variable global values here. - // Minimum required usage check interval value. - globalMinimumUsageCheckInterval = 2 * time.Hour // 2 hours // Default usage check interval value. globalDefaultUsageCheckInterval = 12 * time.Hour // 12 hours // Usage check interval value. globalUsageCheckInterval = globalDefaultUsageCheckInterval - // Is env usage check interval set. - globalIsEnvUsageCheck bool ) // global colors. diff --git a/cmd/ui-errors.go b/cmd/ui-errors.go index 69ec0e09c..194e5998e 100644 --- a/cmd/ui-errors.go +++ b/cmd/ui-errors.go @@ -47,15 +47,6 @@ var ( "MINIO_CACHE_EXPIRY: Valid cache expiry duration is in days.", ) - uiErrInvalidUsageCheckIntervalValue = newUIErrFn( - "Invalid usage check interval value", - "Please check the passed value", - `MINIO_USAGE_CHECK_INTERVAL: Valid usage check interval duration string is a signed sequence of decimal numbers, - each with optional fraction and a unit suffix, such as "2h45m". Valid time units are "ns", "us", "ms", "s", "m", "h". - Minimum supported value is '2h'. -`, - ) - uiErrInvalidCredentials = newUIErrFn( "Invalid credentials", "Please provide correct credentials", diff --git a/docs/config/README.md b/docs/config/README.md index 84f23780d..fd2392367 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -99,18 +99,6 @@ By default, parity for objects with standard storage class is set to `N/2`, and |``exclude`` | _[]string_ | List of wildcard patterns for prefixes to exclude from cache | |``expiry`` | _int_ | Days to cache expiry | -### Usage -|Field|Type|Description| -|:---|:---|:---| -|``interval``| _string_ | Valid usage check interval duration string is a signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "2h45m". Valid time units are "ns", "us", "ms", "s", "m", "h". Minimum supported value is '2h'.| - -Example: Run usage check every 4 hours 3 minutes 10 seconds. - -```sh -export MINIO_USAGE_CHECK_INTERVAL="4h3m10s" -minio server /data -``` - #### Notify |Field|Type|Description| |:---|:---|:---|