<div dir="ltr">hello everyone:<div><br><div> 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.</div>
<div><br></div><div>%% code start %%</div><div><br></div><div><div>-module(m).</div><div>-compile(export_all).</div><div><br></div><div>-record(kv, {k, v}).</div><div><br></div><div>i() -></div><div> ok = mnesia:create_schema([node()]),</div>
<div> ok = mnesia:start(),</div><div> {atomic, ok} = mnesia:create_table(kv, [</div><div> {attributes, record_info(fields, kv)}, </div><div> {disc_only_copies, [node()]}</div><div> ]).</div><div><br>
</div><div>f() -></div><div> dets:verbose(),</div><div><br></div><div> % mnesia:transaction(fun() -></div><div> % mnesia:write(#kv{k=k1, v=v1}),</div><div> % mnesia:write(#kv{k=k2, v=v2})</div><div>
% end).</div><div><br></div><div> mnesia:dirty_write(#kv{k=k1, v=v1}),</div><div> mnesia:dirty_write(#kv{k=k2, v=v2}).</div><div><br></div><div>e() -></div><div> mnesia:dirty_read(kv, k1).</div><div><br></div>
<div>%% code end %%<br></div><div><br></div><div><br></div><div>%% operation start %%</div><div><br></div><div><div><div>Erlang R16B01 (erts-5.10.2) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]</div>
<div><br></div><div>Eshell V5.10.2 (abort with ^G)</div><div>1> m:i().</div><div>{atomic,ok}</div><div>2> m:f().</div><div>ok</div><div>3> % below will occur in 5 seconds if set "dets:verbose()"</div><div>
=ERROR REPORT==== 16-Jul-2013::14:39:04 ===</div><div>** dets: Corrupt table kv: {error,</div><div> {bad_object_header,</div><div> "/home/tux/Mnesia.nonode@nohost/kv.DAT"}}</div>
<div><br></div><div>3> m:e().</div><div>{error,{bad_object_header,"/home/tux/Mnesia.nonode@nohost/kv.DAT"}}</div><div>4> </div></div></div></div></div><div><br></div><div>%% operation end %%<br></div></div>