mnesia no disk write after restart

Michael McDaniel <>
Wed Apr 19 10:35:58 CEST 2006


On Mon, Apr 17, 2006 at 07:09:24PM -0400, Vance Shipley wrote:
> On Mon, Apr 17, 2006 at 02:42:08PM -0700, Michael McDaniel wrote:
> }  
> }  I am grateful for any insight on the particular point of why
> }  '-config sys.config' breaks mnesia, though.  Even though it
> 
> 
> The syntax is '-config sys'.
> 
> 	-Vance
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

 Oh, thank you, I see what you mean.  From erl -man erl ...

"
 -config Config:
     Specifies the name of a configuration file, Config.config, 
     which is used to configure  applications. See app(4) and
     application(3).
"

 Not close enough reading on my part the first time around.

 However, '-config sys.config' is working when running the module
 from my script; -config sys.config properly points the module to
 use the directory defined in sys.config (and also, I added 
 {dump_log_time_threshold, 30000} and from running 
 mnesia:system_info(all) I could see the time was actually changed
 from the default 180000.


 Recall from original post, the content of sys.config is


 [{mnesia, [{dir, "/home/erl/Mnesia.block"}  ,
 %%           {debug, trace}                 ,
            {schema_location, disc}]}].



 The problem is that when I start the observer program as 

   erl -sname fu -config sys.config -s file script checkblock \
       -s erlang halt

 then mnesia will no longer write to disk *from the previously started
 and running module*.  I believe the -config sys.config is getting
 properly read due to tests.

 However, starting the observer program as

 erl -sname fu -mnesia extra_db_nodes [] \
     -s file script checkblock -s init stop

 works fine and mnesia continues to write to disk fine from the 
 previously started and running module.

 The original running module and the observer module are both started
 with different -sname nodename.  My shallow understanding of how this
 works is that the observer node communicates with mnesia as well as
 to the node which created the database.  And that by providing the
 directory path of the database to the observer node, things break;
 the observer node is using mnesia ram_only and somehow that gets
 carried over to the database when providing the directory path.

 Anyway, that is what I have concluded.  Whether or not it is 
 mnesia design behaviour or a bug, that is what appears to be
 happening.

 I have the combination that works for me; I would still would like
 to understand the mechanism by which providing the  directory path
 of the database to the observer program causes mnesia to henceforth
 be a ram_only database (even from the originally started and running
 module which created the database and which is listed from
 mnesia:system_info(all) as a disc_copy node).


 Contents of checkblock are...

 
     mnesia:start().
     timer:sleep(200).
     mnesia:wait_for_tables([ip,schema], 7000) ,
     X = block:dirty_sorted_list_table_localtime().
     Z = global:registered_names().
     io:format('~p~n~p entries~nregistered names: ~p~n', [X, length(X), Z]).
     mnesia:stop().



 If anyone would like more context, please see my previous (to this)
 post on this subject.


~Michael



More information about the erlang-questions mailing list