Permalink
Browse files

Apply fix from basho/riak_kv#314 for ttl test breakage.

  • Loading branch information...
seancribbs committed Apr 12, 2012
1 parent 90c2915 commit 9e7e039efd3c89ef0719664349aa85e1a5d0576b
Showing with 8 additions and 1 deletion.
  1. BIN erl_src/riak_kv_test_backend.beam
  2. +8 −1 erl_src/riak_kv_test_backend.erl
Binary file not shown.
@@ -164,6 +164,7 @@ stop(#state{data_ref=DataRef,
get(Bucket, Key, State=#state{data_ref=DataRef,
index_ref=IndexRef,
used_memory=UsedMemory,
+ max_memory=MaxMemory,
ttl=TTL}) ->
case ets:lookup(DataRef, {Bucket, Key}) of
[] -> {error, not_found, State};
@@ -175,7 +176,13 @@ get(Bucket, Key, State=#state{data_ref=DataRef,
%% entries blindly using match_delete.
ets:delete(DataRef, {Bucket, Key}),
ets:match_delete(IndexRef, ?DELETE_PTN(Bucket, Key)),
- {error, not_found, State#state{used_memory=UsedMemory - object_size(Object)}};
+ case MaxMemory of
+ undefined ->
+ UsedMemory1 = UsedMemory;
+ _ ->
+ UsedMemory1 = UsedMemory - object_size(Object)
+ end,
+ {error, not_found, State#state{used_memory=UsedMemory1}};
false ->
{ok, Val, State}
end;

0 comments on commit 9e7e039

Please sign in to comment.