Reputation: 326
Scenario:
(PS: I'm okay if new data added is not returned, and not using "consistent read")
Upvotes: 1
Views: 1543
Reputation: 7132
The LastEvaluatedKey
is like a bookmark in the primary key keyspace, a reference to the hash key of the last item processed. When you then pass it as an ExclusiveStartKey
the scan will find that bookmarked item position in the sequential set of hashes and start processing with the next item. It's basically just saying "start a new scan, and start with the keys after this hash value".
If you modify items in the table held prior to the key, they won't be in the scan, because you resumed the scan after them. If you modify items in the table held after the key, they will potentially be in the scan.
Think of it as if you're reading all the words in the dictionary. The LastEvaluatedKey
is the last word you read. Maybe the OED is adding words before or after the word you read, and maybe you get new updated copies of the OED as you go. Your scan would still resume with the word after the word you last read. Even if the word you last read gets removed from the OED, that doesn't invalidate your scan and you can keep reading the dictionary from what would be the next word.
Upvotes: 2