[issue39640] fall back os.fdatasync() to fsync() on POSIX systems without fdatasync() support

2022-03-19 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

The os module provides a pretty low level simple shim over platform APIs. It is 
better for logic like this to live in a higher level application library rather 
than make big assumptions on the part of the user.

```
try:
os.fdatasync(fd)
except Exception as err:
logging.debug("fdatasync(fd) failed %s, falling back to fsync(fd)", err)
os.fsync(fd)
```

--
nosy: +gregory.p.smith
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed
type:  -> enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39640] fall back os.fdatasync() to fsync() on POSIX systems without fdatasync() support

2022-03-19 Thread Cebtenzzre


Change by Cebtenzzre :


--
nosy: +cebtenzzre

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39640] fall back os.fdatasync() to fsync() on POSIX systems without fdatasync() support

2020-10-20 Thread Ned Deily


Change by Ned Deily :


--
nosy: +ronaldoussoren

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39640] fall back os.fdatasync() to fsync() on POSIX systems without fdatasync() support

2020-08-23 Thread George Melikov


George Melikov  added the comment:

PR rebased and ready to review.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39640] fall back os.fdatasync() to fsync() on POSIX systems without fdatasync() support

2020-02-15 Thread George Melikov


George Melikov  added the comment:

I want to add that it's a usual practice:
- 
https://github.com/libuv/libuv/pull/1580/files/bdd987a9b4347164e31e22d2d5ce06fbb5ebc859
- 
https://rev.ng/gitlab/revng/qemu/commit/6f1953c4c14566d3303709869fd26201828b3ccf

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39640] fall back os.fdatasync() to fsync() on POSIX systems without fdatasync() support

2020-02-15 Thread George Melikov


George Melikov  added the comment:

If there is a way not to sync data - you should use neither fdatasync nor fsync.

So IMHO if someone wants to sync data and want to use fdatasync - I see the 
only way on MacOS is to use fsync().

> Note also that this change will not help to run code with fdatasync() on 
> MacOS without fallbacks in Python code until you drop support of all Python 
> versions older than 3.9.

I agree, but I propose to make this change in 3.9 to get it somewhere in future.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39640] fall back os.fdatasync() to fsync() on POSIX systems without fdatasync() support

2020-02-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

fsync() may be slower than fdatasync(). There may be cases in which you prefer 
to not call fsync() or call it less often if POSIX fdatasync() is not 
available. To do this you should know whether Python fdatasync() calls POSIX 
fdatasync() or fsync(). The simplest way to provide this information to user is 
to not provide os.fdatasync() in the underlying system call is not available.

Note also that this change will not help to run code with fdatasync() on MacOS 
without fallbacks in Python code until you drop support of all Python versions 
older than 3.9.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39640] fall back os.fdatasync() to fsync() on POSIX systems without fdatasync() support

2020-02-15 Thread George Melikov


Change by George Melikov :


--
keywords: +patch
pull_requests: +17893
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18516

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39640] fall back os.fdatasync() to fsync() on POSIX systems without fdatasync() support

2020-02-15 Thread George Melikov


New submission from George Melikov :

POSIX fdatasync() is similar to fsync() but it tries not to sync non-needed 
metadata. If POSIX OS doesn't have it - it's safe to use fsync() (If we need to 
sync data to disk - we have to use one of these functions).

This change will help to run code with fdatasync() on MacOS without fallbacks 
in Python code.

I'll propose a PR soon.

--
components: IO
messages: 362025
nosy: gmelikov
priority: normal
severity: normal
status: open
title: fall back os.fdatasync() to fsync() on POSIX systems without fdatasync() 
support

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com