piskvorky / sqlitedict

Persistent dict, backed by sqlite3 and pickle, multithread-safe.
Apache License 2.0
1.17k stars 131 forks source link

Add a blocking commit after each modification if autocommit is enabled. #94

Closed endlisnis closed 4 years ago

endlisnis commented 5 years ago

This change modifies how "autocommit" works. It forces each modification to block until the commit is complete. Without this, if the program exited after modifying the sqlitedict, the changes might not make it to disk. With this change, all changes are guaranteed to be on disk before the modification action returns.

Fixes #93 .

endlisnis commented 5 years ago

Sorry for the delay, but I finally have a working test for this. Because this bug only shows up near program exit, I had to create a test that launches python in a subprocess, and because of path issues, I had to add a symlink for sqlitedict.py into the tests directory (or else my tests were picking up the system version of the library).

endlisnis commented 5 years ago

Is there anything more I need to do before this can be merged?

mpenkov commented 5 years ago

Sorry, I've been a bit busy lately. No, there's nothing else you need to do, please leave it with me.

endlisnis commented 4 years ago

I'm eager to get this merged into the main release. I'd like to use this library at work, but they would prefer running a vanilla version of the software, and my use case will not work without this patch.

piskvorky commented 4 years ago

@endlisnis thanks for your patience. @mpenkov will be back to open source after the New Year!

endlisnis commented 4 years ago

I have completed all the requested changes. Please let me know if there is anything more you'd like me to do.

mpenkov commented 4 years ago

OK, merged. Thank you for your hard work and your patience!!