Skip to content

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

Merged
bkerley merged 2 commits into1-4-stablefrom
bk-links-should-be-a-set
Sep 16, 2013
Merged

RObject#links is an Array, not a Set, if the object is returned by Bucket#get_or_new()#123
bkerley merged 2 commits into1-4-stablefrom
bk-links-should-be-a-set

Conversation

@bkerley
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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