Re: DETS table auto_save behaviour

Frank Muller <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CAFA6GnBus-cKJfT9ehJ4MJURvGYzAdpGDP7uQeWVukP4EOt3Bw@mail.gmail.com>
This question always puzzled me.
Does Mnesia rely on the same assumptions?

/Frank

<[email protected]> a écrit :

>
> Hi,
>
> I am unsure about the behaviour of DETS regarding saving.
>
> The documentation indicates:
>
>     all operations performed by Dets are disk operations
>
> Which seems to hint that every single insertion ends up on disk. Good.
>
> But then:
>
>     {auto_save, auto_save()} - The autosave interval. If the interval is
>     an integer Time, the table is flushed to disk whenever it is not
>     accessed for Time milliseconds. A table that has been flushed
>     requires no reparation when reopened after an uncontrolled emulator
>     halt.
>
> This is ambiguous: does it means that entries will be buffered in memory
> and only written to disk during the auto save operation (therefore some
> operations are not actually disk operations), or does it mean that DETS
> always writes to disk without sync-ing (using fsync or equivalent), and
> synchronization occurs during the auto save operation ?
>
> In any case, am I correct in assuming that DETS does not offer any way
> to guarantee that entries are actually written on disk, meaning that an
> application crash would lead to a loss of every entry written since the
> last auto_save operation ?
>
> I was hoping to use DETS as a local persistent buffer in case data
> cannot be written to a remote database, but it seems impossible to
> guarantee that every entry is being sync-ed to disk.
>
> Thank you in advance.
>
> Regards,
>
> --
> Nicolas Martyanoff
> http://snowsyn.net
> [email protected]
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.