Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
ZODB
Commits
8824506c
Commit
8824506c
authored
Jun 16, 2005
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TmpStore needs to delegate loadBefore().
parent
738fecb4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
2 deletions
+69
-2
NEWS.txt
NEWS.txt
+11
-0
src/ZODB/Connection.py
src/ZODB/Connection.py
+1
-1
src/ZODB/tests/testmvcc.py
src/ZODB/tests/testmvcc.py
+57
-1
No files found.
NEWS.txt
View file @
8824506c
...
...
@@ -4,6 +4,17 @@ Release date: DD-MMM-2005
-3.4.1a1 DD-MMM-2005
Savepoints
----------
- (3.4.1a1) When a savepoint is made, the states of objects modified so far
are saved to a temporary storage (an instance of class ``TmpStore``,
although that's an internal implementation detail). That storage needs
to implement the full storage API too, but was missing the ``loadBefore()``
method needed for MVCC to retrieve non-current revisions of objects. This
could cause spurious errors if a transaction with a pending savepoint
needed to fetch an older revision of some object.
FileStorage.UndoSearch
----------------------
...
...
src/ZODB/Connection.py
View file @
8824506c
...
...
@@ -1115,7 +1115,7 @@ class TmpStore:
self
.
_storage
=
storage
for
method
in
(
'getName'
,
'new_oid'
,
'modifiedInVersion'
,
'getSize'
,
'undoLog'
,
'versionEmpty'
,
'sortKey'
,
'undoLog'
,
'versionEmpty'
,
'sortKey'
,
'loadBefore'
,
):
setattr
(
self
,
method
,
getattr
(
storage
,
method
))
...
...
src/ZODB/tests/testmvcc.py
View file @
8824506c
...
...
@@ -244,7 +244,63 @@ a ghost.
>>> r1["b"]._p_state # GHOST
-1
>>> cn1._transaction = None # See the Cleanup section below
Interaction with Savepoints
---------------------------
Basically, making a savepoint shouldn't have any effect on what a thread
sees. Before ZODB 3.4.1, the internal TmpStore used when savepoints are
pending didn't delegate all the methods necessary to make this work, so
we'll do a quick test of that here. First get a clean slate:
>>> cn1.close(); cn2.close()
>>> cn1 = db.open(transaction_manager=tm1)
>>> r1 = cn1.root()
>>> r1["a"].value = 0
>>> r1["b"].value = 1
>>> tm1.commit()
Now modify "a", but not "b", and make a savepoint.
>>> r1["a"].value = 42
>>> sp = cn1.savepoint()
Over in the other connection, modify "b" and commit it. This makes the
first connection's state for b "old".
>>> cn2 = db.open(transaction_manager=tm2)
>>> r2 = cn2.root()
>>> r2["a"].value, r2["b"].value # shouldn't see the change to "a"
(0, 1)
>>> r2["b"].value = 43
>>> tm2.commit()
>>> r2["a"].value, r2["b"].value
(0, 43)
Now deactivate "b" in the first connection, and (re)fetch it. The first
connection should still see 1, due to MVCC, but to get this old state
TmpStore needs to handle the loadBefore() method.
>>> r1["b"]._p_deactivate()
Before 3.4.1, the next line died with
AttributeError: TmpStore instance has no attribute 'loadBefore'
>>> r1["b"]._p_state # ghost
-1
>>> r1["b"].value
1
Just for fun, finish the commit and make sure both connections see the
same things now.
>>> tm1.commit()
>>> cn1.sync(); cn2.sync()
>>> r1["a"].value, r1["b"].value
(42, 43)
>>> r2["a"].value, r2["b"].value
(42, 43)
Late invalidation
-----------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment