rust-json-file-store icon indicating copy to clipboard operation
rust-json-file-store copied to clipboard

Force flush changes to filesystem

Open felipesere opened this issue 5 years ago • 3 comments

👋 Thank you for writing JFS! I am using it as an alternative store for a side project. While running my tests, I noticed that my delete case would sporadically fail. It does a bunch of inserts, then a bunch of deletes and then reads to see if they still there.

I think adding a f.sync_all()? at the end of save_object_to_file should at least alleviate the case.

I can open a PR if you want.

felipesere avatar Feb 19 '20 07:02 felipesere

Thanks for reporting!

I can open a PR if you want.

That would be awesome! :+1:

flosse avatar Feb 19 '20 09:02 flosse

I added the alleged f.async_all() and it didn't really help. :(

My tests pass if I have a different file per running test. I am not 100% if Rust runs the tests concurrently?

felipesere avatar Feb 19 '20 22:02 felipesere

@felipesere Could you add a testcase to reproduce the behavior? I can't find a way to provoke this bug :(

flosse avatar Feb 22 '20 13:02 flosse