Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with consistent reading immediately after posting #190

Open
lalwanivikas opened this issue Sep 21, 2016 · 3 comments
Open

Issue with consistent reading immediately after posting #190

lalwanivikas opened this issue Sep 21, 2016 · 3 comments

Comments

@lalwanivikas
Copy link

Hello everyone!

When I insert a new item and try to read the updated table in the callback, only 70-80% of the times I get updated value. Other times it sends old data.

I have enabled consistent read and my data is also just a couple of rows for now :(

Any idea why this might be happening? Has anyone ever faced this?

Thanks,
Vikas

@set-killer
Copy link

This is from the DynamoDB documentation:

DynamoDB maintains multiple copies of each item to ensure durability. For every 
successful write request, DynamoDB ensures that the write is durable on multiple servers. 
However, it takes time for a write to propagate to all copies. In DynamoDB, data is 
eventually consistent. This means that if you write an item and then immediately try to 
read it, you might not see the results from the earlier write.

By default, a GetItem operation performs an eventually consistent read. You can optionally 
request a strongly consistent read instead; this will consume additional read capacity 
units, but it will return the most up-to-date version of the item.

An eventually consistent GetItem request consumes only half the read capacity units as 
a strongly consistent request. Therefore, it is best to design applications so that they use 
eventually consistent reads whenever possible. Consistency across all copies of the data 
is usually reached within one second.

@lalwanivikas
Copy link
Author

@set-killer Yup, I am aware of it. That's why I have enabled strongly consistent option by setting ConsistentRead to true.

But it is not working as expected.

@clarkie
Copy link

clarkie commented Oct 6, 2016

Can you post some code? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants