Should AddChain update/invalidate APE cache? #1503

Open
opened 2024-11-18 14:55:31 +00:00 by dkirillov · 1 comment
Member

It's a question.
We have AddChain method

func (s *Service) AddChain(_ context.Context, req *apemanagerV2.AddChainRequest) (*apemanagerV2.AddChainResponse, error) {


that allows to add new container policy.

And after invoking this method we have to wait until:

  • tx be accepted by blockchain
  • cache be invalidated

Is it ok? I'd like to be able to put objects right after container creation (say we use sdk) and adding policies.

Describe the solution you'd like

Probably we can invalidate APE cache on these requests (AddChain, DeleteChain)

Describe alternatives you've considered

  • Don't change anything
  • Update cache value
  • Make container creation synchronous so we don't need to do GetContainer requests to know if container has already created (it seems such requests fill cache with empty list of chains)

Additional context

TrueCloudLab/frostfs-s3-gw#553

## Is your feature request related to a problem? Please describe. It's a question. We have `AddChain` method https://git.frostfs.info/TrueCloudLab/frostfs-node/src/commit/d82f0d192691f33eb63e2d71beac433a4232b163/pkg/services/apemanager/executor.go#L87 that allows to add new container policy. And after invoking this method we have to wait until: * tx be accepted by blockchain * cache be invalidated Is it ok? I'd like to be able to put objects right after container creation (say we use sdk) and adding policies. ## Describe the solution you'd like Probably we can invalidate APE cache on these requests (AddChain, DeleteChain) ## Describe alternatives you've considered * Don't change anything * Update cache value * Make container creation synchronous so we don't need to do `GetContainer` requests to know if container has already created (it seems such requests fill cache with empty list of chains) ## Additional context https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/issues/553
dkirillov added the
triage
label 2024-11-18 14:55:31 +00:00
Member

This issue can be solved by this.

To be honest, I didn't fully understand how you reproduced these steps:

  1. You create a container, set APE-chain to Policy contract and then await for container creation?
  2. You create a container, await for its creation and then set APE-chain to Policy contract?

Anyway, that pushed me to check Get handler of the container service and I found that it sets container target before APE-check. This implicit thing might fix your problem indirectly, but I suppose this won't be merged in the context of this problem, again, because it's not obvious and unrelated. This fix also requires some big checks because some client accidently may set GetContainer policies within container target although container target is supposed for object operations.
If you was trying (2), then you should have waited for the transaction is accepted anyway: while #1506 is not implemented.

This issue can be solved by [this](https://git.frostfs.info/TrueCloudLab/frostfs-node/issues/1506). To be honest, I didn't fully understand how you reproduced these steps: 1. You create a container, set APE-chain to `Policy` contract and then `await` for container creation? 2. You create a container, `await` for its creation and then set APE-chain to `Policy` contract? Anyway, that pushed me to check `Get` handler of the container service and I [found](https://git.frostfs.info/TrueCloudLab/frostfs-node/pulls/1504) that it sets container target before APE-check. This implicit thing _might_ fix your problem indirectly, but I suppose this won't be merged in the context of this problem, again, because it's not obvious and unrelated. This fix also requires some big checks because some client accidently may set `GetContainer` policies within container target although container target is supposed for object operations. If you was trying (2), then you should have waited for the transaction is accepted anyway: while [#1506](https://git.frostfs.info/TrueCloudLab/frostfs-node/issues/1506) is not implemented.
Sign in to join this conversation.
No milestone
No project
No assignees
2 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#1503
No description provided.