Why cant I get consistent reads for global-secondary-indexes?
I have the following setup:
The table: tblUsers
(id as hash)
Global Secondary Index: tblUsersEmailIndex
(email as hash, id as attribute)
Global Secondary Index: tblUsersUsernameIndex
(username as hash, id as attribute)
I query the indexes to check if a given email or username is present, so I dont create a duplicate user.
Now, the problem is I cant do consistent reads for queries on the indexes. But why not? This is one of the few occasions I actually need up-to-date data.
According to AWS documentation:
Queries on global secondary indexes support eventual consistency only.
Changes to the table data are propagated to the global secondary indexes within a fraction of a second, under normal conditions. However, in some unlikely failure scenarios, longer propagation delays might occur. Because of this, your applications need to anticipate and handle situations where a query on a global secondary index returns results that are not up-to-date.
But how do i handle this situation? How can I make sure that a given email or username is not already present in the db?
tblUsers
, and that table has two global-secondary-indexes – Jpst