2

Stated differently if N >> 1 clients concurrently add 10,000 unique values to a DynamoDB "set" type using updateItem and ADD—somehow remaining under the provisioned limits—will the size of the set always be 10,000 on the next consistent read?

By "set" I refer specifically to the Multi-Valued Data Type that can be attached in DynamoDB. In theory, monotonically-growing sets are a CDRT, but whether the DynamoDB implementation is a CDRT is not mentioned anywhere in the documentation. It's not actually not very specific about safety at all:

ADD - Adds the specified value to the item, if the attribute does not already exist. If the attribute does exist, then the behavior of ADD depends on the data type of the attribute:

If the existing data type is a set, and if Value is also a set, then Value is appended to the existing set. For example, if the attribute value is the set [1,2], and the ADD action specified 3, then the final attribute value is [1,2,3]. An error occurs if an ADD action is specified for a set attribute and the attribute type specified does not match the existing set type.

I have experimented with this and have yet to produce any lost additions unless I get throttled, but I cannot find such a lossless guarantee in the documentation. In fact, I cannot find any such guarantees about any data type except for "conditional updates".

Andres Jaan Tack
  • 22,566
  • 11
  • 59
  • 78

1 Answers1

5

Yes, adding/removing from sets is also atomic.

http://aws.amazon.com/dynamodb/faqs/ only mentions StringSet but it applies to other set types as well.

Q: Does DynamoDB support in-place atomic updates?

Amazon DynamoDB supports fast in-place updates. You can increment or decrement a numeric attribute in a row using a single API call. Similarly, you can add or remove to a set of strings atomically as well.

Community
  • 1
  • 1
Johnny Wu
  • 852
  • 4
  • 5