Thanks your reply.

When I deep into NJS source you ponit to, I found something about GCC write
file flag with O_APPEND

I google Linux GCC write file O_APPEND to learn something.

In fact NJS fs.writeFileSync() with O_APPEND, it is atomic write file if
it's buffer just write all in one time. Even mutil process to write one
file use O_APPEND.

But, if write buffer can NOT write all in one time, in mutil process, it is
NOT atomic.

I found Nginx Log write is use O_APPEND to write atomic, even Nginx has a
lot of workers.

And

I read the source code by your link `write-file-atomic`, it is hard to port
to NJS. The reason is that NJS fs without fs.rename, and Nodejs write file
atomic use temp file rename and write queue to make it.

Thanks.

HENG <ourwait...@gmail.com> 于2018年10月20日周六 上午12:55写道:

> Thanks your reply.
>
> When I deep into NJS source you ponit to, I found something about GCC
> write file flag with O_APPEND
>
> I google Linux GCC write file O_APPEND to learn something.
>
> In fact NJS fs.writeFileSync() with O_APPEND, it is atomic write file if
> it's buffer just write all in one time. Even mutil process to write one
> file use O_APPEND.
>
> But, if write buffer can NOT write all in one time, in mutil process, it
> is NOT atomic.
>
> I found Nginx Log write is use O_APPEND to write atomic, even Nginx has a
> lot of workers.
>
> And
>
> I read the source code by your link `write-file-atomic`, it is hard to
> port to NJS. The reason is that NJS fs without fs.rename, and Nodejs write
> file atomic use temp file rename and write queue to make it.
>
> Thanks.
>
>
> --
> --------------------------------------------------------------------
> Heng
> ---------------------------------------------------------------------
> --
>


-- 
--------------------------------------------------------------------
Heng
---------------------------------------------------------------------
--
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Reply via email to