From 35dc64bd7b29dbdb1ae51428096f080d22ecee1b Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 26 Jul 2023 16:02:08 +0300 Subject: [PATCH] [#547] metabase: Fix datarace in tests Quite an old one bf9e938a3b2829199. Signed-off-by: Evgenii Stratonikov --- pkg/local_object_storage/metabase/put.go | 1 + pkg/local_object_storage/metabase/select.go | 1 + pkg/local_object_storage/metabase/util.go | 2 -- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/local_object_storage/metabase/put.go b/pkg/local_object_storage/metabase/put.go index 7a24485b3..28f12851f 100644 --- a/pkg/local_object_storage/metabase/put.go +++ b/pkg/local_object_storage/metabase/put.go @@ -111,6 +111,7 @@ func (db *DB) put(tx *bbolt.Tx, exists, err := db.exists(tx, objectCore.AddressOf(obj), currEpoch) + var splitInfoError *objectSDK.SplitInfoError if errors.As(err, &splitInfoError) { exists = true // object exists, however it is virtual } else if err != nil { diff --git a/pkg/local_object_storage/metabase/select.go b/pkg/local_object_storage/metabase/select.go index 6a7acd7cc..8b086a89f 100644 --- a/pkg/local_object_storage/metabase/select.go +++ b/pkg/local_object_storage/metabase/select.go @@ -427,6 +427,7 @@ func (db *DB) selectObjectID( addr.SetContainer(cnr) addr.SetObject(id) + var splitInfoError *objectSDK.SplitInfoError ok, err := db.exists(tx, addr, currEpoch) if (err == nil && ok) || errors.As(err, &splitInfoError) { raw := make([]byte, objectKeySize) diff --git a/pkg/local_object_storage/metabase/util.go b/pkg/local_object_storage/metabase/util.go index 4e58ec20b..c9d9bb947 100644 --- a/pkg/local_object_storage/metabase/util.go +++ b/pkg/local_object_storage/metabase/util.go @@ -120,8 +120,6 @@ const ( addressKeySize = cidSize + objectKeySize ) -var splitInfoError *objectSDK.SplitInfoError // for errors.As comparisons - func bucketName(cnr cid.ID, prefix byte, key []byte) []byte { key[0] = prefix cnr.Encode(key[1:])