-
Notifications
You must be signed in to change notification settings - Fork 192
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
PsqlDosBackend
: Fix changes not persisted after iterall
and iterdict
#6134
PsqlDosBackend
: Fix changes not persisted after iterall
and iterdict
#6134
Conversation
@eimrek This fixed the problem for my testing. Could you also give this branch a go for your environment please? Thanks! Edit: scratch that for the time being. There are a bunch of tests failing, so I clearly need to fix those first. |
@sphuber sure, will gladly give this a shot. feel free to ping me when ready |
0863aab
to
23a7e9b
Compare
Ok @eimrek I fixed the problem, should be good to go for a test now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well on my end! thanks 👍
23a7e9b
to
7a77f1f
Compare
…dict` The `iterall` and `iterdict` generators of the `QueryBuilder` implementation for the `PsqlDosBackend` would open a transaction in order for the `ModelWrapper` to not automatically commit the session upon any mutation as that would invalidate the cursor. However, it did not manually commit the session at the end of the iterator, causing any mutations to be lost when the storage backend was reloaded. This problem was not just present in the `iterall` and `iterdict` methods of the `QueryBuilder` but rather the `transaction` method of the `PsqlDosBackend` never commits the savepoint that is returned by the `Session.begin_nested` call. Now the `transaction` explicitly commits the savepoint after the yield and the `QueryBuilder` methods are updated to simply use the `transaction` method of the storage backend, rather than going directly to the session. This change also required a change in the `SqliteZipBackend`, since the `transaction` is now called during archive creation and import, but the backend raised a `NotImplementedError`. This is because it used to be a read-only backend, however, this limitation was recently lifted. The commit simply forgot to implement the `transaction` method.
7a77f1f
to
51c9032
Compare
New
Issue persists in |
Is this just in the teardown? I think I may have seen this at some point but only at the end of the tests. Don't think it is significant in any case for the time being as it has to do with the test shutdown |
Yes, only in teardown (post-tests). Okay, ignoring for now 👍 Thanks @sphuber 🙏
|
Fixes #6133
Fixes #6009
The
iterall
anditerdict
generators of theQueryBuilder
implementation for the
PsqlDosBackend
would open a transaction inorder for the
ModelWrapper
to not automatically commit the sessionupon any mutation as that would invalidate the cursor. However, it did
not manually commit the session at the end of the iterator, causing any
mutations to be lost when the storage backend was reloaded.
This problem was not just present in the
iterall
anditerdict
methods of the
QueryBuilder
but rather thetransaction
method of thePsqlDosBackend
never commits the savepoint that is returned by theSession.begin_nested
call. Now thetransaction
explicitly commitsthe savepoint after the yield and the
QueryBuilder
methods are updatedto simply use the
transaction
method of the storage backend, ratherthan going directly to the session.
This change also required a change in the
SqliteZipBackend
, since thetransaction
is now called during archive creation and import, but thebackend raised a
NotImplementedError
. This is because it used to be aread-only backend, however, this limitation was recently lifted. The
commit simply forgot to implement the
transaction
method.