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

devdoer bird devdoer2@REDACTED
Sat Jul 19 04:26:18 CEST 2008


2008/7/18, Hakan Mattsson <hakan@REDACTED>:
>
> 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.


OK.Thanks.In this way,I should program in if-else way to determine whether
current record is in old format or in new transformed format while
transforming. After the transform is done,I also shoulddelete the if-else
code to  read the all  records in new format .

/Håkan
> ---
> Håkan Mattsson (uabhams)
> Erlang/OTP, Ericsson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080719/cc034d1a/attachment.htm>


More information about the erlang-questions mailing list