mirror of
https://github.com/minio/minio.git
synced 2026-02-04 18:00:15 -05:00
fix: make sure to correctly initialize health checks (#17765)
health checks were missing for drives replaced since - HealFormat() would replace the drives without a health check - disconnected drives when they reconnect via connectEndpoint() the loop also loses health checks for local disks and merges these into a single code. - other than this separate cleanUp, health check variables to avoid overloading them with similar requirements. - also ensure that we compete via context selector for disk monitoring such that the canceled disks don't linger around longer waiting for the ticker to trigger. - allow disabling active monitoring.
This commit is contained in:
@@ -55,15 +55,20 @@ var globalObjectAPI ObjectLayer
|
||||
// Global cacheObjects, only accessed by newCacheObjectsFn().
|
||||
var globalCacheObjectAPI CacheObjectLayer
|
||||
|
||||
type storageOpts struct {
|
||||
cleanUp bool
|
||||
healthCheck bool
|
||||
}
|
||||
|
||||
// Depending on the disk type network or local, initialize storage API.
|
||||
func newStorageAPI(endpoint Endpoint, healthCheck bool) (storage StorageAPI, err error) {
|
||||
func newStorageAPI(endpoint Endpoint, opts storageOpts) (storage StorageAPI, err error) {
|
||||
if endpoint.IsLocal {
|
||||
storage, err := newXLStorage(endpoint, healthCheck)
|
||||
storage, err := newXLStorage(endpoint, opts.cleanUp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return newXLStorageDiskIDCheck(storage, healthCheck), nil
|
||||
return newXLStorageDiskIDCheck(storage, opts.healthCheck), nil
|
||||
}
|
||||
|
||||
return newStorageRESTClient(endpoint, healthCheck), nil
|
||||
return newStorageRESTClient(endpoint, opts.healthCheck), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user