-
Notifications
You must be signed in to change notification settings - Fork 112
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
base: master
Are you sure you want to change the base?
Conversation
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. |
ed00ee7
to
d159980
Compare
d159980
to
ac1fc44
Compare
There was a problem hiding this 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
ac1fc44
to
3d320c3
Compare
a02cfef
to
71aa634
Compare
71aa634
to
8e2bf89
Compare
if err != nil { | ||
return nil, errors.Wrap(err, "gateway: error adding grant to storage") | ||
} | ||
if addGrantStatus.Code != rpc.Code_CODE_OK { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
8e2bf89
to
de19b5b
Compare
de19b5b
to
8da19df
Compare
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