I have a doubt regarding links and URI-escaping in Riak.

Say I create document 'test/first' with two links (notice %40 is
character @ uri-escaped):
 => 'test/second%40basho.com'
 => 'test/th...@basho.com'

$> curl -X PUT -H "content-type:text/plain" \
  -H "Link: </riak/test/second%40basho.com>; riaktag=\"foo\",
</riak/test/th...@basho.com>; riaktag=\"bar\"" \
  http://localhost:8098/riak/test/first --data "first"

$> curl -X PUT -H "content-type:text/plain"
http://localhost:8098/riak/test/second%40basho.com --data "second"

$> curl -X PUT -H "content-type:text/plain"
http://localhost:8098/riak/test/th...@basho.com --data "third"

When I walk first's links, I only obtain 'test/th...@basho.com', not
'test/second%40basho.com'.

$> curl http://localhost:8098/riak/test/first/_,_,_

--IgVE1zwvyzEQq9FQ1HtOaFS8EBN
Content-Type: multipart/mixed; boundary=WOfmvASHvjIAAXdVoDNMnLViS2B

--WOfmvASHvjIAAXdVoDNMnLViS2B
X-Riak-Vclock: a85hYGBgzGDKBVIsTJsW1mcwJTLmsTJUZ10/ypcFAA==
Location: /riak/test/third%40basho.com
Content-Type: text/plain
Link: </riak/test>; rel="up"
Etag: 4gw3mCKxcnuyMAzLYMpJbl
Last-Modified: Wed, 11 Aug 2010 18:39:55 GMT

third
--WOfmvASHvjIAAXdVoDNMnLViS2B--

--IgVE1zwvyzEQq9FQ1HtOaFS8EBN--


If I update first's links, now with third being 'test/third%40basho.com':

$> curl -X PUT -H "content-type:text/plain" \
  -H "Link: </riak/test/second%40basho.com>; riaktag=\"foo\",
</riak/test/third%40basho.com>; riaktag=\"bar\"" \
  http://localhost:8098/riak/test/first --data "first"

I get the same results when I do the link-walking.
'test/second%40basho.com' is never retrieved. Doing an equivalent
map/reduce returns a {not_found: {  'test/sec...@basho.com' }}

This shows that in the process of escaping/unescaping there are cases
in which link-walking (and map/reduce for that matter) don't work.
Riak should probably never unescape, and assume all keys are already
escaped.

I've seen some work on Ripple in this direction, and that's the reason
my code is breaking after I updated. I'm also wondering how to deal
with this in riak-js.

Thanks,
Francisco

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to