[erlang-questions] Mnesia activity callback system context

Ulf Wiger <>
Thu Jan 14 00:12:26 CET 2010


Bernard Duggan wrote:
> Hi List,
>     Is it the case that mnesia activity callbacks are guaranteed to
> execute in the same process that is performing the transaction? 

Yes.

 > I can't
> find any mention of it in the docs.  I ask because if it's not, it
> doesn't seem like there's any way to get an arbitrary piece of
> information from the latter process to the one in which the callbacks
> execute, and that significantly limits their usefulness for a couple of
> things I'd like to do.  (I had written a long email explaining those
> things, but if the answer to this question is "yes" then I can save us
> all a lot of time :))
>     Even if the answer is "yes", it still seems like the only way would
> be to use the process dictionary - fine if that's the case, but it seems
> like there "should" be a neater way.

The rdbms contrib (Jungerl) is probably one of the more ambitious
examples of mnesia AccessMod exploits out there, and it makes heavy
use of the process dictionary.

I also did use parameterized modules once (I don't think I ever
committed it to jungerl, though), when I wanted to make mnesia
support writing to a table in the same (schema) transaction
that was used to create the table. That required some rewrites of
mnesia.erl and mnesia_tm.erl, though. Using the process dictionary
is less invasive.

BR,
Ulf W
---------------------------------------------------

---------------------------------------------------

WE'VE CHANGED NAMES!

Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.

www.erlang-solutions.com



More information about the erlang-questions mailing list