Dynamodb 缺少并发请求的更新? [英] Dynamodb missing updates with concurrent requests?

查看:25
本文介绍了Dynamodb 缺少并发请求的更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法一次多次更新单个项目.如果我尝试像这样多次更新具有新属性的项目:

I'm having trouble updating a single item many times at once. If I try to update an item with new attributes many times like so:

UpdateExpression: 'SET attribute.#uniqueId = :newAttribute'

并非所有更新都通过.我尝试发送 20 个具有唯一 ID 的更新,结果只有 15 个新属性.这也发生在我的本地 dynamodb 实例中.我假设更新以某种方式在最后一次更新获胜"中相互覆盖.情景,但我不确定.我该如何解决这个问题?

not all of the updates go through. I tried sending 20 updates with unique ids and this resulted in only 15 new attributes. This also occurs in my local dynamodb instance. I assume that the updates are somehow overwriting each other in a "last update wins" scenario but I'm not sure. How can I solve this?

推荐答案

DynamoDB 在更新时最终是一致的,所以竞争条件"是可能的.如果您想要更严格的写入逻辑,请查看 transactions

DynamoDB is eventually consistent on update, so "race conditions" are possible. If you want more strict logic in writes, take a look at transactions

项目在事务期间未锁定.DynamoDB 事务提供可序列化的隔离.如果项目在交易在交易进行时,交易是取消并引发异常,其中包含有关哪个项目或items 导致了异常.

Items are not locked during a transaction. DynamoDB transactions provide serializable isolation. If an item is modified outside of a transaction while the transaction is in progress, the transaction is canceled and an exception is thrown with details about which item or items caused the exception.

这篇关于Dynamodb 缺少并发请求的更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆