Change not reflected when using ets:update_counter

chandru chandrashekhar.mullaparthi@REDACTED
Tue Oct 11 15:30:54 CEST 2005


On 11/10/05, Anindya Mozumdar <anindya@REDACTED> wrote:
> Hi,
>     I am using ets:update_counter/3 to update a field in a table which
> has been created as follows :
>
> mnesia:create_table(my_table,[{disc_copies, [node()]},{attributes,
> record_info(fields, my_table)}])
>
> While ets:tab2list/1 confirms that the change has actually taken place,
> it is lost when I stop and start mnesia again ? Is there any way I can
> ensure that the change persists when I stop mnesia ?

You have to use mnesia:dirty_update_counter to update counter values
in mnesia tables. ETS is a volatile storage mechanism. If you call ETS
functions directly, it will bypass mnesia mechanisms to flush changes
to disk.

Chandru



More information about the erlang-questions mailing list