-
Notifications
You must be signed in to change notification settings - Fork 41
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
Consistent read in find
?
#38
Comments
I'd be interested in a patch and a reproducing example (accepting that the reproducing example may not always reproduce), since this sounds like a potential bug. |
If I'm understanding correctly, you're running many threads, concurrently calling |
I'm never getting the wrong return object, but we're often getting no object at all, even though the write has returned. Many of our tests assume read-after-write consistency: do x and y and expect to read z (sometimes through a GSI). We do run many tests in parallel, but in principle they never try to read each other's data. All the keys are randomized from a very large pool (10^8 or larger, depending on the test), and the number of tests (10 or so) is way too small to run into the birthday paradox. |
Oh -- and I'm aware that we can't ever assume read-after-write from a GSI. The tests blowing up today were doing writes or updates followed by |
That's a good point actually, especially for users of eventual consistency tables (even if that's not necessarily your use case). |
I'm suspecting from the correspondence so far (correct me if I'm misunderstanding) that this may be a service behavior/missing feature issue rather than a bug in the |
I'd claim its a missing feature. The
It will ignore attributes that aren't keys, but it does not extract
The question is: if we wanted to allow for that, this would preclude an attribute named
in the case where Foobar has a sort_key of |
That's what I'm wrestling with. It would preclude that attribute. Now, you can work around that with the I could add this as a minor version bump potentially, or try to find another way to expose additional |
Or maybe just add |
That's another alternative, certainly. But then the question is if any of the other parameters will also be important. I don't want to add functions more than once if I can avoid it :) |
Point taken. I kind of like dynamoid's collection-modifier approach on |
Yup, I hear you. We're working on some proposals in the team, any solution would accept any of the additional |
@awood45 do you have any ETA for version with consistent reads support? Thanks :) |
I'm seeing this as the biggest pain point right now given the PR and multiple people asking. Going to try and look at a new method this weekend. Open to quick input regarding what to call a new method:
The relative usage would probably be as follows: item = Model.find(hk_attr: "h_value", rk_attr: "r_value")
item = Model.find_with_opts(
key: {
hk_attr: "h_value",
rk_attr: "r_value"
},
consistent_read: true
) Open to feedback on approach as well. |
As far as I can tell, the request_options gets nothing from the hash we pass in, so there's no way to specify that a find should be consistent. This definitely causes problems in our test environment, where we get "heisenspecs": tests that sometimes pass and sometimes fail, depending on when "eventually" happens. I'd be happy to work on a patch... but given that the arguments to
find
are a hash, it would mean introducing reserved words (consistent_read
) in a place that doesn't obviously have to worry about them now.The text was updated successfully, but these errors were encountered: