[erlang-questions] mnesia sync_transactions not fsynced?
Thu Oct 27 15:57:17 CEST 2011
On Thu, Oct 27, 2011 at 2:30 PM, Matthew Sackman <matthew@REDACTED> wrote:
> On Thu, Oct 27, 2011 at 02:17:07PM +0200, Håkan Mattsson wrote:
>> A call to disk_log:sync would increase the probability for the committed data to
>> be stored on durable media, but there is no guarantee. The data may still be
>> lost in case of a hard reboot or a power failure. Write caches are evil in this
> Yes, but you can turn off disk write caches with other tools. People who
> actually care about the data getting to disk when it's claimed it's been
> written to disk are very likely to understand the performance
> implications of that. Mnesia currently prevents any such configuration.
> Ideally, there should be a mechanism whereby mnesia could be configured,
> maybe even on a txn-by-txn case as to whether you really want it to hit
I think that it is better that such a flag would be per table and not a
parameter to the transaction. If at least one of the tables involved in
the transaction has the flag, it should imply that disk_log:sync is invoked
for the entire transaction.
> Just out of interest, given this behaviour, what is the point of
> mnesia:sync_transation, as it does not actually sync to disk? In rabbit
> we use it so to guarantee that dirty_reads on other nodes are guaranteed
> to observe the new values after the sync_transaction returns, but is
> this the only purpose?
The "sync" in sync_transaction is not related to hard disks. It refers to that
the transaction function returns when the transaction has been committed
on all nodes. But even if ordinary transactions may return earlier, it will not
effect the consistency of the database.
More information about the erlang-questions