Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pseudo-transactionalize sharing #5029

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Pseudo-transactionalize sharing #5029

wants to merge 1 commit into from

Conversation

jessegeens
Copy link
Contributor

@jessegeens jessegeens commented Jan 7, 2025

Currently, sharing is not transactionalized: setting ACLs and writing the share to the db is completely independent. In the current situation, shares are written to the db before setting the ACL, letting users falsely believe that they successfully shared a resource, even if setting the ACL afterwards fails. his enhancement improves the situation by doing the least reliable (setting ACLs on EOS) first:
a) first pinging the db
b) writing the ACLs
c) writing to the db

Copy link

update-docs bot commented Jan 7, 2025

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@jessegeens jessegeens marked this pull request as ready for review January 7, 2025 12:31
glpatcern
glpatcern previously approved these changes Jan 7, 2025
Copy link
Member

@glpatcern glpatcern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a few minor comments

internal/grpc/services/gateway/usershareprovider.go Outdated Show resolved Hide resolved
internal/grpc/services/gateway/usershareprovider.go Outdated Show resolved Hide resolved
internal/grpc/services/gateway/usershareprovider.go Outdated Show resolved Hide resolved
diocas
diocas previously approved these changes Jan 7, 2025
internal/grpc/services/gateway/usershareprovider.go Outdated Show resolved Hide resolved
changelog/unreleased/pseudo-tx-share.md Outdated Show resolved Hide resolved
if err != nil {
return nil, errors.Wrap(err, "gateway: error adding grant to storage")
}
if addGrantStatus.Code != rpc.Code_CODE_OK {
Copy link
Member

@glpatcern glpatcern Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So following the discussion today, we could log here the addGrantStatus.Message before returning (or return it as part of the response, and then make sure it is logged), hoping to learn why the storage fails at times to create the share.

return nil, errors.Wrap(err, "gateway: error calling CreateShare")
}
if res.Status.Code != rpc.Code_CODE_OK {
return res, nil
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems some left-over copy/paste, probably to be dropped (we already return res, nil below anyway)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I missed this comment. If the RPC returns an error through res I think we should also return an error, so updated the code to do this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants