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

Feature Request: support ReturnValuesOnConditionCheckFailure #245

Closed
extemporalgenome opened this issue Aug 16, 2024 · 4 comments
Closed

Comments

@extemporalgenome
Copy link

The write operations which support ReturnValues (PutItem, UpdateItem, DeleteItem, transactional equivalents thereof, and possibly others) generally also support ReturnValuesOnConditionCheckFailure, which can take a value of ALL_OLD to get a strongly consistent read for free (in terms of capacity cost) even if the write was semantically rejected.

This is pretty useful from an atomics perspective, i.e. inspecting the item in a guaranteed state to find out why the condition check failed, all without needing to perform a potentially racing followup read.

Here is a non-complete list of the operations that support this (at least the ones I care most about), and the relevant docs/code:

Operation Docs SDK V1 SDK V2
PutItem link link link
UpdateItem link link link
DeleteItem link link link
@guregu
Copy link
Owner

guregu commented Aug 22, 2024

Oh nice, I didn't know this existed (is it new?). I will add it for sure.
Edit: oops I had a TODO for this (well, the tx version) I totally forgot about because the SDK didn't support it yet. Working on it now.

@guregu
Copy link
Owner

guregu commented Aug 22, 2024

PR here: #246. Wasn't sure whether it was better to have an API that works based off the errors or another method on the operations so I did both :-)
Let me know if it looks good.

guregu added a commit that referenced this issue Aug 26, 2024
* support ReturnValuesOnConditionCheckFailure (#245)

* add IncludeItemInCondCheckFail and friends

* add IncludeItemInCondCheckFail to ConditionCheck
@guregu
Copy link
Owner

guregu commented Aug 26, 2024

Just released in v2.2.0. Let me know if you run into any issues

@extemporalgenome
Copy link
Author

Thanks!

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

No branches or pull requests

2 participants