英文:
How to clarify whether the ConditionalCheckFailedException is caused by a condition check or optimistic locking
问题
我想澄清一下ConditionalCheckFailedException
是否是由条件检查或乐观锁定引起的。
似乎在https://github.com/aws/aws-sdk-net/issues/1332上有关于这个问题的讨论,但我不确定是否已解决。
我想区分ConditionalCheckFailedException
的原因是为了专门为与乐观锁定相关的情况实现重试逻辑,而不是为了条件检查。
有没有办法确定ConditionalCheckFailedException
是由于条件检查还是乐观锁定引起的?
谢谢。
英文:
I want to clarify whether the ConditionalCheckFailedException
is caused by a condition check or optimistic locking.
It seems that there is a discussion about this issue on https://github.com/aws/aws-sdk-net/issues/1332, but I'm unsure if it has been resolved.
The reason I want to differentiate the ConditionalCheckFailedException
is to implement retry logic specifically for cases related to optimistic locking, not for condition checks.
Is there a way to determine if the ConditionalCheckFailedException
is due to a condition check or optimistic locking?
Thank you.
答案1
得分: 1
2023年7月1日更新
在条件检查失败的情况下,您可以选择返回项目,以了解哪个条件评估为false:
> 以前,在单个写操作中的条件检查错误在条件检查错误发生时不会返回项目的副本。需要单独的读取请求来获取项目并调查错误的原因。现在,通过ReturnValuesOnConditionCheckFailure参数,DynamoDB错误消息可以免费包括项目的副本,就像在写入尝试期间一样。
https://aws.amazon.com/about-aws/whats-new/2023/06/amazon-dynamodb-cost-failed-conditional-writes/
英文:
Update 1st July 2023
You can choose to return the item in the case of a conditional check failure to understand which condition evaluated to false:
> Previously, condition check errors in single write operations did not return a copy of the item in the event of a condition check error. A separate read request was necessary to get the item and investigate the cause of the error. Now with the ReturnValuesOnConditionCheckFailure parameter, DynamoDB error messages can include a copy of the item as it was during the write attempt at no additional cost.
https://aws.amazon.com/about-aws/whats-new/2023/06/amazon-dynamodb-cost-failed-conditional-writes/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论