[erlang-questions] Erlang and fsync

Magnus Ahltorp map@REDACTED
Sun Aug 3 02:07:59 CEST 2014


2 aug 2014 00:54 Wojtek Narczyński <wojtek@REDACTED> wrote:

> On 01.08.2014 16:32, Magnus Ahltorp wrote:
>> How do people solve this, or don't other people using Erlang want (soft) guarantees that their data is on disk? Do I have to write the code in C and send the files to be fsync:ed over a port?
>> 
>> 
> I would say that for 'soft' guarantees you don't have to do anything, it's already there in the operating system.

On some operating systems, it might take a very long time for data to reach the disk, and that is not acceptable in my case. By "soft", I meant that the operating system has done all it can to ensure that the data is permanently stored, but of course the disk can choose not to obey that (which many disks choose to). There is a difference between "reached the disk" and "permanently stored".

>> Do I have to write the code in C and send the files to be fsync:ed over a port?
> I'd look at fixing file:open to allow opening directories first. Or better, look at prim_file, as file is useless for any serious IO, it serializes everything.

But prim_file is not documented, and also refuses to open directories:

Eshell V6.1  (abort with ^G)
1> prim_file:open("/tmp", [read]).
{error,eisdir}

And regarding changing the Erlang libraries, that is interesting looking forward, but this has to work now, without patching Erlang locally, so my question stands: "How do people solve this?".

/Magnus




More information about the erlang-questions mailing list