DiskInfo() must return errDiskNotFound not internal errors (#18514)

This commit is contained in:
Harshavardhana 2023-11-24 09:07:14 -08:00 committed by GitHub
parent fbc6f3f6e8
commit 9032f49f25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 5 deletions

View File

@ -31,7 +31,6 @@ import (
"github.com/minio/minio/internal/color"
"github.com/minio/minio/internal/config"
"github.com/minio/minio/internal/config/storageclass"
"github.com/minio/minio/internal/grid"
xioutil "github.com/minio/minio/internal/ioutil"
"github.com/minio/minio/internal/logger"
"github.com/minio/pkg/v2/sync/errgroup"
@ -391,7 +390,7 @@ func saveFormatErasure(disk StorageAPI, format *formatErasureV3, healID string)
func loadFormatErasure(disk StorageAPI) (format *formatErasureV3, err error) {
// Ensure that the grid is online.
if _, err := disk.DiskInfo(context.Background(), false); err != nil {
if errors.Is(err, grid.ErrDisconnected) {
if errors.Is(err, errDiskNotFound) {
return nil, err
}
}

View File

@ -23,7 +23,6 @@ import (
"github.com/minio/minio/internal/dsync"
"github.com/minio/minio/internal/grid"
"github.com/minio/minio/internal/logger"
)
// lockRESTClient is authenticable lock REST client
@ -54,7 +53,6 @@ func (c *lockRESTClient) String() string {
func (c *lockRESTClient) call(ctx context.Context, h *grid.SingleHandler[*dsync.LockArgs, *dsync.LockResp], args *dsync.LockArgs) (ok bool, err error) {
r, err := h.Call(ctx, c.connection, args)
if err != nil {
logger.LogIfNot(ctx, err, grid.ErrDisconnected)
return false, err
}
defer h.PutResponse(r)

View File

@ -270,7 +270,7 @@ func (client *storageRESTClient) DiskInfo(ctx context.Context, metrics bool) (in
// 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, grid.ErrDisconnected
return info, errDiskNotFound
}
fetchDI := func(di *timedValue, metrics bool) {
di.TTL = time.Second