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: add support for ReturnValuesOnConditionCheckFailure in Idempotency #1784

Open
dreamorosi opened this issue Mar 4, 2025 · 0 comments
Assignees
Labels
feature-parity Feature parity with python version idempotency

Comments

@dreamorosi
Copy link
Contributor

Is your feature request related to a problem? Please describe.

When working with the Idempotency utility, the current implementation performs 2 operations: one write and one read whenever it encounters an idempotent request after the first time.

This happens because the implementation hinges on making an optimistic write to set the request as "in progress" while using a condition expression. When there's already another item, the condition expression will fail and the error will be interpreted as a request that should not be retried.

When this happens, the utility then goes on by reading the existing previously inserted error. The entire flow I just described is represented here in this diagram.

Several months ago DynamoDB announced the ability to specify a ReturnValuesOnConditionCheckFailure parameter that allows the call to automatically return the item that made the write fail

Implementing this mechanism would allow the utility to bypass the second read and thus improve performance and materialize cost savings for end customers.

Describe the solution you'd like

Currently the feature is supported in both the TypeScript and Python versions of Powertools for AWS. Here's the implementation we have in TypeScript for example:

  • here is where we use the new flag
  • here is where we handle the conditional check failed error, get the item, and pass it to the IdempotencyItemAlreadyExistsError we re throw
  • here is where we conditionally use that idempotency record if present, or default to the old behavior of reading it in a separate operation

We could add something similar here.

Describe alternatives you've considered

N/A

Additional context

N/A

@dreamorosi dreamorosi added the feature-parity Feature parity with python version label Mar 4, 2025
@dreamorosi dreamorosi moved this from Triage to Backlog in Powertools for AWS Lambda (Java) Mar 4, 2025
@phipag phipag self-assigned this Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-parity Feature parity with python version idempotency
Projects
Status: Backlog
Development

No branches or pull requests

2 participants