-
Notifications
You must be signed in to change notification settings - Fork 96
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
object list (Get Bucket) returns isTruncated=false too soon #781
Comments
Just a quick look (no actual confirmation),
at https://github.com/basho/riak_cs/blob/develop/src/riak_cs_list_objects_fsm_v2.erl#L263 |
Is this with fold_objects true or false? |
It's set to 'true':
|
One more pattern found: when there is one and only one non-active object after 1001st key. One example situation:
(The specific number memo: the key which is the same as marker is removed from fold_objects result: |
Quick fix:
|
Bug confirmed. |
The above fix seems to be working, but it has the side-effect of returning isTruncated=True when there are exactly 1000 objects. This means that an extra request will be made by the client, which will then return 0 keys. |
Here's the approach I'm testing now: diff --git a/src/riak_cs_list_objects_fsm_v2.erl b/src/riak_cs_list_objects_fsm_v2.erl
index 12e7f0d..26bffbd 100644
--- a/src/riak_cs_list_objects_fsm_v2.erl
+++ b/src/riak_cs_list_objects_fsm_v2.erl
@@ -271,7 +271,7 @@ enough_results(#state{req=?LOREQ{max_keys=UserMaxKeys},
objects=Objects,
common_prefixes=CommonPrefixes}) ->
riak_cs_list_objects_utils:manifests_and_prefix_length({Objects, CommonPrefixes})
- >= UserMaxKeys
+ > UserMaxKeys
orelse EndOfKeyspace.
response_from_manifests_and_common_prefixes(Request, |
This approach seems to be working well. I'm going to add a riak_test regression test as well. |
Working branch is here. Think it's looking good, but need to rewrite the commit messages once I get some feedback. |
Yes. I didn't like it. Your approach eliminates unnecessary turn around between client and CS, it seems better :) riak_test test case looks nice and work as advertised (fails with current release/1.4 and succeeds with your branch) . Would you mind adding another similar but slightly different scenario mentioned at comment above?
|
One more thought (rant?) ;) In the case of
the results of another We already have the information whether riak has more keys or not as
Therefore, isTruncated is true either:
Diff (local change):
|
In my mind, I had wanted to keep |
I agree for simplicity. |
I'm trying to write my first EQC property at https://github.com/basho/riak_cs/compare/feature;list-objects-eqc-addition?expand=1 That property
This is probably because |
Damn. Nice find. |
Strange that it works with 1001 keys, and not 1002. |
1003 also works fine. Of note, there is a 1002 hardcoded in the the CS code for the number of keys to request in the fold objects bit. |
So here's what I think is happening: Code here: ReachedEnd = ObjectBufferLength < NumKeysRequested, If |
Reverting the change I made initially fixes the 1002 key issue. Re-running EQC though to see what else (in addition to the original bug) pops up. |
Note: the EQC test can be quite ram-intensive. |
Sounds good.
Oops. I modified generators and pushed it. RAM usage (RSS) is at most 150MB. Also faster than yesterday's :) |
Thanks. I think I'll try and take a look at this again with fresh eyes in the morning. It's really great to have a more powerful EQC test here, as it was becoming obvious that manual test cases were not going to find all of the edge-cases. |
diff --git a/src/riak_cs_list_objects_fsm_v2.erl b/src/riak_cs_list_objects_fsm_v2.erl
index 4a4ae18..f84a3e4 100644
--- a/src/riak_cs_list_objects_fsm_v2.erl
+++ b/src/riak_cs_list_objects_fsm_v2.erl
@@ -213,16 +213,18 @@ handle_done(State=#state{object_buffer=ObjectBuffer,
ObjectPrefixTuple2 =
riak_cs_list_objects_utils:filter_prefix_keys(ObjectPrefixTuple, Request),
+
+ lager:error("ObjectBufferLength is ~p", [ObjectBufferLength]),
+ lager:error("NumKeysRequested is ~p", [NumKeysRequested]),
+
ReachedEnd = ObjectBufferLength < NumKeysRequested,
+ lager:error("Reached end is ~p", [ReachedEnd]),
Truncated = truncated(UserMaxKeys, ObjectPrefixTuple2),
- SlicedTaggedItems =
- riak_cs_list_objects_utils:manifests_and_prefix_slice(ObjectPrefixTuple2,
- UserMaxKeys),
+ lager:error("Truncated is ~p", [Truncated]),
- {NewManis, NewPrefixes} =
- riak_cs_list_objects_utils:untagged_manifest_and_prefix(SlicedTaggedItems),
+ {NewManis, NewPrefixes} = ObjectPrefixTuple2,
NewStateData = RangeUpdatedStateData#state{objects=NewManis,
common_prefixes=NewPrefixes,
reached_end_of_keyspace=ReachedEnd,
@@ -238,14 +240,21 @@ update_profiling_and_last_request(State, ObjectBuffer, ObjectBufferLength) ->
-spec respond(state(), list(), ordsets:ordset(), boolean()) ->
fsm_state_return().
-respond(StateData=#state{req=Request},
+respond(StateData=#state{req=Request=?LOREQ{max_keys=UserMaxKeys}},
Manifests, Prefixes, Truncated) ->
case enough_results(StateData) of
true ->
+
+ SlicedTaggedItems =
+ riak_cs_list_objects_utils:manifests_and_prefix_slice({Manifests,
+ Prefixes},
+ UserMaxKeys),
+ {NewManis, NewPrefixes} =
+ riak_cs_list_objects_utils:untagged_manifest_and_prefix(SlicedTaggedItems),
Response =
response_from_manifests_and_common_prefixes(Request,
Truncated,
- {Manifests, Prefixes}),
+ {NewManis, NewPrefixes}),
try_reply({ok, Response}, StateData);
false ->
RiakcPid = StateData#state.riakc_pid,
@@ -439,6 +448,7 @@ next_byte(<<Integer:8/integer>>) ->
state()) ->
fsm_state_return().
try_reply(Response, State) ->
+ lager:error("Try reply"),
NewStateData = State#state{response=Response},
reply_or_wait(Response, NewStateData).
Some debugging code in here, but this is seeming to work ok so far. Will try again in the AM too. |
Added delimiter option to EQC property and made PR #784 (squashed branch). |
My 'fixes' now fail with this branch. I'm going to take some time to try and understand the test for a bit now. |
Oh, I now confirmed a failure in with-delimiter case. I will check the reason of failure too. |
Continuing a bit of the conversation on #784. |
Some comments although the branch is not squashed :)
|
Sorry... This is completely my misunderstanding... |
fixed by #788 |
Confirmed with release/1.4 branch (3de6acf).
The text was updated successfully, but these errors were encountered: