I've got a case where I have a Mnesia database with tables written to the disk. When I stop my app and then restart it, mnesia:info() tells me
opt_disc. Directory "/my/directory/here" is NOT used.
and the corresponding mnesia:system_info(use_dir) is false. But mnesia:system_info(directory) returns the name of the correct directory and the files are there and it was using them just a minute ago. Is there a way to catch that at startup and tell it to use the existing data from disk?
If I check mnesia:table_info(schema, storage_type) it tells me ram_copies. If I then try mnesia:change_table_copy_type() it will write to disk, but ends up squashing all my data.
This was actually due to my own confusion. Our deployment process was wiping out the Mnesia directory and it was getting recreated at startup. So I didn't see it go away, but that's why my data was getting squashed.
use_dir was false, because there was no directory at that point. Then when I ran mnesia:change_table_copy_type() on the schema, it was creating the directory at that point, but it had no data.