mirror of
https://github.com/minio/minio.git
synced 2025-11-06 20:33:07 -05:00
Prevent overwrites due to rebalance-stop race (#20233)
Rebalance-stop can race with ongoing rebalance operations. This change prevents these operations from overwriting objects by checking the source and destination pool indices are different.
This commit is contained in:
committed by
GitHub
parent
49055658a9
commit
4e67a4027e
@@ -788,3 +788,20 @@ func isReplicationPermissionCheck(err error) bool {
|
||||
_, ok := err.(ReplicationPermissionCheck)
|
||||
return ok
|
||||
}
|
||||
|
||||
// DataMovementOverwriteErr - captures the error when a data movement activity
|
||||
// like rebalance incorrectly tries to overwrite an object.
|
||||
type DataMovementOverwriteErr GenericError
|
||||
|
||||
func (de DataMovementOverwriteErr) Error() string {
|
||||
objInfoStr := fmt.Sprintf("bucket=%s object=%s", de.Bucket, de.Object)
|
||||
if de.VersionID != "" {
|
||||
objInfoStr = fmt.Sprintf("%s version-id=%s", objInfoStr, de.VersionID)
|
||||
}
|
||||
return fmt.Sprintf("invalid data movement operation, source and destination pool are the same for %s", objInfoStr)
|
||||
}
|
||||
|
||||
func isDataMovementOverWriteErr(err error) bool {
|
||||
var de DataMovementOverwriteErr
|
||||
return errors.As(err, &de)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user