[erlang-questions] time-limited mnesia operations

Dmitriy Kargapolov dmitriy.kargapolov@REDACTED
Tue Jan 20 01:37:46 CET 2009

We have to limit in time heavy set of mnesia updates. If update or load was
not completed in scheduled period of time, it just does not make sense to
continue database operation, wasting resources. We'd like to break process
in that case and make sure database will not be broken (but it may be
inconsistent from application point of view), and will be ready for future
cleanup and load.
I guess this could be easy to implement in transactional context, but I need
this to be done in dirty context as well, including dirty_sync.
I could come up with something like this:
Pid = spawn_link( fun() ->
end ),
timer:exit_after(Time, Pid, timeout).
But I'm not sure how much atomic is mnesia:dirty_write call, wouldn't be
mnesia broken on some lower level if process Pid get signal in the middle of
write operation.
More complex case would be use of mnesia:sync_dirty() call and at least two
Does anybody has experience of safe breaking "hanging" updates?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090119/20a11279/attachment.htm>

More information about the erlang-questions mailing list