[erlang-bugs] mnesia:dirty_update_counter return ok instead of integer

Dan Gudmundsson dgud@REDACTED
Wed Nov 6 17:28:07 CET 2013


Ok thanks, will have a look at it
Den 6 nov 2013 11:42 skrev "Anton Ryabkov" <anton.ryabkov@REDACTED>:

> Hello,
>
> on Erlang R16B02 (also in previous versions) I've found that
> mnesia:dirty_update_counter return 'ok' instead of integer when I
> subscribed on detailed events for the "update counter's" table.
>
> Example:
>
> 1> mnesia:start().
> ok
> 2> mnesia:create_table(update_counter_table, [{ram_copies, [node()]},
> {attributes, [key, counter]}]).
> {atomic,ok}
> 3> mnesia:dirty_update_counter(update_counter_table, key1, 1).
> 1
> 4> mnesia:dirty_update_counter(update_counter_table, key1, 1).
> 2
> 5> mnesia:dirty_update_counter(update_counter_table, key1, 1).
> 3
>
> 6> mnesia:subscribe({table, update_counter_table, detailed}).
> {ok,nonode@REDACTED}
> 7> mnesia:dirty_update_counter(update_counter_table, key2, 1).
> ok
> 8> mnesia:dirty_update_counter(update_counter_table, key2, 1).
> ok
> 9> mnesia:dirty_update_counter(update_counter_table, key2, 1).
> ok
>
> I have chaned code of mnesia and found that in mnesia_tm:1790 catched
> error with reason:
>
> {function_clause,
> [{mnesia_subscr,what,
>      [update_counter_table,
>       {dirty,<0.33.0>},
>       {update_counter_table,key1,10},
>       write,
>       [{update_counter_table,key1,9}]],
>      [{file,"mnesia_subscr.erl"},{line,188}]},
>  {mnesia_subscr,report_table_event,6,
>      [{file,"mnesia_subscr.erl"},{line,172}]},
>  {mnesia_tm,commit_update,6,
>      [{file,"mnesia_tm.erl"},{line,1865}]},
>  {mnesia_tm,do_update_op,3,
>      [{file,"mnesia_tm.erl"},{line,1833}]},
>  {mnesia_tm,do_update,4,[{file,"mnesia_tm.erl"},{line,1790}]},
>  {mnesia_tm,do_commit,3,[{file,"mnesia_tm.erl"},{line,1782}]},
>  {mnesia_tm,async_send_dirty,6,
>      [{file,"mnesia_tm.erl"},{line,1994}]},
>  {mnesia_tm,dirty,2,[{file,"mnesia_tm.erl"},{line,1077}]}]}.
>
>
> The problem in the mnesia_subscr, It try prepare event for update_counter
> like for write, but doesn't expect that Old row value may be NOT undefined
> (like in case with update_counter).
>
> Anton
>
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://erlang.org/mailman/listinfo/erlang-bugs
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20131106/81591cb8/attachment.htm>


More information about the erlang-bugs mailing list