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

RObject#links is an Array, not a Set, if the object is returned by Bucket#get_or_new() #123

Merged
merged 2 commits into from
Sep 16, 2013

Conversation

bkerley
Copy link
Contributor

@bkerley bkerley commented Sep 16, 2013

In riak-client 1.4.1, the behavior of RObject#links is different based on two scenarios. If you do Bucket#get_or_new() and that key does not exist, links is a Set (which makes sense and is the intended behavior I believe).

If you do Bucket#get_or_new() and the key did exist and the method is just returning that stored document, #links is an array. This inadvertently lets you add the same link more than one time to a document, then store it again.

I am using ruby 2.0.0p195 and riak-client 1.4.1 and can re-create this every time.

@bkerley
Copy link
Contributor

bkerley commented Sep 16, 2013

Just added a spec for this, it looks like it works correctly with HTTP, but not Protocol Buffers.

@seancribbs
Copy link
Contributor

👍

bkerley added a commit that referenced this pull request Sep 16, 2013
RObject#links is an Array, not a Set, if the object is returned by Bucket#get_or_new()
@bkerley bkerley merged commit 9eb7dd0 into 1-4-stable Sep 16, 2013
@bkerley bkerley deleted the bk-links-should-be-a-set branch September 16, 2013 14:01
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

Successfully merging this pull request may close these issues.

2 participants