mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
scanner: Add a config to disable short sleep between objects scan (#18734)
Add a hidden configuration under the scanner sub section to configure if the scanner should sleep between two objects scan. The configuration has only effect when there is no drive activity related to s3 requests or healing. By default, the code will keep the current behavior which is doing sleep between objects. To forcefully enable the full scan speed in idle mode, you can do this: `mc admin config set myminio scanner idle_speed=full`
This commit is contained in:
@@ -31,6 +31,9 @@ const (
|
||||
Speed = "speed"
|
||||
EnvSpeed = "MINIO_SCANNER_SPEED"
|
||||
|
||||
IdleSpeed = "idle_speed"
|
||||
EnvIdleSpeed = "MINIO_SCANNER_IDLE_SPEED"
|
||||
|
||||
// All below are deprecated in October 2022 and
|
||||
// replaced them with a single speed parameter
|
||||
Delay = "delay"
|
||||
@@ -47,6 +50,8 @@ const (
|
||||
type Config struct {
|
||||
// Delay is the sleep multiplier.
|
||||
Delay float64 `json:"delay"`
|
||||
// Behavior of the scanner when there is no other parallel S3 requests
|
||||
IdleMode int32 // 0 => throttling, 1 => full speed
|
||||
// MaxWait is maximum wait time between operations
|
||||
MaxWait time.Duration
|
||||
// Cycle is the time.Duration between each scanner cycles
|
||||
@@ -59,23 +64,28 @@ var DefaultKVS = config.KVS{
|
||||
Key: Speed,
|
||||
Value: "default",
|
||||
},
|
||||
// Deprecated Oct 2022
|
||||
config.KV{
|
||||
Key: Delay,
|
||||
Value: "",
|
||||
Deprecated: true,
|
||||
Key: IdleSpeed,
|
||||
Value: "",
|
||||
HiddenIfEmpty: true,
|
||||
},
|
||||
// Deprecated Oct 2022
|
||||
config.KV{
|
||||
Key: MaxWait,
|
||||
Value: "",
|
||||
Deprecated: true,
|
||||
Key: Delay,
|
||||
Value: "",
|
||||
HiddenIfEmpty: true,
|
||||
},
|
||||
// Deprecated Oct 2022
|
||||
config.KV{
|
||||
Key: Cycle,
|
||||
Value: "",
|
||||
Deprecated: true,
|
||||
Key: MaxWait,
|
||||
Value: "",
|
||||
HiddenIfEmpty: true,
|
||||
},
|
||||
// Deprecated Oct 2022
|
||||
config.KV{
|
||||
Key: Cycle,
|
||||
Value: "",
|
||||
HiddenIfEmpty: true,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -107,6 +117,16 @@ func LookupConfig(kvs config.KVS) (cfg Config, err error) {
|
||||
default:
|
||||
return cfg, fmt.Errorf("unknown '%s' value", speed)
|
||||
}
|
||||
|
||||
switch idleSpeed := env.Get(EnvIdleSpeed, kvs.GetWithDefault(IdleSpeed, DefaultKVS)); idleSpeed {
|
||||
case "", "throttled": // Empty is the default mode;
|
||||
cfg.IdleMode = 0
|
||||
case "full":
|
||||
cfg.IdleMode = 1
|
||||
default:
|
||||
return cfg, fmt.Errorf("unknown value: '%s'", idleSpeed)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user