wiki:MnesiaDB

Version 1 (modified by manualwiki, 13 years ago) (diff)

MnesiaDB page created

Using the Mnesia database back-end

You do not need additional command line arguments, as this back-end currently the default. After the system is installed, you can start RefactorErl? with

bin/referl

Alternatively, you can specify the database manually by typing

bin/referl -db mnesia

Mnesia uses the RefactorErl? data directory to store its data. You can specify it by typing

bin/referl -dir /path/to/your/data/dir

Note that if you would like to start several instances of RefactorErl/Mnesia, you currently have to specify different paths for the instances, as Mnesia stores the name of the node in the database. Obviously, you have to choose different node names as well.

bin/referl -sname name1 -dir /path/to/your/data/dir1
bin/referl -sname name2 -dir /path/to/your/data/dir2

# or

bin/referl -name name1 -dir /path/to/your/data/dir1
bin/referl -name name2 -dir /path/to/your/data/dir2

After the system is started, the following operations work on the full database.

% Clear the whole database.
ri:reset().

% Make a checkpoint.
ri:backup().

% Undo all changes made since the last backup.
ri:undo().

You can also use all querying and refactoring functionalities.

Comparison with the NIF back-end

Note that while the Mnesia back-end has been under development longer and can be expected to be more stable, it is much slower than the NIF based back-end; you can expect about an order of magnitude of speed-up. Also, the NIF back-end may require less storage. As an indication, loading ejabberd-2.1.8 (6.6 MB on disk) takes 18323 sec and 566 MB of RAM and 66 MB of disk space, while the NIF back-end on the same machine takes 458 sec and 556 MB of RAM and 52 MB of disk space.