[#842] object/delete: Set tombstone local node as tombstone owner

All objects in NeoFS must have owner ID. In previous implementation Object
Delete service handler set owner ID from request session token. If removal
was executed w/o a session, object with tombstone was prepared incorrectly.
In order to fix this node should set its own ID and become an owner of the
tombstone object.

Extend `NetworkInfo` interface required by Object.Delete handler with
`LocalNodeID` method which returns `owner.ID` of the local node. Implement
the method on `networkState` component of storage node application which is
updated on each node state change in NeoFS network map. Set owner returned
by `LocalNodeID` call as tombstone object's owner in Delete handler.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-11-08 15:10:49 +03:00 committed by Alex Vanin
parent d421022547
commit 0ec8f529ab
4 changed files with 35 additions and 3 deletions

View file

@ -232,9 +232,15 @@ func (exec *execCtx) initTombstoneObject() bool {
return false
}
tombOwnerID := exec.commonParameters().SessionToken().OwnerID()
if tombOwnerID == nil {
// make local node a tombstone object owner
tombOwnerID = exec.svc.netInfo.LocalNodeID()
}
exec.tombstoneObj = object.NewRaw()
exec.tombstoneObj.SetContainerID(exec.containerID())
exec.tombstoneObj.SetOwnerID(exec.commonParameters().SessionToken().OwnerID())
exec.tombstoneObj.SetOwnerID(tombOwnerID)
exec.tombstoneObj.SetType(objectSDK.TypeTombstone)
exec.tombstoneObj.SetPayload(payload)