mark MVCCAdapter
instance's tpc_finish
callbacks
#344
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since
ZODB>=5.6
lastTransaction
must change after invalidation processing. The problem reported in "zopefoundation/ZEO#166" demonstrates that this is necessary for the invalidations from a localtpc_finish
as well.MVCCAdapter
instances put those invalidations into thetpc_finish
callback. This implies thatlastTransaction
must change after those callbacks are run. The testZODB.tests.BasicStorage.BasicStorage.check_tid_ordering_w_commit
uses thetpc_finish
callback to sample the result oflastTransaction
. It requires thatlastTransaction
changes before the sampling. Obviously, both requirements contradict one another.That the test currently succeeds for all storages almost surely means that those storages do not yet fulfill the requirement introduced by
ZODB==5.6
. The optimal approach likely would be to modify all storages and adapt the test accordingly. Because I do not want to change all storages at the moment, I opted for a different (slightly hacky) solution:MVCCAdapter
instances setcallback.invalidateTransaction = True
for theirtpc_finish
callbacks. This allows a storage implementation to distinguish callbacks fromMVCCAdapter
instances (lastTransaction
must change after the callback) from other callbacks (e.g. from tests wherelastTransaction
might be expected to change before the callback).