mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
allow service freeze/unfreeze on a setup (#13707)
an active running speedTest will reject all new S3 requests to the server, until speedTest is complete. this is to ensure that speedTest results are accurate and trusted. Co-authored-by: Klaus Post <klauspost@gmail.com>
This commit is contained in:
@@ -1501,6 +1501,37 @@ func (sys *NotificationSys) GetClusterMetrics(ctx context.Context) chan Metric {
|
||||
return ch
|
||||
}
|
||||
|
||||
// ServiceFreeze freezes all S3 API calls when 'freeze' is true,
|
||||
// 'freeze' is 'false' would resume all S3 API calls again.
|
||||
// NOTE: once a tenant is frozen either two things needs to
|
||||
// happen before resuming normal operations.
|
||||
// - Server needs to be restarted 'mc admin service restart'
|
||||
// - 'freeze' should be set to 'false' for this call
|
||||
// to resume normal operations.
|
||||
func (sys *NotificationSys) ServiceFreeze(ctx context.Context, freeze bool) []NotificationPeerErr {
|
||||
serviceSig := serviceUnFreeze
|
||||
if freeze {
|
||||
serviceSig = serviceFreeze
|
||||
}
|
||||
ng := WithNPeers(len(sys.peerClients))
|
||||
for idx, client := range sys.peerClients {
|
||||
if client == nil {
|
||||
continue
|
||||
}
|
||||
client := client
|
||||
ng.Go(GlobalContext, func() error {
|
||||
return client.SignalService(serviceSig)
|
||||
}, idx, *client.host)
|
||||
}
|
||||
nerrs := ng.Wait()
|
||||
if freeze {
|
||||
freezeServices()
|
||||
} else {
|
||||
unfreezeServices()
|
||||
}
|
||||
return nerrs
|
||||
}
|
||||
|
||||
// Speedtest run GET/PUT tests at input concurrency for requested object size,
|
||||
// optionally you can extend the tests longer with time.Duration.
|
||||
func (sys *NotificationSys) Speedtest(ctx context.Context, size int, concurrent int, duration time.Duration) []SpeedtestResult {
|
||||
|
||||
Reference in New Issue
Block a user