mirror of
https://github.com/minio/minio.git
synced 2025-04-27 05:15:01 -04:00
heal: Add more per disk healing result in the audit (#19427)
HealObject() does not return an error in some cases, for example, when an object is successfully reconstructed in one disk but fails with other disks, another case is when a disk does not have the object is temporarily disconnected Add the After heal drives result in the audit output for better analysis.
This commit is contained in:
parent
c957e0d426
commit
f06fee0364
@ -216,7 +216,7 @@ func (fi FileInfo) DataMov() bool {
|
|||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
func auditHealObject(ctx context.Context, bucket, object, versionID string, err error) {
|
func auditHealObject(ctx context.Context, bucket, object, versionID string, result madmin.HealResultItem, err error) {
|
||||||
if len(logger.AuditTargets()) == 0 {
|
if len(logger.AuditTargets()) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -231,6 +231,10 @@ func auditHealObject(ctx context.Context, bucket, object, versionID string, err
|
|||||||
opts.Error = err.Error()
|
opts.Error = err.Error()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if result.After.Drives != nil {
|
||||||
|
opts.Tags = map[string]interface{}{"drives-result": result.After.Drives}
|
||||||
|
}
|
||||||
|
|
||||||
auditLogInternal(ctx, opts)
|
auditLogInternal(ctx, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +246,9 @@ func (er *erasureObjects) healObject(ctx context.Context, bucket string, object
|
|||||||
storageDisks := er.getDisks()
|
storageDisks := er.getDisks()
|
||||||
storageEndpoints := er.getEndpoints()
|
storageEndpoints := er.getEndpoints()
|
||||||
|
|
||||||
defer auditHealObject(ctx, bucket, object, versionID, err)
|
defer func() {
|
||||||
|
auditHealObject(ctx, bucket, object, versionID, result, err)
|
||||||
|
}()
|
||||||
|
|
||||||
if globalTrace.NumSubscribers(madmin.TraceHealing) > 0 {
|
if globalTrace.NumSubscribers(madmin.TraceHealing) > 0 {
|
||||||
startTime := time.Now()
|
startTime := time.Now()
|
||||||
@ -365,21 +371,6 @@ func (er *erasureObjects) healObject(ctx context.Context, bucket string, object
|
|||||||
driveState = madmin.DriveStateCorrupt
|
driveState = madmin.DriveStateCorrupt
|
||||||
}
|
}
|
||||||
|
|
||||||
if shouldHealObjectOnDisk(errs[i], dataErrs[i], partsMetadata[i], latestMeta) {
|
|
||||||
outDatedDisks[i] = storageDisks[i]
|
|
||||||
disksToHealCount++
|
|
||||||
result.Before.Drives = append(result.Before.Drives, madmin.HealDriveInfo{
|
|
||||||
UUID: "",
|
|
||||||
Endpoint: storageEndpoints[i].String(),
|
|
||||||
State: driveState,
|
|
||||||
})
|
|
||||||
result.After.Drives = append(result.After.Drives, madmin.HealDriveInfo{
|
|
||||||
UUID: "",
|
|
||||||
Endpoint: storageEndpoints[i].String(),
|
|
||||||
State: driveState,
|
|
||||||
})
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
result.Before.Drives = append(result.Before.Drives, madmin.HealDriveInfo{
|
result.Before.Drives = append(result.Before.Drives, madmin.HealDriveInfo{
|
||||||
UUID: "",
|
UUID: "",
|
||||||
Endpoint: storageEndpoints[i].String(),
|
Endpoint: storageEndpoints[i].String(),
|
||||||
@ -390,6 +381,12 @@ func (er *erasureObjects) healObject(ctx context.Context, bucket string, object
|
|||||||
Endpoint: storageEndpoints[i].String(),
|
Endpoint: storageEndpoints[i].String(),
|
||||||
State: driveState,
|
State: driveState,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if shouldHealObjectOnDisk(errs[i], dataErrs[i], partsMetadata[i], latestMeta) {
|
||||||
|
outDatedDisks[i] = storageDisks[i]
|
||||||
|
disksToHealCount++
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if isAllNotFound(errs) {
|
if isAllNotFound(errs) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user