mirror of
https://github.com/minio/minio.git
synced 2025-01-12 07:23:23 -05:00
fix: cluster healthcheck for single drive setups (#15415)
single drive setups must return '200 OK' if drive is accessible, current master returns '503'
This commit is contained in:
parent
cbd70d26b5
commit
aff236e20e
@ -3092,6 +3092,33 @@ func (es *erasureSingle) Walk(ctx context.Context, bucket, prefix string, result
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Health - returns current status of the object layer health, for single drive
|
||||||
|
// its as simple as returning healthy as long as drive is accessible.
|
||||||
|
func (es *erasureSingle) Health(ctx context.Context, opts HealthOptions) HealthResult {
|
||||||
|
_, err := es.disk.DiskInfo(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return HealthResult{}
|
||||||
|
}
|
||||||
|
if opts.Maintenance {
|
||||||
|
// Single drive cannot be put under maintenance.
|
||||||
|
return HealthResult{
|
||||||
|
Healthy: false,
|
||||||
|
WriteQuorum: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return HealthResult{
|
||||||
|
Healthy: true,
|
||||||
|
WriteQuorum: 1,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ReadHealth - returns current status of the object layer health for reads,
|
||||||
|
// for single drive its as simple as returning healthy as long as drive is accessible.
|
||||||
|
func (es *erasureSingle) ReadHealth(ctx context.Context) bool {
|
||||||
|
res := es.Health(ctx, HealthOptions{})
|
||||||
|
return res.Healthy
|
||||||
|
}
|
||||||
|
|
||||||
// nsScanner will start scanning buckets and send updated totals as they are traversed.
|
// nsScanner will start scanning buckets and send updated totals as they are traversed.
|
||||||
// Updates are sent on a regular basis and the caller *must* consume them.
|
// Updates are sent on a regular basis and the caller *must* consume them.
|
||||||
func (es *erasureSingle) nsScanner(ctx context.Context, buckets []BucketInfo, bf *bloomFilter, wantCycle uint32, updates chan<- dataUsageCache, healScanMode madmin.HealScanMode) error {
|
func (es *erasureSingle) nsScanner(ctx context.Context, buckets []BucketInfo, bf *bloomFilter, wantCycle uint32, updates chan<- dataUsageCache, healScanMode madmin.HealScanMode) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user