From b3edb25377750b7ec67381b55cfcf3818596a482 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Wed, 3 Aug 2022 00:57:39 +0100 Subject: [PATCH] bloom: healObject to mark a path dirty only for dangling objects (#15458) The path is marked dirty automatically when healObject() is called, which is wrong. HealObject() is called during self-healing and this will lead to an increase in the false positive result of the bloom filter. Also move NSUpdated() from renameData() and call it directly in CompleteMultipart and PutObject, this is not a functional change but it will make it less prone to errors in the future. --- cmd/erasure-healing.go | 4 ---- cmd/erasure-multipart.go | 2 ++ cmd/erasure-object.go | 4 ++-- cmd/erasure-single-drive.go | 4 ++++ 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cmd/erasure-healing.go b/cmd/erasure-healing.go index 0ce0850cc..43c307898 100644 --- a/cmd/erasure-healing.go +++ b/cmd/erasure-healing.go @@ -275,10 +275,6 @@ func shouldHealObjectOnDisk(erErr, dataErr error, meta FileInfo, latestMeta File // Heals an object by re-writing corrupt/missing erasure blocks. func (er erasureObjects) healObject(ctx context.Context, bucket string, object string, versionID string, opts madmin.HealOpts) (result madmin.HealResultItem, err error) { - if !opts.DryRun { - defer NSUpdated(bucket, object) - } - dryRun := opts.DryRun scanMode := opts.ScanMode diff --git a/cmd/erasure-multipart.go b/cmd/erasure-multipart.go index 179259ac2..53c29dba7 100644 --- a/cmd/erasure-multipart.go +++ b/cmd/erasure-multipart.go @@ -1159,6 +1159,8 @@ func (er erasureObjects) CompleteMultipartUpload(ctx context.Context, bucket str return oi, toObjectErr(err, bucket, object) } + defer NSUpdated(bucket, object) + // Check if there is any offline disk and add it to the MRF list for _, disk := range onlineDisks { if disk != nil && disk.IsOnline() { diff --git a/cmd/erasure-object.go b/cmd/erasure-object.go index 8b15870e1..e9ee3cddb 100644 --- a/cmd/erasure-object.go +++ b/cmd/erasure-object.go @@ -686,8 +686,6 @@ func (er erasureObjects) getObjectInfoAndQuorum(ctx context.Context, bucket, obj // Similar to rename but renames data from srcEntry to dstEntry at dataDir func renameData(ctx context.Context, disks []StorageAPI, srcBucket, srcEntry string, metadata []FileInfo, dstBucket, dstEntry string, writeQuorum int) ([]StorageAPI, error) { - defer NSUpdated(dstBucket, dstEntry) - g := errgroup.WithNErrs(len(disks)) fvID := mustGetUUID() @@ -1140,6 +1138,8 @@ func (er erasureObjects) putObject(ctx context.Context, bucket string, object st return ObjectInfo{}, toObjectErr(err, bucket, object) } + defer NSUpdated(bucket, object) + for i := 0; i < len(onlineDisks); i++ { if onlineDisks[i] != nil && onlineDisks[i].IsOnline() { // Object info is the same in all disks, so we can pick diff --git a/cmd/erasure-single-drive.go b/cmd/erasure-single-drive.go index ae96686e5..a3f0ad3fe 100644 --- a/cmd/erasure-single-drive.go +++ b/cmd/erasure-single-drive.go @@ -1203,6 +1203,8 @@ func (es *erasureSingle) putObject(ctx context.Context, bucket string, object st return ObjectInfo{}, toObjectErr(err, bucket, object) } + defer NSUpdated(bucket, object) + for i := 0; i < len(onlineDisks); i++ { if onlineDisks[i] != nil && onlineDisks[i].IsOnline() { // Object info is the same in all disks, so we can pick @@ -2804,6 +2806,8 @@ func (es *erasureSingle) CompleteMultipartUpload(ctx context.Context, bucket str return oi, toObjectErr(err, bucket, object) } + defer NSUpdated(bucket, object) + for i := 0; i < len(onlineDisks); i++ { if onlineDisks[i] != nil && onlineDisks[i].IsOnline() { // Object info is the same in all disks, so we can pick