[erlang-questions] Unable to create Mnesia table
Wed Oct 8 16:33:37 CEST 2014
I recently converted an existing application to a release using relx. After
that the application isn't able to create any Mnesia tables. I can't
reproduce the problem in the Erlang shell (except by creating the table
before creating the schema). This is confusing because the app code creates
the schema prior to creating the table.
Here is the error:
12:20:18.929 [info] Creating a new schema from scratch...
12:20:18.929 [info] Mnesia started, creating tables...
12:20:18.929 [info] Attempting to create table with TableDef
12:20:18.931 [error] gen_server pe_membership terminated with reason: bad
Here's the associated application code:
error_logger:info_msg("Creating a new schema from scratch...~n"),
%% TODO: TEMP WORKAROUND TO DEBUG MNESIA SCHEMA CREATION PROBLEM
application:set_env(mnesia, dir, "/var/data/prospero"),
error_logger:info_msg("Mnesia started, creating tables...", ),
case create_tables(pe_migrate:get_schema()) of
The line application:set_env(...) was added in case the Mnesia directory
wasn't getting created properly due to the move to a relx-built release. I
had a similar entry in vm.args that I may have gotten wrong (-mnesia dir
'"/var/data/prospero"'). Interestingly enough, I don't see any artifacts
associated with the schema creation in the Mnesia dir (e.g., schema.DAT).
I'm wondering if this is a clue as to what the cause is.
pe_migrate:get_schema()) returns a list of TableDefs. create_tables
iterates through that list creating the tables one at a time. The failure
occurs when attempting to create the first table.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions