Skip to content

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

Merged
mpenkov merged 9 commits into
piskvorky:masterfrom
endlisnis:master
Jan 1, 2020
Merged

Add a blocking commit after each modification if autocommit is enabled.#94
mpenkov merged 9 commits into
piskvorky:masterfrom
endlisnis:master

Conversation

@endlisnis

@endlisnis endlisnis commented Mar 24, 2019

Copy link
Copy Markdown
Contributor

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 .

@mpenkov mpenkov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes make sense to me.

Could you please add some tests? Ideally, the tests should fail without your modified code, illustrating a problem with the implementation. Obviously, the tests should pass once your modified code is in place.

@endlisnis

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Contributor Author

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

@mpenkov

mpenkov commented Sep 12, 2019

Copy link
Copy Markdown
Collaborator

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

@endlisnis

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Owner

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

Comment thread tests/sqlitedict.py Outdated

@mpenkov mpenkov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I'm finally back and had a chance to look at your tests. It's a step in the right direction, but could be better. Please have a look at the questions and comments I left.

Comment thread tests/autocommit2.py Outdated
Comment thread tests/test_autocommit.py Outdated
@endlisnis
endlisnis requested a review from mpenkov December 29, 2019 16:35
Comment thread tests/test_autocommit.py Outdated
Comment thread tests/test_autocommit.py Outdated
Comment thread tests/test_autocommit.py Outdated
endlisnis and others added 3 commits December 30, 2019 16:59
Co-Authored-By: Michael Penkov <m@penkov.dev>
Co-Authored-By: Michael Penkov <m@penkov.dev>
@endlisnis

Copy link
Copy Markdown
Contributor Author

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

@endlisnis
endlisnis requested a review from mpenkov January 1, 2020 14:39
@mpenkov
mpenkov merged commit f5c57f1 into piskvorky:master Jan 1, 2020
@mpenkov

mpenkov commented Jan 1, 2020

Copy link
Copy Markdown
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants