[erlang-questions] Unable to create Mnesia table

Youngkin, Rich richard.youngkin@REDACTED
Wed Oct 8 16:33:37 CEST 2014


Hi all,

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
{pe_properties,{disc_copies,[{attributes,[key,value]},{record_name,pe_kvpair}]}}
12:20:18.931 [error] gen_server pe_membership terminated with reason: bad
return value:
{error,{unable_to_init_schema,{aborted,{bad_type,pe_properties,disc_copies,'
prospero@REDACTED'}}}}


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"),

      mnesia:create_schema([node()]),

      mnesia:start(),

      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.

Thanks, Rich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20141008/af55300b/attachment.htm>


More information about the erlang-questions mailing list