Giter Site home page Giter Site logo

Comments (13)

seancribbs avatar seancribbs commented on July 28, 2024

@nyarly How are you deriving the link? RObject#to_link?

from riak-ruby-client.

seancribbs avatar seancribbs commented on July 28, 2024

Also, please provide a failing test case or snippet of code that reproduces the problem.

from riak-ruby-client.

IdahoEv avatar IdahoEv commented on July 28, 2024

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.

seancribbs avatar seancribbs commented on July 28, 2024

@IdahoEv Thank you. That should make it easier to narrow down.

from riak-ruby-client.

IdahoEv avatar IdahoEv commented on July 28, 2024

Ok - as edited, the above code reproduces the issue.

from riak-ruby-client.

nyarly avatar nyarly commented on July 28, 2024

@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.

seancribbs avatar seancribbs commented on July 28, 2024

@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:

  1. Sliently reject links that do not have bucket, key and/or tag.
  2. 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.

ntalbott avatar ntalbott commented on July 28, 2024

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.

IdahoEv avatar IdahoEv commented on July 28, 2024

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.

ntalbott avatar ntalbott commented on July 28, 2024

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.

nyarly avatar nyarly commented on July 28, 2024

Yeah, +1 for raising an exception.

@seancribbs can you comment on Ripple's direction vis a vis Links versus indexes?

from riak-ruby-client.

seancribbs avatar seancribbs commented on July 28, 2024

@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.

bkerley avatar bkerley commented on July 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.