[erlang-questions] Watching mnesia transactions

Jayson Vantuyl kagato@REDACTED
Wed Feb 10 05:48:24 CET 2010


Don't forget that you may have transactions recovering after a failure.  I'm unsure exactly what that looks like, but it might actually be easier to go with the second option over the first.

On Feb 9, 2010, at 7:59 PM, Bernard Duggan wrote:

> Dan Gudmundsson wrote:
>> There is no way to get that info today without patching mnesia,
>> I think a variant of 'mnesia:subscribe' is the best solution.
>> 
> Thanks Dan, Ulf and Håkan for the answers (even if they weren't exactly
> what I wanted to hear :)).
> 
> I've taken a look at the option of a patch to or variant of the
> mnesia:subscribe system.  Basically I can think of two obvious choices:
> 
> * Add a new event category to subscribe(), in addition to 'system' and
> {table, ..., ...} - call it 'activity'.  When a transaction has finished
> committing, fire off a message like {activity_complete, ActivityID} to
> all subscribers.
> 
> * Add a new event category to subscribe() called 'transaction' (or
> something) which sends the full set of changes from a transaction, all
> batched up in a single event, when the transaction finishes committing. 
> That has the downside that in its simplest form you can't filter by
> tables you're interested in and would probably end up being considerably
> more complex to implement, so I'm inclined to go with the first option.
> 
> In both cases, the event would need to be sent at a point where the
> transaction is still running and holding locks, but where all the
> changes have been committed and we know the transaction isn't going to
> restart.  It looks like the appropriate place to do that would be as the
> final step of do_commit() (in mnesia_tm.erl) using an analogous method
> to mnesia_subscr:report_table_event().
> 
> So my question to those learned in this area is: Does this sound like a
> vaguely workable idea, or am I missing/misunderstanding something
> fundamental?
> 
> Cheers,
> 
> Bernard
> 
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
> 

-- 
Jayson Vantuyl
kagato@REDACTED



More information about the erlang-questions mailing list