Potential consistency problem?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Potential consistency problem?

Lev Walkin

Riak 0.9.1 with an ets backend shows some inconsistency problems  
between successive put/delete. Here's the test:

f(TF), TF = fun(N) ->
   Key = term_to_binary(N),
   {ok, C} = riak:client_connect('riak@MacBook-SiDen'),
   O0 = riak_object:new(<<"siden">>, Key, "val1"),
   C:put(O0, 3),
   C:delete(<<"siden">>, Key, 3),
   O1 = riak_object:new(<<"siden">>, Key, "val2"),
   C:put(O1, 3),
   case C:get(<<"siden">>, Key, 3) of
     {error, notfound} -> notfound;
     _ -> ok
   end
end.

f(TF2), TF2 = fun(N) ->
   Key = term_to_binary(N),
   {ok, C} = riak:client_connect('riak@MacBook-SiDen'),
   O0 = riak_object:new(<<"siden">>, Key, "val1"),
   C:put(O0, 2),
   C:delete(<<"siden">>, Key, 2),
timer:sleep(100),  % N.B.!
   O1 = riak_object:new(<<"siden">>, Key, "val2"),
   C:put(O1, 2),
   case C:get(<<"siden">>, Key, 2) of
     {error, notfound} -> notfound;
     _ -> ok
   end
end.


(riak@MacBook)42> f(Now), Now = now(), [TF({Now, N}) || N <-  
lists:seq(0,10)].
[notfound,notfound,notfound,notfound,notfound,notfound,
notfound,notfound,notfound,notfound,notfound]

(riak@MacBook)43> f(Now), Now = now(), [TF2({Now, N}) || N <-  
lists:seq(0,10)].
[ok,ok,ok,ok,ok,ok,ok,ok,ok,ok,ok]


--
vlm


_______________________________________________
riak-users mailing list
[hidden email]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com