Bug in mnesia:dirty_update_counter

Thomas Lindgren thomasl_erlang@REDACTED
Wed Mar 9 15:36:35 CET 2005

--- Anders Nygren <anders.nygren@REDACTED> wrote:
> There seems to be a bug in
> mnesia:dirty_update_counter. 
> The first time dirty_update_counter(Tab,Key,Incr) is
> called with a specific Key
> the counter is set to 0.

I'd say that is a feature, actually ... If only
ets:update_counter had the same behaviour (or _nearly_
the same: behaving _as_if_ the counter had value 0
before this operation).

I could then replace

  case catch ets:update_counter(Tab, Key, Incr) of
     {'EXIT',_} -> ets:insert(Tab, {Key, Incr}), Incr;
     N -> N

with (the silently initializing version):

  ets:update_counter(Tab, Key, Incr)

Pretty please, someone? :-)


Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 

More information about the erlang-questions mailing list