[erlang-questions] Iterate over fragmented table

Khitai Pang <>
Wed Dec 28 21:59:00 CET 2016


Code used for iteration:

F = fun() ->
             mnesia:foldl(IterFun, [], report_timestamp)
     end,
mnesia:activity(sync_transaction, F, [], mnesia_frag).


Thanks
Khitai

On 2016/12/29 04:52, Khitai Pang wrote:
> Hi,
>
> Exception is thrown when using mnesia:foldl/3 to iterate over a
> fragmented table:
>
> mnesia:foldl(Iterator, [], report_timestamp)
>
>       exception throw: {badarg,
>                            [{ets,match_object,
>                                 [5849148,
>                                  {{locks,report_timestamp_frag37,
>                                       '______WHOLETABLE_____'},
>                                   '_'}],
>                                 []},
>                             {mnesia_locker,need_lock,4,
> [{file,"mnesia_locker.erl"},{line,882}]},
>                             {mnesia_locker,rlock,3,
> [{file,"mnesia_locker.erl"},{line,1036}]},
>                             {mnesia,init_iteration,4,
>                                 [{file,"mnesia.erl"},{line,1042}]},
> {mnesia,foldl,6,[{file,"mnesia.erl"},{line,969}]},
> {lists,foldl,3,[{file,"lists.erl"},{line,1263}]},
>                             {mnesia_tm,apply_fun,3,
>                                 [{file,"mnesia_tm.erl"},{line,836}]},
>                             {mnesia_tm,execute_transaction,5,
>                                 [{file,"mnesia_tm.erl"},{line,811}]}]}
>
>
> Why is this happening?  Is this the correct way to iterate over a
> fragmented table?
>
> Erlang version is 19.2.
>
>
> Thanks
> Khitai
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list