[erlang-questions] Re: Four ways to start mnesia in OTP environment. Which one should one use?
Sergey Samokhin
prikrutil@REDACTED
Sun Jul 5 20:34:15 CEST 2009
Hello, Steve.
Thanks for your answer.
> 1) When you intend to stop mnesia -- how are you sure that it's not
> being used by another application?
It's often possible, though it may require some additional steps to
take. There is at least one way to ensure that all of your
applications using mnesia terminated before mnesia has been stopped:
every application you start has to write #app{app = AppName, node =
node()} record during the initialization. Later you will be able to
check if some of the allowed applications are still running by looking
at #app{} records present in mnesia.
It only works if applications you're trying to "ping" that way are
written in a uniform manner, i.e. register themself through
mnesia:write(AppRecord). There must be also a corresponding function
unregistering dead apps in a safe/distributed manner. I don't think it
will be possible if one has decided to start mnesia as Included
Applcation.
> 2) Why would you stop your application (apart for development purposes
> or decommissioning)?
To dynamically reconfigure a cluster: add and remove some applications
on the fly. But I don't know what I should answer to "Why do you want
to stop mnesia?" =) Maybe because of the thought that all dependencies
one has started in init/1 has to be stopped in terminate/1.
> 3) Since Mnesia is an entire subsystem you could either put it in your
> application/applications requirement or ensure it's started in the
> application/mod supervisor startup call.
Does this mean that Included application is a wrong way?
--
Sergey Samokhin
More information about the erlang-questions
mailing list