Mnesia, disk logging, and synchronous disk logging

Hakan Mattsson <>
Tue Jan 24 16:36:39 CET 2006


On Mon, 23 Jan 2006, Scott Lystig Fritchie wrote:

SLF> Howdy.  Is there a difference of opinion/definition on what
SLF> "synchronous" in Mnesia's synchronous disk logging means?
SLF> 
SLF> In the context of disc_copies tables ... it seems to me that Mnesia's
SLF> use of the phrase means:
SLF> 
SLF>     * The transaction coordinator waits synchronously for 2PC votes
SLF>       from all participants.

In Mnesia the coordinator does always wait
synchronously for 2PC (and 3PC) votes from all
participants, regardless of the transaction being
"synchronous" or not.

In "synchronous" transactions", the coordinator does
also wait for the participants to complete their part
of the commit work in the transaction before the
control is returned to the caller.

SLF>     * Each participant uses disk_log:log/2 or disk_log:blog/2 to
SLF>       record local votes and commit/abort decisions, but participants
SLF>       are *not* using the disk_log:sync/1 to force the log to disk.

Correct.

SLF> The disk_log:sync/1 function has an extremely high penalty, but
SLF> sometimes that penalty is worth the cost.  For example, some
SLF> read+write transactions may contain data that you *really* do not want
SLF> to lose.  For data that important, if all replicas suddenly lose
SLF> power, it is possible to lose the logs and thus the newly-updated data
SLF> before it is written safely to disk on each replica machine.

I agree that such a feature can be useful.
At least if the there are no write caches
enabled in the disk hardware. Otherwise
you could lose some data anyway in case
of a power failure.

SLF> But I can't find a Mnesia transaction knob/button that I can
SLF> twist/press to request that level of safety.  Is there such a thing?

No currently there are no such thing in Mnesia.

/Håkan


More information about the erlang-questions mailing list