[erlang-questions] mnesia silent failure and table corruption

Janos Hary janos.n.hary@REDACTED
Tue Aug 27 15:05:58 CEST 2013


All,

I started to write records into a table from a simple test function. When
the table size reaches 2GB write transactions still report success, but they
are silently ignored. The table became unusable, read operations return
error, and mnesia cannot recover the table. How shall I avoid such
situation?

I use R16B01 x64 SMP on Windows 7.

The table creation code:
mnesia:create_table(tab2,
		[
		 {record_name, trec},
		 {attributes, record_info(fields, trec)},
		 {disc_only_copies, [node()]}
		])

My write function:
write_transaction(Tab, Trec) ->
	F = fun () ->
				mnesia:write(Tab, Trec, write)
		end,
	case mnesia:transaction(F) of
		{atomic, ok} ->
			ok;
		_ ->
			error
	end.

After reaching 2GB:
(test@REDACTED)25> db_test:read_transaction(tab1, 1).
{atomic,{error,{{bad_object,read_buckets},
                "d:/db_test/tab1.DAT"}}}

(test@REDACTED)27> application:start(mnesia).        
dets: file "d:/db_test/tab2.DAT" not properly closed, repairing ...

=ERROR REPORT==== 27-Aug-2013::11:24:18 ===
Mnesia(test@REDACTED): ** ERROR ** (core dumped to file:
"c:/work/dirXDS5/MnesiaCore.test@REDACTED")
 ** FATAL ** {error,{"Cannot open dets table",tab2,
                     [{file,"d:/db_test/tab2.DAT"},
                      {keypos,2},
                      {repair,true},
                      {type,set}],
                     {no_more_space_on_file,"d:/db_test/tab2.DAT.TMP"}}}

=ERROR REPORT==== 27-Aug-2013::11:24:28 ===
Mnesia(test@REDACTED): ** ERROR ** mnesia_event got unexpected event: {'EXIT',
 
<0.4288.0>,
 
killed}

=INFO REPORT==== 27-Aug-2013::11:24:28 ===
    application: mnesia
    exited: {killed,{mnesia_sup,start,[normal,[]]}}
    type: temporary
{error,{killed,{mnesia_sup,start,[normal,[]]}}}

Thanks for your help.
Janos





More information about the erlang-questions mailing list