mirror of
https://github.com/pgsty/minio.git
synced 2026-07-22 05:30:24 +03: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:
@@ -600,6 +600,7 @@ func applyDynamicConfigForSubSys(ctx context.Context, objAPI ObjectLayer, s conf
|
||||
return fmt.Errorf("Unable to apply scanner config: %w", err)
|
||||
}
|
||||
// update dynamic scanner values.
|
||||
scannerIdleMode.Store(scannerCfg.IdleMode)
|
||||
scannerCycle.Store(scannerCfg.Cycle)
|
||||
logger.LogIf(ctx, scannerSleeper.Update(scannerCfg.Delay, scannerCfg.MaxWait))
|
||||
case config.LoggerWebhookSubSys:
|
||||
|
||||
+3
-2
@@ -65,8 +65,9 @@ var (
|
||||
globalHealConfig heal.Config
|
||||
|
||||
// Sleeper values are updated when config is loaded.
|
||||
scannerSleeper = newDynamicSleeper(2, time.Second, true) // Keep defaults same as config defaults
|
||||
scannerCycle = uatomic.NewDuration(dataScannerStartDelay)
|
||||
scannerSleeper = newDynamicSleeper(2, time.Second, true) // Keep defaults same as config defaults
|
||||
scannerCycle = uatomic.NewDuration(dataScannerStartDelay)
|
||||
scannerIdleMode = uatomic.NewInt32(0) // default is throttled when idle
|
||||
)
|
||||
|
||||
// initDataScanner will start the scanner in the background.
|
||||
|
||||
@@ -286,8 +286,7 @@ func (p *xlStorageDiskIDCheck) NSScanner(ctx context.Context, cache dataUsageCac
|
||||
}
|
||||
|
||||
weSleep := func() bool {
|
||||
// Entire queue is full, so we sleep.
|
||||
return cap(p.health.tokens) == len(p.health.tokens)
|
||||
return scannerIdleMode.Load() == 0
|
||||
}
|
||||
|
||||
return p.storage.NSScanner(ctx, cache, updates, scanMode, weSleep)
|
||||
|
||||
Reference in New Issue
Block a user