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: Leverage new DynamoDB Failed Conditional Writes behavior #3327

Closed
2 tasks done
dastra opened this issue Nov 13, 2023 · 3 comments · Fixed by #3446
Closed
2 tasks done

Feature request: Leverage new DynamoDB Failed Conditional Writes behavior #3327

dastra opened this issue Nov 13, 2023 · 3 comments · Fixed by #3446
Labels
feature-request feature request

Comments

@dastra
Copy link
Contributor

dastra commented Nov 13, 2023

Use case

The new idempotency utility uses conditional writes against DynamoDB for its locking mechanism.

When the conditional write fails, the record is considered locked and the request is already processed. In that case, a query is issued against DynamoDB to fetch the cached result and return it.

This means for this scenario that customers must wait and pay for both a write and read, even though the write fails.

On June 30, 2023, DynamoDB announced the ability for a failed conditional write to return a copy of the existing record. This would allow the package to skip performing the query, improving performance and lowering cost.

Solution/User Experience

In the idempotency utility, use the new DynamoDB conditional write behavior to return the current state of the item in the same conditional write operation. Remove the follow-up query.

Alternative solutions

No response

Acknowledgment

@dastra dastra added feature-request feature request triage Pending triage from maintainers labels Nov 13, 2023
Copy link

boring-cyborg bot commented Nov 13, 2023

Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link

@heitorlessa
Copy link
Contributor

heitorlessa commented Nov 13, 2023 via email

@heitorlessa heitorlessa removed the triage Pending triage from maintainers label Nov 16, 2023
@heitorlessa heitorlessa moved this from Triage to Ideas in Powertools for AWS Lambda (Python) Nov 16, 2023
dastra pushed a commit to dastra/powertools-lambda-python that referenced this issue Dec 4, 2023
… to return a copy of the item on failure and avoid a subsequent get aws-powertools#3327
dastra pushed a commit to dastra/powertools-lambda-python that referenced this issue Dec 4, 2023
… to return a copy of the item on failure and avoid a subsequent get aws-powertools#3327
dastra pushed a commit to dastra/powertools-lambda-python that referenced this issue Jan 14, 2024
… to return a copy of the item on failure and avoid a subsequent get aws-powertools#3327.  Changes after PR comments
leandrodamascena added a commit that referenced this issue Jan 19, 2024
…havior with ReturnValuesOnConditionCheckFailure (#3446)

* feat: add ReturnValuesOnConditionCheckFailure to DynamoDB idempotency to return a copy of the item on failure and avoid a subsequent get #3327

* feat: add ReturnValuesOnConditionCheckFailure to DynamoDB idempotency to return a copy of the item on failure and avoid a subsequent get #3327

* feat: add ReturnValuesOnConditionCheckFailure to DynamoDB idempotency to return a copy of the item on failure and avoid a subsequent get #3327.  Changes after PR comments

* Improving code readability

* Reverting function

* Adding comments about some logic decisions

* Use DynamoDBPersistenceLayer passed in for test_idempotent_lambda_expired_during_request

Co-authored-by: Leandro Damascena <[email protected]>
Signed-off-by: Dan Straw <[email protected]>

* Adding docs

* wording

* Adressing Ruben's feedback

* Adressing Ruben's feedback

---------

Signed-off-by: Dan Straw <[email protected]>
Co-authored-by: Dan Straw <[email protected]>
Co-authored-by: Leandro Damascena <[email protected]>
Co-authored-by: Cavalcante Damascena <[email protected]>
@github-project-automation github-project-automation bot moved this from Ideas to Coming soon in Powertools for AWS Lambda (Python) Jan 19, 2024
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

@leandrodamascena leandrodamascena moved this from Coming soon to Shipped in Powertools for AWS Lambda (Python) Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request feature request
Projects
Status: Shipped
2 participants