[#547] metabase: Fix datarace in tests
All checks were successful
Build / Build Components (1.19) (pull_request) Successful in 5m8s
Build / Build Components (1.20) (pull_request) Successful in 3m46s
Tests and linters / Tests (1.19) (pull_request) Successful in 4m39s
Tests and linters / Tests (1.20) (pull_request) Successful in 3m41s
Tests and linters / Tests with -race (pull_request) Successful in 5m46s
Vulncheck / Vulncheck (pull_request) Successful in 5m23s
Tests and linters / Staticcheck (pull_request) Successful in 17m26s
Tests and linters / Lint (pull_request) Successful in 1m58s

Quite an old one bf9e938a3b.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-07-26 16:02:08 +03:00
parent c5b015a9ad
commit e1141c2456
3 changed files with 2 additions and 2 deletions

View file

@ -111,6 +111,7 @@ func (db *DB) put(tx *bbolt.Tx,
exists, err := db.exists(tx, objectCore.AddressOf(obj), currEpoch) exists, err := db.exists(tx, objectCore.AddressOf(obj), currEpoch)
var splitInfoError *objectSDK.SplitInfoError
if errors.As(err, &splitInfoError) { if errors.As(err, &splitInfoError) {
exists = true // object exists, however it is virtual exists = true // object exists, however it is virtual
} else if err != nil { } else if err != nil {

View file

@ -427,6 +427,7 @@ func (db *DB) selectObjectID(
addr.SetContainer(cnr) addr.SetContainer(cnr)
addr.SetObject(id) addr.SetObject(id)
var splitInfoError *objectSDK.SplitInfoError
ok, err := db.exists(tx, addr, currEpoch) ok, err := db.exists(tx, addr, currEpoch)
if (err == nil && ok) || errors.As(err, &splitInfoError) { if (err == nil && ok) || errors.As(err, &splitInfoError) {
raw := make([]byte, objectKeySize) raw := make([]byte, objectKeySize)

View file

@ -120,8 +120,6 @@ const (
addressKeySize = cidSize + objectKeySize addressKeySize = cidSize + objectKeySize
) )
var splitInfoError *objectSDK.SplitInfoError // for errors.As comparisons
func bucketName(cnr cid.ID, prefix byte, key []byte) []byte { func bucketName(cnr cid.ID, prefix byte, key []byte) []byte {
key[0] = prefix key[0] = prefix
cnr.Encode(key[1:]) cnr.Encode(key[1:])