Comments (13)
@nyarly How are you deriving the link? RObject#to_link
?
from riak-ruby-client.
Also, please provide a failing test case or snippet of code that reproduces the problem.
from riak-ruby-client.
It happened in our code when I tried to shovel an associated object with Ripple, and the associated object failed validation. This code snippet reproduces the issue:
class InnerDoc
include Ripple::Document
property :foo, String
validates_presence_of :foo
end
class OuterDoc
include Ripple::Document
many :inner_docs
end
o_d = OuterDoc.new
i_d = InnerDoc.new(:foo => nil)
o_d.inner_docs << i_d # i_d fails validation and so doesn't save, but doesn't raise anything either. i_d.key == nil.
o_d.save! # fails with malformed link header b/c od.inner_docs is [i_d], but od.inner_docs.first.key == nil
EDITED: typos and spelling, snippet reproduces the issue.
from riak-ruby-client.
@IdahoEv Thank you. That should make it easier to narrow down.
from riak-ruby-client.
Ok - as edited, the above code reproduces the issue.
from riak-ruby-client.
@seancribbs - Yes, RObject#to_link called by ManyLinkedProxy on save in Ripple.
The original line comes from lib/riak/link.rb:59 in URL.
Still, I'm mostly curious about what cases that URL would be correct. When is it valid to write (or read?) a link to /buckets/bucket_id without a key?
from riak-ruby-client.
@nyarly @IdahoEv Riak will produce a link to the bucket in the Link header, with rel="up"
. It is valid to accept those, but not to post them back (which is an inconsistency on the Riak side, actually). I see two possible resolutions:
- Sliently reject links that do not have bucket, key and/or tag.
- Raise an exception on links that are do not have bucket, key, and/or tag (and aren't the standard "bucket" link).
What seems the most reasonable? Should the check happen before hitting the transport layer (in RObject
) or when marshalling (in the transport layer)? Thoughts/arguments welcomed.
/cc @myronmarston @ntalbott @aphyr
from riak-ruby-client.
I definitely vote for option 2, though I'm not sure whether this makes more sense in RObject
or the transport layer. I'm leaning towards the latter.
Of course, this whole discussion violates my number one rule for using Riak: DON'T USE LINKS 😄
from riak-ruby-client.
I likewise vote for #2.
@ntalbott - out of curiosity, what's your concern with links? (In our case, we're not using them directly, they are just how Ripple handles non-embedded associations.)
from riak-ruby-client.
Riak Links have horrid performance characteristics once you get past a (surprisingly small) number of links-per-document. I recommend you rip them out ASAP and replace with something based on 2i. I'm pretty sure that Ripple will be making the switch to 2i as the default non-embedded association type soon for exactly this reason.
from riak-ruby-client.
Yeah, +1 for raising an exception.
@seancribbs can you comment on Ripple's direction vis a vis Links versus indexes?
from riak-ruby-client.
@nyarly It is as @ntalbott says, I will be attempting to discourage use of links in future releases (for one-to-many associations).
from riak-ruby-client.
Closing; the code for this has moved to Ripple, and we prefer using indexes/2i for associations there.
from riak-ruby-client.
Related Issues (20)
- Riak search instructions do not work [JIRA: CLIENTS-404] HOT 1
- Cannot connect to Riak via SSL HOT 9
- Don't error on empty TsQueryResp responses [JIRA: CLIENTS-620] HOT 1
- Timestamp value parsing [JIRA: CLIENTS-822] HOT 3
- Finding objects by integer keys fail badly [JIRA: CLIENTS-865] HOT 2
- Improve error when non-String is used as a key [JIRA: CLIENTS-868]
- TimeSeries Query returning timestamps with rounding error [JIRA: CLIENTS-889] HOT 11
- Some tests fail running under OSX [JIRA: CLIENTS-890] HOT 1
- `getaddrinfo': can't convert Hash into String (TypeError) [JIRA: CLIENTS-924] HOT 8
- Update support for 1.9.3 [JIRA: CLIENTS-947] HOT 1
- Errors when using beefcake 1.2.0 [JIRA: CLIENTS-949] HOT 1
- Need clean way to handle deleted objects and tombstones [JIRA: CLIENTS-965] HOT 5
- Implement saving bucket type properties [JIRA: CLIENTS-1010]
- Ruby tests fails with latests TS version [JIRA: CLIENTS-1052] HOT 2
- wait_for_finish should not be public [JIRA: CLIENTS-1054] HOT 4
- GSet Support - Ruby [JIRA: CLIENTS-1062]
- Add warning and safety mechanism to prevent unintentional list [buckets | keys] operations [JIRA: CLIENTS-1071] HOT 1
- Ruby content.meta does not correctly apply X-Riak-Meta- prefix [JIRA: CLIENTS-1109] HOT 3
- Use RIAK Client in Multithreaded application
- Interview partners for research about communication in GitHub projects wanted
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from riak-ruby-client.