mirror of
https://github.com/minio/minio.git
synced 2025-11-06 20:33:07 -05:00
fix: allow DeleteObject unversioned objects with insufficient read quorum (#19581)
Since the object is being permanently deleted, the lack of read quorum should not matter as long as sufficient disks are online to complete the deletion with parity requirements. If several pools have the same object with insufficient read quorum, attempt to delete object from all the pools where it exists
This commit is contained in:
@@ -27,13 +27,13 @@ import (
|
||||
// Converts underlying storage error. Convenience function written to
|
||||
// handle all cases where we have known types of errors returned by
|
||||
// underlying storage layer.
|
||||
func toObjectErr(err error, params ...string) error {
|
||||
if err == nil {
|
||||
func toObjectErr(oerr error, params ...string) error {
|
||||
if oerr == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Unwarp the error first
|
||||
err = unwrapAll(err)
|
||||
err := unwrapAll(oerr)
|
||||
|
||||
if err == context.Canceled {
|
||||
return context.Canceled
|
||||
@@ -157,6 +157,9 @@ func toObjectErr(err error, params ...string) error {
|
||||
if len(params) >= 2 {
|
||||
apiErr.Object = decodeDirObject(params[1])
|
||||
}
|
||||
if v, ok := oerr.(InsufficientReadQuorum); ok {
|
||||
apiErr.Type = v.Type
|
||||
}
|
||||
return apiErr
|
||||
case errErasureWriteQuorum.Error():
|
||||
apiErr := InsufficientWriteQuorum{}
|
||||
@@ -201,8 +204,34 @@ func (e SlowDown) Error() string {
|
||||
return "Please reduce your request rate"
|
||||
}
|
||||
|
||||
// RQErrType reason for read quorum error.
|
||||
type RQErrType int
|
||||
|
||||
const (
|
||||
// RQInsufficientOnlineDrives - not enough online drives.
|
||||
RQInsufficientOnlineDrives RQErrType = 1 << iota
|
||||
// RQInconsistentMeta - inconsistent metadata.
|
||||
RQInconsistentMeta
|
||||
)
|
||||
|
||||
func (t RQErrType) String() string {
|
||||
switch t {
|
||||
case RQInsufficientOnlineDrives:
|
||||
return "InsufficientOnlineDrives"
|
||||
case RQInconsistentMeta:
|
||||
return "InconsistentMeta"
|
||||
default:
|
||||
return "Unknown"
|
||||
}
|
||||
}
|
||||
|
||||
// InsufficientReadQuorum storage cannot satisfy quorum for read operation.
|
||||
type InsufficientReadQuorum GenericError
|
||||
type InsufficientReadQuorum struct {
|
||||
Bucket string
|
||||
Object string
|
||||
Err error
|
||||
Type RQErrType
|
||||
}
|
||||
|
||||
func (e InsufficientReadQuorum) Error() string {
|
||||
return "Storage resources are insufficient for the read operation " + e.Bucket + "/" + e.Object
|
||||
|
||||
Reference in New Issue
Block a user