DynamoDB consistent reads for Global Secondary Index
<p>Why cant I get consistent reads for global-secondary-indexes?</p>
<p>I have the following setup:</p>
<p>The table: <code>tblUsers</code> (id as hash)</p>
<p>Global Secondary Index: <code>tblUsersEmailIndex</code> (email as hash, id as attribute)</p>
<p>Global Secondary Index: <code>tblUsersUsernameIndex</code> (username as hash, id as attribute)</p>
<p>I query the indexes to check if a given email or username is present, so I dont create a duplicate user.</p>
<p>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 <em>need</em> up-to-date data.</p>
<p>According to AWS documentation:</p>
<blockquote>
<p>Queries on global secondary indexes support eventual consistency only.</p>
<p>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, <strong>your applications need to anticipate and handle situations where a query on a global secondary index returns results that are not up-to-date</strong>.</p>
</blockquote>
<p>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?</p>