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
nexedi
ZODB
Commits
1078ed5b
Commit
1078ed5b
authored
Sep 20, 2010
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug Fixed:
- Conflict errors didn't invalidate ZEO cache entries.
parent
bc066b9a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
1 deletion
+76
-1
src/CHANGES.txt
src/CHANGES.txt
+2
-0
src/ZEO/ClientStorage.py
src/ZEO/ClientStorage.py
+1
-0
src/ZEO/tests/testZEO.py
src/ZEO/tests/testZEO.py
+73
-1
No files found.
src/CHANGES.txt
View file @
1078ed5b
...
...
@@ -25,6 +25,8 @@ Bugs Fixed
invalidation transaction ids matched the cached transaction ids
should have been ignored.
- Conflict errors didn't invalidate ZEO cache entries.
- On Mac OS X, clients that connected and disconnected quickly could
cause a ZEO server to stop accepting connections, due to a failure
to catch errors in the initial part of the connection process.
...
...
src/ZEO/ClientStorage.py
View file @
1078ed5b
...
...
@@ -902,6 +902,7 @@ class ClientStorage(object):
del
self
.
_serials
[:
l
]
for
oid
,
s
in
r
:
if
isinstance
(
s
,
Exception
):
self
.
_cache
.
invalidate
(
oid
,
None
)
raise
s
self
.
_seriald
[
oid
]
=
s
return
r
...
...
src/ZEO/tests/testZEO.py
View file @
1078ed5b
...
...
@@ -24,7 +24,7 @@ from ZODB.tests import StorageTestBase, BasicStorage, \
MTStorage
,
ReadOnlyStorage
,
IteratorStorage
,
RecoveryStorage
from
ZODB.tests.MinPO
import
MinPO
from
ZODB.tests.StorageTestBase
import
zodb_unpickle
from
ZODB.utils
import
p64
,
u64
import
asyncore
import
doctest
import
logging
...
...
@@ -1227,6 +1227,78 @@ def runzeo_without_configfile():
testing exit immediately
"""
def
invalidate_client_cache_entry_on_server_commit_error
():
"""
When the serials returned during commit includes an error, typically a
conflict error, invalidate the cache entry. This is important when
the cache is messed up.
>>> addr, _ = start_server()
>>> conn1 = ZEO.connection(addr)
>>> conn1.root.x = conn1.root().__class__()
>>> transaction.commit()
>>> conn1.root.x
{}
>>> cs = ZEO.ClientStorage.ClientStorage(addr, client='cache')
>>> conn2 = ZODB.connection(cs)
>>> conn2.root.x
{}
>>> conn2.close()
>>> cs.close()
>>> conn1.root.x['x'] = 1
>>> transaction.commit()
>>> conn1.root.x
{'x': 1}
Now, let's screw up the cache by making it have a last tid that is later than
the root serial.
>>> import ZEO.cache
>>> cache = ZEO.cache.ClientCache('cache-1.zec')
>>> cache.setLastTid(p64(u64(conn1.root.x._p_serial)+1))
>>> cache.close()
We'll also update the server so that it's last tid is newer than the cache's:
>>> conn1.root.y = 1
>>> transaction.commit()
>>> conn1.root.y = 2
>>> transaction.commit()
Now, if we reopen the client storage, we'll get the wrong root:
>>> cs = ZEO.ClientStorage.ClientStorage(addr, client='cache')
>>> conn2 = ZODB.connection(cs)
>>> conn2.root.x
{}
And, we'll get a conflict error if we try to modify it:
>>> conn2.root.x['y'] = 1
>>> transaction.commit() # doctest: +ELLIPSIS
Traceback (most recent call last):
...
ConflictError: ...
But, if we abort, we'll get up to date data and we'll see the changes.
>>> transaction.abort()
>>> conn2.root.x
{'x': 1}
>>> conn2.root.x['y'] = 1
>>> transaction.commit()
>>> sorted(conn2.root.x.items())
[('x', 1), ('y', 1)]
>>> cs.close()
>>> conn1.close()
"""
def
quick_close_doesnt_kill_server
():
r"""
...
...
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