Skip to content
Browse files

Fix ETS table race in ets_increment()

  • Loading branch information...
1 parent 2f6db29 commit e370fb77cb6bb7860c54366681ec6ba80f7a789c @slfritchie slfritchie committed Apr 9, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/basho_bench_stats.erl
View
9 src/basho_bench_stats.erl
@@ -214,8 +214,13 @@ ets_increment(Tab, Key, Incr) when is_integer(Incr) ->
Value when is_integer(Value) ->
ok;
{'EXIT', _} ->
- true = ets:insert_new(Tab, {Key, Incr}),
- ok
+ case ets:insert_new(Tab, {Key, Incr}) of
+ true ->
+ ok;
+ _ ->
+ %% Race with another load gen proc, so retry
+ ets_increment(Tab, Key, Incr)
+ end
end;
ets_increment(Tab, Key, Incr) when is_float(Incr) ->
Old = case ets:lookup(Tab, Key) of

0 comments on commit e370fb7

Please sign in to comment.
Something went wrong with that request. Please try again.