OK - thanx. I wrote a put function that looks like this.
It works in 1.0 - but I get disconnected if I connect to an
0.14 server and try to use it.
Does it look OK?
----------------------------------------------------------------------------------------
put(Pid, Bucket, Key, Value) ->
Obj2 =
case riakc_pb_socket:get(Pid, Bucket, Key, [deletedvclock]) of
{ok, Obj1} ->
riakc_obj:update_value(Obj1, Value);
{error, notfound, VClock} ->
riakc_obj:set_vclock(riakc_obj:new(Bucket, Key, Value), VClock);
{error, notfound} ->
riakc_obj:new(Bucket, Key, Value)
end,
riakc_pb_socket:put(Pid, Obj2).
-----------------------------------------------------------------------------------------
/Roland
----- Original Message -----
From: "Jon Meredith" <[email protected]>
To: "Roland Karlsson" <[email protected]>
Cc: [email protected]
Sent: Monday, October 3, 2011 5:02:27 PM
Subject: Re: Delete takes 5 seconds in riak 1.0 ???
Hi Roland,
Riak deletes by first writing a tombstone and then when all replicas are in
sync removing the object from the underlying key/value store. We have made some
changes in 1.0.0 to increase the length of time the tombstones are around when
all nodes are up (in the Delete Changes section of the release notes here
https://github.com/basho/riak/blob/1.0/RELEASE-NOTES.org ).
If you just want to make sure the object is deleted, you could use the
deletedvclock option on the get request. You will get a 3-tuple {error,
notfound, VClock} until the tombstone is removed, then a 2-tuple of {error,
notfound} when it has gone.
If you wish to rewrite the key, you can use the returned vclock on a new object
O = riakc_obj:set_vclock(riakc_obj:new(<<"b">>,<<<"k">>,<,"v">>), VClock)
and it will overwrite the tombstone for you.
Best Regards,
Jon Meredith
Basho Technologies
On Mon, Oct 3, 2011 at 6:49 AM, Roland Karlsson <
[email protected] > wrote:
Hi Basho,
I had written some simple tests using riakc client library.
The tests are attached to this mail.
In particular I made this call in the tests at the start of
of each test in order to get a clean DB.
riakc_pb_socket:delete(Pid, Bucket, Key),
In 0.14 that worked just fine. But ... in 1.0 it did not work.
The tests failed and complained about siblings.
But ... after some time of experimenting I found that if I
added a sleep of 5 seconds after the delete ... then the tests
were OK again.
Is this correct? Does delete take 5 seconds?
NOTE that the attached file assumes inits is started.
/Roland
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com