[erlang-questions] Accessing two versions of records when doing transform_table in mnesia

Hakan Mattsson <>
Fri Jul 18 10:00:36 CEST 2008


On Thu, 17 Jul 2008, devdoer bird wrote:

db> Thanks a lot.I still has one question .If the transform_table grabs
db> the table lock,then how does the mnesia support the hot-upgrade table
db> operation?  Because the transform table grabs table lock,the cocurrent
db> write opertion will be blocked until the tranform_table is done.

The "normal" usage of mnesia:transform_table/4 is to give a fun as
argument. The fun will then be used by Mnesia to perform the actual
transformation of each record within a transaction.

But you do also have the option to use 'ignore' instead of a fun.
Then the mnesia:transform_table/4 function will only perform the
schema transformation, leaving all records in the table in the old
format. When the mnesia:transform_table/4 function returns, the table
lock is released and you can iterate over the table yourself in order
to perform the transformation of each record.

/Håkan
---
Håkan Mattsson (uabhams)
Erlang/OTP, Ericsson


More information about the erlang-questions mailing list