如何澄清ConditionalCheckFailedException是由条件检查还是乐观锁定引起的

huangapple go评论76阅读模式
英文:

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/

https://aws.amazon.com/blogs/database/handle-conditional-write-errors-in-high-concurrency-scenarios-with-amazon-dynamodb/

英文:

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/

https://aws.amazon.com/blogs/database/handle-conditional-write-errors-in-high-concurrency-scenarios-with-amazon-dynamodb/

huangapple
  • 本文由 发表于 2023年6月29日 12:00:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76577981.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定