ablog

不器用で落着きのない技術者のメモ

DynamoDB の ConsistentRead

Read operations such as GetItem, Query, and Scan provide an optional ConsistentRead parameter. If you set ConsistentRead to true, DynamoDB returns a response with the most up-to-date data, reflecting the updates from all prior write operations that were successful.

Read consistency - Amazon DynamoDB

ConsistentReadオプション(読み取り一貫性)とはこのような読み取りによる差がないことを保証するもので、スキャン時にこのオプションをつけることでスキャン前に登録、変更された値は確実に読み取る事ができます。具体的には書き込まれている3箇所より2箇所の値を読み取り、一致すればその値を、一致しなければもう1箇所の値を読んで2箇所に書き込まれている値を返す、という仕組みになります。

DynamoDBの整合性モデル #DynamoDB - Qiita

DynamoDB does not require tight clock synchronization, and unlike Spanner does not assume any uncertainty window. It does not need MVCC and avoids any locking scheme (e.g. 2PL or deterministic locking). The timestamp ordering approach used by DynamoDB is very simple: assign timestamps to transactions and let these timestamps define the serialization order, i.e., a transaction with a smaller timestamp must appear to be executed before the one with a larger timestamp.

Amazon DynamoDB: ACID Transactions using Timestamp Ordering

トランザクション競合は、トランザクション内の項目に対する項目レベルの同時リクエスト中に発生する場合があります。トランザクション競合は、次のシナリオで発生する場合があります。

  • 項目に対する PutItem、UpdateItem、または DeleteItem リクエストが、同じ項目を含む継続中の TransactWriteItems リクエストと競合する。
  • TransactWriteItems リクエスト内の項目が、継続中の別の TransactWriteItems リクエストの一部である。
  • TransactGetItems リクエスト内の項目が、継続中の TransactWriteItems、BatchWriteItem、PutItem、UpdateItem、または DeleteItem リクエストの一部である。
Amazon DynamoDB Transactions: 仕組み - Amazon DynamoDB