classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view


Fredrik Linder-2
Hi mnesia/otp folks,

Here is a patch for the following, and I hope it works as expected (I have only perfoemd minor tests).

Is there any chance that it is added to the next release of mnesia?

[patch: exported functions]

Is there a reason why mnesia_schema:do_multi_create_table/1 is not exported while the mnesia_schema:do_create_table/1 is?

The reason why I've been loking at it is that I want to create several tables under one schema_transaction, and that is not possible using neither mnesia:create_table/2 nor mnesia_schema:create_table/1.

[patch: transaction vs. activity]

Another issus is that I use mnesia_frag, and the mnesia_schema uses a 'normal' transaction/1, where (in this case) I believe it should use activity/4.

schema_transaction/4 is added in the patch.

[patch: faulty error handling]

Also, the error handling code for schema_transaction/1 is invalid. The process that is spawn within schema_transaction/1 is first linked and later unlinked (before the given fun is applied) from the new process, this means that the original process cannot ever receive an {'EXIT', Pid, Reason} even if it does trap exits (which it is silently assumed to do). The result is that the client process hangs forever if the new process crashes.

The provided patch uses spawn/1 and erlang:monitor/2 instead of spawn_link/3.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: mnesia_schema.erl.diff
Type: application/octet-stream
Size: 1908 bytes
Desc: mnesia_schema.erl.diff
URL: <>