[erlang-questions] Sync transaction vs dump log in mnesia

Dan Gudmundsson dgud@REDACTED
Tue Nov 8 08:04:46 CET 2016

Mnesia does not sync the log to disc during transactions at all, that is
too slow.

If you really need to sync your data/writes to disc use mnesia:sync_log(),
which gives
some more safety, though notice that the data may still only be in
harddrive caches.

mnesia:dump_log() can be used, but that also goes through the log file and
ditches out the writes to table files before returning, so that is really

sync_transaction and sync_dirty syncs the writes between other nodes before
returning to the user,
so when combining with a dirty_read on a remote node the data is available.
If you also use transaction protection on your 'read' it is not necessary
to use sync functions.


On Tue, Nov 8, 2016 at 6:24 AM ARUN P <arunp@REDACTED> wrote:

> Hi,
>       Can someone kindly describe me what is the difference between sync
> transaction and dump log in mnesia.?. Because in my application I am
> using mnesia database and I observed that soon after writing data into
> table, if the system restarts the data will not be persistent, And I am
> aware of the mnesia dump_log_time_threshold and dump_log_write_threshold
> and i don't want to change these thresholds for time being. To solve
> this problem I used mnesia:sync_transaction/1 but that also fails ( in
> the function description of mnesia:sync_transaction in Mnesia Reference
> Manual its been told that the data will be logged to disk ). But if I
> call mnesia:dump_log/0 function soon after the write operation and
> restart the system the data will be persistent.
> Thanks in advance,
> Arun
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161108/32b89321/attachment.htm>

More information about the erlang-questions mailing list