-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Less aborted txns #1551
Less aborted txns #1551
Conversation
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.
The changes look good. See my note on the test. Once that's resolved we can merge.
We were only using it on the prepare step, but we needed to use the passed in txn each time we eval the prepared query. Signed-off-by: Patrick East <east.patrick@gmail.com>
b746b15
to
cea431f
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.
Changes look good. See note about moving the mock. Once that's done LGTM.
When doing a prepared query Eval() or Partial() we would build an EvalContext that defaulted to using the original Rego objects transaction. This is problematic as that one might have been aborted, or just be old. The expectation if you don't specify one at Eval() time was that you would get a new one at the current state of the store, so we should keep the prepared Eval() to work the same way. This means that if you did have a specific transaction you wanted to use you would now need to pass it in instead of only setting it on the original Rego object. This changed some tests but in real usage it shouldn't affect much. This also fixes an issue where we would abort transactions auto created on the EvalContext way too early. The helper (internal to the Rego package) now returns a finish function that will do the right thing and abort it at an appropriate time. Signed-off-by: Patrick East <east.patrick@gmail.com>
cea431f
to
c6f8ec5
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.
LGTM
This changes a few things transaction related..
Check out the individual commit messages for some more details.