-
Notifications
You must be signed in to change notification settings - Fork 4
"Connetion.commit" makes object inaccessible #2
Comments
As I mentioned in the other issue, having storage-level machinery depend on persistent state is a bad idea. |
It definitely is unintuitive that a |
By "storage machinery" I was being imprecise. My point was that what happens during transaction commit should not involve application logic. If you think there's a clean simple "fix", I'll entertain a pull request. |
I will hear what the authors of |
+1 for dm.zodbpatches. P.S. Dieter, it's great to hear from you. :) |
The package containing the monkey patches for this problem is |
After a call to `ZODB.Connection.Connection.commit", new objects can become inaccessible (until the following "tpc_finish" call). The behaviour is demonstrated by the following doctest:
The error happens, because the savepoint has given the
Connection
its own storage which serves the savepoint modifications. Oncommit
, the savepoint modifications arestore
d in the primary storage and the savepoint storage is dropped. However, the typical primary storages (shown by the doctest forMappingStorage
andFileStorage
; I have verified that this applies as well toClientStorage
) are not ready toload
store
d objects before thetpc_finish
.The error can affect other resource managers (such as the
collective.indexing.transactions.QueueTM
in ticket zopefoundation/transaction#6) which access persistent objects.The error shows some apparently non-deterministic behavior: the error only occurs when the accessed persistent object must be really loaded from the ZODB (and is not in the connection's cache).
New objects can become inaccessible by this error. On the other hand, the error can also affect existing objects. For them, resource managers can read the old state (and not see modifications by the current transaction).
The text was updated successfully, but these errors were encountered: