I am still trying to deeply understand what one can do with Mnesia, and answers to these two questions would greatly help.
1) What happens if one process does an atomic transaction with respect to Record X while some other process does a dirty transaction involving that same record. Are the first processes' ACID properties compromised?
2) Is there a way for the same process to hold a non-dirty (mnesia:transaction/1) read-lock on one table's row, while simultaneously doing a dirty operation on another table?
Isolation guarantees are lost in a database environment that allows dirty operations, as Mnesia does. So the answer to question 1) is yes, the well-behaved transactional process is potentially compromised by the concurrent dirty operation, and vice versa - a dirty read for example could return "old" or even freshly deleted data, while the danger inherent in dirty writes is obvious.
In your second scenario, the answer is yes for two reasons: only the data object you're reading is locked AND only your local copy at that! Which is generally a fine and useful thing , and allows even concurrent transactions on other data objects (including other tables of course) to take place.
Erlang Mnesia docs, Chapter 4
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With