Couldn't get object that was just created #915

Closed
opened 2024-01-16 14:41:17 +00:00 by dkirillov · 0 comments
Member

Couldn't get object with object not found error.

Expected Behavior

Get object operation is success

Current Behavior

Error on get object:

get object via client s01.frostfs.devenv:8080: read header: status: code = 2049 message = object not found

Steps to Reproduce (for bugs)

Test should pass:

import (
	"bytes"
	"context"
	"testing"

	"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
	"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container"
	"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/acl"
	"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap"
	"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
	oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id"
	"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool"
	"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user"
	"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
	"github.com/stretchr/testify/require"
)

func TestGetObject(t *testing.T) {
	ctx := context.Background()

	key, err := keys.NewPrivateKeyFromWIF("KxDgvEKzgSBPPfuVfw67oPQBSjidEiqTHURKSDL1R7yGaGYAeYnr") // devenv key
	require.NoError(t, err)

	var prm pool.InitParameters
	prm.SetKey(&key.PrivateKey)
	prm.AddNode(pool.NewNodeParam(1, "s01.frostfs.devenv:8080", 1))

	p, err := pool.NewPool(prm)
	require.NoError(t, err)
	err = p.Dial(ctx)
	require.NoError(t, err)

	var pp netmap.PlacementPolicy
	err = pp.DecodeString("REP 1")
	require.NoError(t, err)

	var ownerID user.ID
	user.IDFromKey(&ownerID, key.PrivateKey.PublicKey)

	var cnr container.Container
	cnr.Init()
	cnr.SetPlacementPolicy(pp)
	cnr.SetOwner(ownerID)
	cnr.SetBasicACL(acl.PublicRWExtended)

	err = pool.SyncContainerWithNetwork(ctx, &cnr, p)
	require.NoError(t, err)

	prmPut := pool.PrmContainerPut{ClientParams: client.PrmContainerPut{Container: &cnr}}

	cnrID, err := p.PutContainer(ctx, prmPut)
	require.NoError(t, err)

	obj := object.New()
	obj.SetContainerID(cnrID)
	obj.SetOwnerID(&ownerID)

	var prmObjPut pool.PrmObjectPut
	prmObjPut.SetHeader(*obj)
	prmObjPut.SetPayload(bytes.NewBufferString("test payload"))

	objID, err := p.PutObject(ctx, prmObjPut)
	require.NoError(t, err)

	var addr oid.Address
	addr.SetContainer(cnrID)
	addr.SetObject(objID)

	var prmObjGet pool.PrmObjectGet
	prmObjGet.SetAddress(addr)

	_, err = p.GetObject(ctx, prmObjGet)
	require.NoError(t, err)
}

Context

In S3 we cannot resolve credentials that are stored in objects.

Regression

Yes. It seem the last commit broke existing functionality

Your Environment

  • Version used: storage node with master
  • Server setup and configuration: devenv
Couldn't get object with `object not found` error. ## Expected Behavior Get object operation is success ## Current Behavior Error on get object: ``` get object via client s01.frostfs.devenv:8080: read header: status: code = 2049 message = object not found ``` ## Steps to Reproduce (for bugs) Test should pass: ```golang import ( "bytes" "context" "testing" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/acl" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/pool" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/user" "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/stretchr/testify/require" ) func TestGetObject(t *testing.T) { ctx := context.Background() key, err := keys.NewPrivateKeyFromWIF("KxDgvEKzgSBPPfuVfw67oPQBSjidEiqTHURKSDL1R7yGaGYAeYnr") // devenv key require.NoError(t, err) var prm pool.InitParameters prm.SetKey(&key.PrivateKey) prm.AddNode(pool.NewNodeParam(1, "s01.frostfs.devenv:8080", 1)) p, err := pool.NewPool(prm) require.NoError(t, err) err = p.Dial(ctx) require.NoError(t, err) var pp netmap.PlacementPolicy err = pp.DecodeString("REP 1") require.NoError(t, err) var ownerID user.ID user.IDFromKey(&ownerID, key.PrivateKey.PublicKey) var cnr container.Container cnr.Init() cnr.SetPlacementPolicy(pp) cnr.SetOwner(ownerID) cnr.SetBasicACL(acl.PublicRWExtended) err = pool.SyncContainerWithNetwork(ctx, &cnr, p) require.NoError(t, err) prmPut := pool.PrmContainerPut{ClientParams: client.PrmContainerPut{Container: &cnr}} cnrID, err := p.PutContainer(ctx, prmPut) require.NoError(t, err) obj := object.New() obj.SetContainerID(cnrID) obj.SetOwnerID(&ownerID) var prmObjPut pool.PrmObjectPut prmObjPut.SetHeader(*obj) prmObjPut.SetPayload(bytes.NewBufferString("test payload")) objID, err := p.PutObject(ctx, prmObjPut) require.NoError(t, err) var addr oid.Address addr.SetContainer(cnrID) addr.SetObject(objID) var prmObjGet pool.PrmObjectGet prmObjGet.SetAddress(addr) _, err = p.GetObject(ctx, prmObjGet) require.NoError(t, err) } ``` ## Context In S3 we cannot resolve credentials that are stored in objects. ## Regression Yes. It seem the [last commit](https://git.frostfs.info/TrueCloudLab/frostfs-node/commit/c8baf76fae5e0bedd49d66fcd8fe003996766f49) broke existing functionality ## Your Environment <!-- Include as many relevant details about the environment you experienced the bug in --> * Version used: storage node with [master](https://git.frostfs.info/TrueCloudLab/frostfs-node/commit/c8baf76fae5e0bedd49d66fcd8fe003996766f49) * Server setup and configuration: devenv
dkirillov added the
bug
triage
labels 2024-01-16 14:41:17 +00:00
dstepanov-yadro was assigned by fyrchik 2024-01-16 15:45:56 +00:00
fyrchik added
P0
and removed
triage
labels 2024-01-16 15:46:03 +00:00
dstepanov-yadro was unassigned by fyrchik 2024-01-16 15:46:26 +00:00
aarifullin was assigned by fyrchik 2024-01-16 15:46:27 +00:00
fyrchik added the
frostfs-node
label 2024-01-16 15:46:33 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-node#915
No description provided.