Hi,<br>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.<br>
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.<br>I could come up with something like this:<br><span style="font-family: courier new,monospace; color: rgb(0, 0, 153);">Pid = spawn_link( fun() -></span><br style="font-family: courier new,monospace; color: rgb(0, 0, 153);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 153);"> mnesia:dirty_write(Record),</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 153);"><span style="font-family: courier new,monospace; color: rgb(0, 0, 153);"> ...</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 153);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 153);"> mnesia:dirty_write(Record)</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 153);"><span style="font-family: courier new,monospace; color: rgb(0, 0, 153);">end ),</span><br style="font-family: courier new,monospace; color: rgb(0, 0, 153);">
<span style="font-family: courier new,monospace; color: rgb(0, 0, 153);">timer:exit_after(Time, Pid, timeout).</span><br>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.<br>
More complex case would be use of mnesia:sync_dirty() call and at least two nodes.<br>Does anybody has experience of safe breaking "hanging" updates?<br>Thanks.<br><br>