mirror of
https://github.com/minio/minio.git
synced 2025-02-27 21:39:15 -05:00
fix: do not heal when disks are down (#12186)
HeadObject() was erroneously attempting a heal when disks are down, avoid it.
This commit is contained in:
parent
b3c8a1864f
commit
336c8ac99f
@ -433,6 +433,12 @@ func (er erasureObjects) getObjectFileInfo(ctx context.Context, bucket, object s
|
|||||||
return fi, nil, nil, err
|
return fi, nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if one of the disk is offline, return right here no need
|
||||||
|
// to attempt a heal on the object.
|
||||||
|
if countErrs(errs, errDiskNotFound) > 0 {
|
||||||
|
return fi, metaArr, onlineDisks, nil
|
||||||
|
}
|
||||||
|
|
||||||
var missingBlocks int
|
var missingBlocks int
|
||||||
for i, err := range errs {
|
for i, err := range errs {
|
||||||
if err != nil && errors.Is(err, errFileNotFound) {
|
if err != nil && errors.Is(err, errFileNotFound) {
|
||||||
|
@ -238,6 +238,14 @@ func (client *storageRESTClient) SetDiskID(id string) {
|
|||||||
|
|
||||||
// DiskInfo - fetch disk information for a remote disk.
|
// DiskInfo - fetch disk information for a remote disk.
|
||||||
func (client *storageRESTClient) DiskInfo(ctx context.Context) (info DiskInfo, err error) {
|
func (client *storageRESTClient) DiskInfo(ctx context.Context) (info DiskInfo, err error) {
|
||||||
|
if !client.IsOnline() {
|
||||||
|
// make sure to check if the disk is offline, since the underlying
|
||||||
|
// value is cached we should attempt to invalidate it if such calls
|
||||||
|
// were attempted. This can lead to false success under certain conditions
|
||||||
|
// - this change attempts to avoid stale information if the underlying
|
||||||
|
// transport is already down.
|
||||||
|
return info, errDiskNotFound
|
||||||
|
}
|
||||||
client.diskInfoCache.Once.Do(func() {
|
client.diskInfoCache.Once.Do(func() {
|
||||||
client.diskInfoCache.TTL = time.Second
|
client.diskInfoCache.TTL = time.Second
|
||||||
client.diskInfoCache.Update = func() (interface{}, error) {
|
client.diskInfoCache.Update = func() (interface{}, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user