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

Conflicts with "deleted" sibling cause error during deserialization #289

Open
paukul opened this issue May 10, 2012 · 1 comment
Open

Conflicts with "deleted" sibling cause error during deserialization #289

paukul opened this issue May 10, 2012 · 1 comment

Comments

@paukul
Copy link

paukul commented May 10, 2012

Example:

1.9.2p320 :003 > Activities::Activity.find('189510106')
NoMethodError: undefined method `[]' for nil:NilClass
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/serializers.rb:25:in `serializer_for'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/serializers.rb:19:in `deserialize'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/robject.rb:253:in `deserialize'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/robject.rb:143:in `data'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/bundler/gems/ripple-b6b370876d39/lib/ripple/conflict/resolver.rb:14:in `block (2 levels) in to_proc'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/bundler/gems/ripple-b6b370876d39/lib/ripple/conflict/resolver.rb:14:in `map'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/bundler/gems/ripple-b6b370876d39/lib/ripple/conflict/resolver.rb:14:in `block in to_proc'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/robject.rb:80:in `call'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/robject.rb:80:in `block in attempt_conflict_resolution'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/robject.rb:79:in `each'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/robject.rb:79:in `attempt_conflict_resolution'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/client/beefcake/object_methods.rb:42:in `load_object'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/client/beefcake_protobuffs_backend.rb:156:in `decode_response'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/client/beefcake_protobuffs_backend.rb:38:in `fetch_object'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/client.rb:278:in `block in get_object'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/client.rb:433:in `block in recover_from'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/client/pool.rb:126:in `take'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/client.rb:431:in `recover_from'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/client.rb:377:in `protobuffs'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/client.rb:131:in `backend'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/client.rb:277:in `get_object'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/gems/riak-client-1.0.3/lib/riak/bucket.rb:88:in `get'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/bundler/gems/ripple-b6b370876d39/lib/ripple/document/finders.rb:113:in `find_one'
  from /Users/stefan.kaes/.rvm/gems/ruby-1.9.2-p320@activities/bundler/gems/ripple-b6b370876d39/lib/ripple/document/finders.rb:55:in `find'

When we request the object and it's siblings via the HTTP api:

$curl "http://...../buckets/activities/keys/189510106"
Siblings:
585vMWeup4kgDaf0JsLkMS
2dpIA3DWRw4AkS0BjzYdeW


SIBLING 1:

$ curl -I "http://...../buckets/activities/keys/189510106?vtag=585vMWeup4kgDaf0JsLkMS"
HTTP/1.1 200 OK
X-Riak-Vclock: a85hYGBgymDKBVIccUmys/xXeizOYEpkzGNlEPghd5IPKqW54O5D/5WegkApJqCUM0gqCwA=
Vary: Accept-Encoding
Server: MochiWeb/1.1 WebMachine/1.9.0 (someone had painted it blue)
Link: </buckets/activities>; rel="up"
Last-Modified: Wed, 09 May 2012 14:16:35 GMT
ETag: "585vMWeup4kgDaf0JsLkMS"
Date: Wed, 09 May 2012 15:33:21 GMT
Content-Type: application/octet-stream
Content-Length: 0


SIBLING 2:

$ curl -I "http://....../buckets/activities/keys/189510106?vtag=2dpIA3DWRw4AkS0BjzYdeW"
HTTP/1.1 200 OK
X-Riak-Vclock: a85hYGBgymDKBVIccUmys/xXeizOYEpkzGNlEPghd5IPKqW54O5D/5WegkApJqCUM0gqCwA=
Vary: Accept-Encoding
Server: MochiWeb/1.1 WebMachine/1.9.0 (someone had painted it blue)
Link: </buckets/activities>; rel="up"
Last-Modified: Wed, 09 May 2012 14:16:35 GMT
ETag: "2dpIA3DWRw4AkS0BjzYdeW"
Date: Wed, 09 May 2012 15:36:10 GMT
Content-Type: application/json; charset=US-ASCII

the second sibling gets send with content type application/octet-stream and content-length 0. The serializer maps (https://github.com/seancribbs/ripple/blob/master/lib/ripple/conflict/resolver.rb#L14) over the siblings which causes riak-client to barf because there's no deserializer for application/octet-stream.

@paukul
Copy link
Author

paukul commented May 10, 2012

/cc @skaes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant