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

Improve behavior to prevent data loss #60

Open
BoboTiG opened this issue Jul 9, 2024 · 1 comment
Open

Improve behavior to prevent data loss #60

BoboTiG opened this issue Jul 9, 2024 · 1 comment

Comments

@BoboTiG
Copy link
Contributor

BoboTiG commented Jul 9, 2024

Hello,

I really like the project, and using it quite intensively (my program runs 24/24, all weeks, without interruption).

And from time to time (it happened 3 times in the past 6 months), databases are messed up. The first time, some files were simply emptied. Other times, it is like if the writing into the file was interrupted at some point. The latter might be an issue when writting to the file while a computer is having hard time with the HDD or simply shutting down.

To give more details, I do not use threads into that program. But I might have the program running at the same time twice. And most of the time, it works just fine because database files are accessed only on-demand (they are not kept in-memory for the whole runtime, correct?).

I did not succeed at producing some code to help reproducing the issue. But it is quite a big issue for me, as I store sensible data in those files, and loosing that is not an option. I added regular backups since the first "crash", but still, I think a solution could be found to improve the robustness of the library.

Without being able to reproduce on-demand, it's not easy to think about a solution. What I've come up so far:

  1. ensure locks are goods, efficient, and persistent (cf Better locking #12 if I understood correctly?)
  2. when writing to the file, maybe using a temporary one that can be renamed in a second time to replace the original one (while writing the idea, I get it could be not what we want haha)
  3. tell me you have ideas? :)

Anyway, great library!

@BoboTiG
Copy link
Contributor Author

BoboTiG commented Jul 9, 2024

I am using the latest version (2.5.0), and hit the same issue when using older ones too (I keep my dependencies up-to-date via dependabot).

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

1 participant