morph: Introduce switch rpc guarded rpc actor #925

Merged
fyrchik merged 1 commits from aarifullin/frostfs-node:fix/rpc-actor-guard into master 2024-01-25 13:24:18 +00:00
Collaborator
  • Introduce switch rpc guarded rpc actor in morph client
    to prevent using invalidated rpc actor when RPC switch
    happens.
  • Initialize NewContractStorage with SwitchRPCGuardedActor.
* Introduce switch rpc guarded rpc actor in morph client to prevent using invalidated rpc actor when RPC switch happens. * Initialize NewContractStorage with SwitchRPCGuardedActor.
aarifullin force-pushed fix/rpc-actor-guard from 0f7b10552f to 64882a61ee 2024-01-24 12:58:09 +00:00 Compare
aarifullin requested review from storage-core-committers 2024-01-24 13:01:17 +00:00
aarifullin requested review from storage-core-developers 2024-01-24 13:01:23 +00:00
dstepanov-yadro approved these changes 2024-01-24 15:58:12 +00:00
fyrchik reviewed 2024-01-24 16:25:30 +00:00
@ -0,0 +18,4 @@
// it when it is already invalidated. SwitchRPCGuardedActor is used to prevent
// this situation, getting the rpc actor from Client.
type SwitchRPCGuardedActor struct {
actorProvider actorProvider

The constructor accepts *Client, but we use actorProvider in field.
Why not use *Client in struct too?

The constructor accepts `*Client`, but we use `actorProvider` in field. Why not use `*Client` in struct too?
Poster
Collaborator

I think this really makes sense because it is better to make programmer prevent using recursive calls (cli.switchRPCGuardedActor.client.switchRPCGuardedActor.client....)

I think this really makes sense because it is better to make programmer prevent using recursive calls (`cli.switchRPCGuardedActor.client.switchRPCGuardedActor.client....`)
fyrchik marked this conversation as resolved
@ -157,6 +157,8 @@ func New(ctx context.Context, key *keys.PrivateKey, opts ...Option) (*Client, er
}
cli.setActor(act)
cli.switchRPCGuardedActor = NewSwitchRPCGuardedActor(cli)

We use it only to provide it to APE storage. Do we need to store this field here? I mean we can always call NewSwitchRPCGuardedActor(cli) if we have client

We use it only to provide it to APE storage. Do we need to store this field here? I mean we can always call `NewSwitchRPCGuardedActor(cli)` if we have client
Poster
Collaborator

Good point

Good point

Other than comments, LGTM

Other than comments, LGTM
fyrchik added the
bug
label 2024-01-24 16:30:03 +00:00
fyrchik added this to the v0.38.0 milestone 2024-01-24 16:30:06 +00:00
acid-ant approved these changes 2024-01-25 11:53:54 +00:00
aarifullin requested review from dstepanov-yadro 2024-01-25 12:54:26 +00:00
aarifullin requested review from acid-ant 2024-01-25 12:54:28 +00:00
aarifullin force-pushed fix/rpc-actor-guard from 64882a61ee to 42859fd920 2024-01-25 12:54:30 +00:00 Compare
fyrchik approved these changes 2024-01-25 13:24:09 +00:00
fyrchik merged commit 1fe7736d92 into master 2024-01-25 13:24:18 +00:00
Sign in to join this conversation.
No reviewers
TrueCloudLab/storage-core-developers
No Milestone
No Assignees
4 Participants
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#925
There is no content yet.