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
904300f1
Commit
904300f1
authored
May 21, 2015
by
Adam Groszer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
forgot to add class name as requested by Jim
parent
0a7ee5ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
src/ZODB/ConflictResolution.py
src/ZODB/ConflictResolution.py
+6
-3
src/ZODB/tests/testconflictresolution.py
src/ZODB/tests/testconflictresolution.py
+2
-3
No files found.
src/ZODB/ConflictResolution.py
View file @
904300f1
...
@@ -239,6 +239,7 @@ _unresolvable = {}
...
@@ -239,6 +239,7 @@ _unresolvable = {}
def
tryToResolveConflict
(
self
,
oid
,
committedSerial
,
oldSerial
,
newpickle
,
def
tryToResolveConflict
(
self
,
oid
,
committedSerial
,
oldSerial
,
newpickle
,
committedData
=
b''
):
committedData
=
b''
):
# class_tuple, old, committed, newstate = ('',''), 0, 0, 0
# class_tuple, old, committed, newstate = ('',''), 0, 0, 0
klass
=
'n/a'
try
:
try
:
prfactory
=
PersistentReferenceFactory
()
prfactory
=
PersistentReferenceFactory
()
newpickle
=
self
.
_crs_untransform_record_data
(
newpickle
)
newpickle
=
self
.
_crs_untransform_record_data
(
newpickle
)
...
@@ -295,15 +296,17 @@ def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle,
...
@@ -295,15 +296,17 @@ def tryToResolveConflict(self, oid, committedSerial, oldSerial, newpickle,
pickler
.
dump
(
resolved
)
pickler
.
dump
(
resolved
)
return
self
.
_crs_transform_record_data
(
file
.
getvalue
())
return
self
.
_crs_transform_record_data
(
file
.
getvalue
())
except
(
ConflictError
,
BadClassName
)
as
e
:
except
(
ConflictError
,
BadClassName
)
as
e
:
logger
.
debug
(
"Conflict resolution failed with %s: %s"
%
(
logger
.
debug
(
e
.
__class__
.
__name__
,
str
(
e
)))
"Conflict resolution on %s failed with %s: %s"
,
klass
,
e
.
__class__
.
__name__
,
str
(
e
))
except
:
except
:
# If anything else went wrong, catch it here and avoid passing an
# If anything else went wrong, catch it here and avoid passing an
# arbitrary exception back to the client. The error here will mask
# arbitrary exception back to the client. The error here will mask
# the original ConflictError. A client can recover from a
# the original ConflictError. A client can recover from a
# ConflictError, but not necessarily from other errors. But log
# ConflictError, but not necessarily from other errors. But log
# the error so that any problems can be fixed.
# the error so that any problems can be fixed.
logger
.
exception
(
"Unexpected error"
)
logger
.
exception
(
"Unexpected error while trying to resolve conflict on %s"
,
klass
)
raise
ConflictError
(
oid
=
oid
,
serials
=
(
committedSerial
,
oldSerial
),
raise
ConflictError
(
oid
=
oid
,
serials
=
(
committedSerial
,
oldSerial
),
data
=
newpickle
)
data
=
newpickle
)
...
...
src/ZODB/tests/testconflictresolution.py
View file @
904300f1
...
@@ -355,11 +355,11 @@ Let's see what went into the log:
...
@@ -355,11 +355,11 @@ Let's see what went into the log:
>>> msg = handler.records[0]
>>> msg = handler.records[0]
>>> six.print_(msg.name, msg.levelname, msg.getMessage())
>>> six.print_(msg.name, msg.levelname, msg.getMessage())
ZODB.ConflictResolution ERROR Unexpected error
ZODB.ConflictResolution ERROR Unexpected error
while trying to resolve conflict on <class 'ZODB.tests.testconflictresolution.FailHard'>
>>> msg = handler.records[1]
>>> msg = handler.records[1]
>>> six.print_(msg.name, msg.levelname, msg.getMessage())
>>> six.print_(msg.name, msg.levelname, msg.getMessage())
ZODB.ConflictResolution DEBUG Conflict resolution failed with ConflictError: database conflict error
ZODB.ConflictResolution DEBUG Conflict resolution
on <class 'ZODB.tests.testconflictresolution.Unresolvable'>
failed with ConflictError: database conflict error
Cleanup:
Cleanup:
...
@@ -381,4 +381,3 @@ def test_suite():
...
@@ -381,4 +381,3 @@ def test_suite():
setUp
=
setUp
,
tearDown
=
tearDown
,
setUp
=
setUp
,
tearDown
=
tearDown
,
checker
=
ZODB
.
tests
.
util
.
checker
),
checker
=
ZODB
.
tests
.
util
.
checker
),
])
])
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