[erlang-questions] mnesia bug?

yt w wyt.daily@REDACTED
Wed Jul 17 12:48:37 CEST 2013


hello everyone:

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

%% code start %%

-module(m).
-compile(export_all).

-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() ->
    dets:verbose(),

    % 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().
{atomic,ok}
2> m:f().
ok
3> % below will occur in 5 seconds if set "dets:verbose()"
=ERROR REPORT==== 16-Jul-2013::14:39:04 ===
** dets: Corrupt table kv: {error,
                               {bad_object_header,
                                   "/home/tux/Mnesia.nonode@REDACTED/kv.DAT"}}

3> m:e().
{error,{bad_object_header,"/home/tux/Mnesia.nonode@REDACTED/kv.DAT"}}
4>

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


More information about the erlang-questions mailing list