Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why not add an (optional) sync before exiting? #13

Open
RJVB opened this issue Jan 7, 2019 · 4 comments
Open

why not add an (optional) sync before exiting? #13

RJVB opened this issue Jan 7, 2019 · 4 comments

Comments

@RJVB
Copy link

RJVB commented Jan 7, 2019

I was discussing EMD with some data reliability experts, found we agreed it would be a good idea to do a single sync() before exiting and we wondered why this wasn't yet implemented.

Of course sync() will flush all filesystems making it potentially more expensive than necessary but most of the time it shouldn't cost a lot while making EMD a lot safer in theory. Evidently one could make such a final sync optional, or allow to deactivate it (via an env. variable for instance).

A library destructor function (attribute(destructor)) appears to be unreliable for this, but exit() can be overloaded exactly like the other functions.

I can make a PR if there's interest for this.

@laurynas-biveinis
Copy link
Contributor

Since one of the use cases for libeatmydata is speeding up database testing, I wonder how much extra syncing this would result with PostgreSQL process-per-connection design

@RJVB
Copy link
Author

RJVB commented Jan 8, 2019 via email

@dermoth
Copy link

dermoth commented May 28, 2020

Why not run sync after the application has finished? It could also be implemented as a wrapper script, but please don't make this the default. I've seen systems take hours to complete a single sync() because of the sheer amount of dirty data and the nonstop writes - surely if I used libeatmydata for an app on them that would be to avoid impact to the block devices and I would never want to flush GB's of dirty buffers at the end!

@dermoth
Copy link

dermoth commented Oct 9, 2021

Another option that would be quite nice, allowing to disable libeatmydata using env. For fun I added libeatmydata.so /etc/ld.so.preload (including on initrd) on a very slow test system so the entire system runs libeatmydata. but I would like to be able to tell it when to sync the fs anyway (ex before a reboot in case it would spend too much time syncing and timeout before everything is flushed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants