0
votes

When enabling dynamodb global table, if there are two writes happens on the same item but different attributes on the table in each region. How does dynamodb sync between these two tables?

For example, in regionA, there is an update on an item:

{
  a: 1
}

at the same time, there is another write on the same table in regionB with below change:

{
  b: 1
}

will dynamodb global table sync combine the attributes into one:

{
 a: 1,
 b: 1
}

or will one replace the other?

1

1 Answers

0
votes

In case of a race condition, one update will be accepted while the other will be rejected. When using DynamoDB Global Tables, DynamoDB isn’t able to reliably resolve inconsistencies due to its distributed nature. You need to make sure to prevent or resolve possible inconsistencies as part of your application.

According to the documentation:

To help ensure eventual consistency, DynamoDB global tables use a last writer wins reconciliation between concurrent updates, in which DynamoDB makes a best effort to determine the last writer. With this conflict resolution mechanism, all the replicas will agree on the latest update and converge toward a state in which they all have identical data.

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables_HowItWorks.html