Skip to content

Conversation

@gmelikov
Copy link

@gmelikov gmelikov commented Feb 15, 2020

…t fdatasync() support

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 helps to run code with fdatasync() on MacOS without fallbacks
in Python code.

That it's a usual practice:

Signed-off-by: George Melikov mail@gmelikov.ru

https://bugs.python.org/issue39640

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@gmelikov

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@gmelikov
Copy link
Author

Don't know why bot thinks that CLA not signed, I've signed it.

Screenshot 2020-02-15 at 22 34 32

@codecov
Copy link

codecov bot commented Feb 15, 2020

Codecov Report

Merging #18516 into master will increase coverage by 1.08%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #18516       +/-   ##
===========================================
+ Coverage   82.11%   83.20%    +1.08%     
===========================================
  Files        1955     1571      -384     
  Lines      588856   414730   -174126     
  Branches    44427    44456       +29     
===========================================
- Hits       483559   345065   -138494     
+ Misses      95647    60019    -35628     
+ Partials     9650     9646        -4     
Impacted Files Coverage Δ
Lib/distutils/tests/test_bdist_rpm.py 30.00% <0.00%> (-65.00%) ⬇️
Lib/distutils/command/bdist_rpm.py 7.63% <0.00%> (-56.88%) ⬇️
Lib/test/test_urllib2net.py 76.92% <0.00%> (-13.85%) ⬇️
Lib/test/test_smtpnet.py 78.57% <0.00%> (-7.15%) ⬇️
Lib/ftplib.py 63.85% <0.00%> (-6.06%) ⬇️
Lib/test/test_ftplib.py 87.11% <0.00%> (-4.72%) ⬇️
Tools/scripts/db2pickle.py 17.82% <0.00%> (-3.97%) ⬇️
Tools/scripts/pickle2db.py 16.98% <0.00%> (-3.78%) ⬇️
Lib/test/test_socket.py 71.94% <0.00%> (-3.77%) ⬇️
Lib/distutils/tests/test_bdist_msi.py 56.25% <0.00%> (-3.75%) ⬇️
... and 469 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0fa4f43...1992c5e. Read the comment docs.

@brettcannon
Copy link
Member

@gmelikov this is being flagged as unsigned because you have changes made to the PR by a user named "gmelikov-mcs" which has not signed the CLA.

@gmelikov
Copy link
Author

@brettcannon ah, my bad! Thank you, fixed and rebased.

…t fdatasync() support

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 helps to run code with fdatasync() on MacOS without fallbacks
in Python code.

Signed-off-by: George Melikov <mail@gmelikov.ru>
@pganssle pganssle removed their request for review August 22, 2020 20:50
@gmelikov
Copy link
Author

Rebased and ready to review.

@vsajip vsajip removed their request for review August 23, 2020 12:16
@brettcannon brettcannon removed their request for review August 24, 2020 19:18
@encukou encukou requested review from ronaldoussoren and removed request for encukou October 20, 2020 12:14
@encukou
Copy link
Member

encukou commented Oct 20, 2020

I'm not familiar with MacOS, so I don't feel comfortable merging this – especially without tests.

Tagging Ronald, who is working on macOS and might be or know the right person to review this.

@methane methane removed their request for review October 26, 2020 06:53
@tiran tiran removed their request for review April 17, 2021 21:25
@hugovk
Copy link
Member

hugovk commented Apr 9, 2022

Closing as @gpshead rejected https://bugs.python.org/issue39640 on 2022-03-20:

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)

@hugovk hugovk closed this Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants