Skip to content

(Optional) enforce of file storage sync via fsync() #371

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

Closed
drproktor opened this issue Mar 10, 2022 · 0 comments
Closed

(Optional) enforce of file storage sync via fsync() #371

drproktor opened this issue Mar 10, 2022 · 0 comments

Comments

@drproktor
Copy link
Contributor

To avoid (or at least reduce) database file corruption on system failures like a hard power off, having means to enforce a storage sync via fsync() would be great.

Background

I am currently using JsonDB on a Raspberry Pi and the database file is stored in an ecryptfs encrypted folder. In this scenario a hard power-off after a write to the JsonDB results in reproducable file corruptions. I.e. when mounted again the database file is corrupt and can't be decrypted by ecryptfs correctly. Since ecryptfs is a stacked filesystem, my explanation is that the OS does some additional buffering here and postpones the actual write to storage longer than it does e.g. when running directly on a Ext4 filesystem.

I already prepared a patch which I would be happy to contribute.

drproktor added a commit to drproktor/node-json-db that referenced this issue Mar 10, 2022
Belphemur pushed a commit that referenced this issue Sep 9, 2022
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

2 participants