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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
357cc30d
Commit
357cc30d
authored
Mar 12, 2004
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Checkpointing more progress.
parent
2d8455d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
src/ZODB/tests/testmvcc.py
src/ZODB/tests/testmvcc.py
+13
-8
No files found.
src/ZODB/tests/testmvcc.py
View file @
357cc30d
...
@@ -100,8 +100,7 @@ Basic functionality
...
@@ -100,8 +100,7 @@ Basic functionality
-------------------
-------------------
The next bit of code includes a simple MVCC test. One transaction
The next bit of code includes a simple MVCC test. One transaction
will begin and modify "a." The other transaction will then modify "b"
will modify "a." The other transaction will then modify "b" and commit.
and commit.
>>> r1 = cn1.root()
>>> r1 = cn1.root()
>>> r1["a"].value = 2
>>> r1["a"].value = 2
...
@@ -119,10 +118,12 @@ transaction.
...
@@ -119,10 +118,12 @@ transaction.
>>> r2 = cn2.root()
>>> r2 = cn2.root()
>>> r2["b"]._p_serial < cn2._txn_time
>>> r2["b"]._p_serial < cn2._txn_time
True
True
>>> r2["b"].value
1
>>> r2["b"].value = 2
>>> r2["b"].value = 2
It is not safe, however, to read the current revision
"a," because it
It is not safe, however, to read the current revision
of "a" because
was modified at the high-water mark. If we read it, we'll get a
it
was modified at the high-water mark. If we read it, we'll get a
non-current version.
non-current version.
>>> r2["a"].value
>>> r2["a"].value
...
@@ -136,7 +137,7 @@ storage.
...
@@ -136,7 +137,7 @@ storage.
>>> db._storage.isCurrent(r2["a"]._p_oid, r2["a"]._p_serial)
>>> db._storage.isCurrent(r2["a"]._p_oid, r2["a"]._p_serial)
False
False
It's possible to modify "a
,"
but we get a conflict error when we
It's possible to modify "a
",
but we get a conflict error when we
commit the transaction.
commit the transaction.
>>> r2["a"].value = 3
>>> r2["a"].value = 3
...
@@ -147,12 +148,15 @@ ConflictError: database conflict error (oid 0000000000000001, class ZODB.tests.M
...
@@ -147,12 +148,15 @@ ConflictError: database conflict error (oid 0000000000000001, class ZODB.tests.M
The failed commit aborted the current transaction, so we can try
The failed commit aborted the current transaction, so we can try
again. This example will demonstrate that we can commit a transaction
again. This example will demonstrate that we can commit a transaction
if we
don't modify the object that isn't current
.
if we
only modify current revisions
.
>>> cn2._txn_time
>>> print cn2._txn_time
None
>>> r1 = cn1.root()
>>> r1 = cn1.root()
>>> r1["a"].value = 3
>>> r1["a"].value = 3
>>> txn1 is cn1.getTransaction()
True
>>> cn1.getTransaction().commit()
>>> cn1.getTransaction().commit()
>>> txn = db.lastTransaction()
>>> txn = db.lastTransaction()
>>> cn2._txn_time == txn
>>> cn2._txn_time == txn
...
@@ -162,7 +166,8 @@ True
...
@@ -162,7 +166,8 @@ True
>>> r2["b"].value
>>> r2["b"].value
3
3
>>> txn2.commit()
>>> txn2.commit()
>>> cn2._txn_time
>>> print cn2._txn_time
None
Object cache
Object cache
------------
------------
...
...
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