[erlang-questions] mnesia bug?

王运涛 wyt.daily@REDACTED
Tue Jul 16 08:53:19 CEST 2013

hello everyone:

     i got an error when using mnesia, but this error only occur on my
archlinux (table type must be disc_only_copies),  everything is ok when on
centos or windows, is it a mnesia bug? below is the code and operation.

%% code start %%


-record(kv, {k, v}).

i() ->
    ok = mnesia:create_schema([node()]),
    ok = mnesia:start(),
    {atomic, ok} = mnesia:create_table(kv, [
        {attributes, record_info(fields, kv)},
        {disc_only_copies, [node()]}

f() ->

    % mnesia:transaction(fun() ->
    %     mnesia:write(#kv{k=k1, v=v1}),
    %     mnesia:write(#kv{k=k2, v=v2})
    % end).

    mnesia:dirty_write(#kv{k=k1, v=v1}),
    mnesia:dirty_write(#kv{k=k2, v=v2}).

e() ->
    mnesia:dirty_read(kv, k1).

%% code end %%

%% operation start %%

Erlang R16B01 (erts-5.10.2) [source] [64-bit] [smp:4:4] [async-threads:10]
[hipe] [kernel-poll:false]

Eshell V5.10.2  (abort with ^G)
1> m:i().
2> m:f().
3> % below will occur in 5 seconds if set "dets:verbose()"
=ERROR REPORT==== 16-Jul-2013::14:39:04 ===
** dets: Corrupt table kv: {error,

3> m:e().

%% operation end %%
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130716/3297b2e3/attachment.htm>

More information about the erlang-questions mailing list