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
5a09264e
Commit
5a09264e
authored
Mar 22, 2005
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A failing test showing Dieter's bug.
parent
6ef20509
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
branches/bug1734/src/BTrees/tests/testConflict.py
branches/bug1734/src/BTrees/tests/testConflict.py
+54
-0
No files found.
branches/bug1734/src/BTrees/tests/testConflict.py
View file @
5a09264e
...
@@ -759,6 +759,60 @@ class NastyConfict(Base, TestCase):
...
@@ -759,6 +759,60 @@ class NastyConfict(Base, TestCase):
else
:
else
:
self
.
fail
(
"expected ConflictError"
)
self
.
fail
(
"expected ConflictError"
)
def
testConflictWithOneEmptyBucket
(
self
):
# If one transaction empties a bucket, while another adds an item
# to the bucket, all the changes "look resolvable": bucket conflict
# resolution returns a bucket containing (only) the item added by
# the latter transaction, but changes from the former transaction
# removing the bucket are uncontested: the bucket is removed from
# the BTree despite that resolution thinks it's non-empty! This
# was first reported by Dieter Maurer, to zodb-dev on 22 Mar 2005.
b
=
self
.
t
for
i
in
range
(
0
,
200
,
4
):
b
[
i
]
=
i
# bucket 0 has 15 values: 0, 4 .. 56
# bucket 1 has 15 values: 60, 64 .. 116
# bucket 2 has 20 values: 120, 124 .. 196
state
=
b
.
__getstate__
()
# Looks like: ((bucket0, 60, bucket1, 120, bucket2), firstbucket)
# If these fail, the *preconditions* for running the test aren't
# satisfied -- the test itself hasn't been run yet.
self
.
assertEqual
(
len
(
state
),
2
)
self
.
assertEqual
(
len
(
state
[
0
]),
5
)
self
.
assertEqual
(
state
[
0
][
1
],
60
)
self
.
assertEqual
(
state
[
0
][
3
],
120
)
# Set up database connections to provoke conflict.
self
.
openDB
()
r1
=
self
.
db
.
open
().
root
()
r1
[
"t"
]
=
self
.
t
transaction
.
commit
()
r2
=
self
.
db
.
open
(
synch
=
False
).
root
()
copy
=
r2
[
"t"
]
# Make sure all of copy is loaded.
list
(
copy
.
values
())
self
.
assertEqual
(
self
.
t
.
_p_serial
,
copy
.
_p_serial
)
# Now one transaction empties the first bucket, and another adds a
# key to the first bucket.
for
k
in
range
(
0
,
60
,
4
):
del
self
.
t
[
k
]
transaction
.
commit
()
copy
[
1
]
=
1
try
:
transaction
.
commit
()
except
ConflictError
,
detail
:
self
.
assert_
(
str
(
detail
).
startswith
(
'database conflict error'
))
transaction
.
abort
()
else
:
print
list
(
copy
.
items
())
self
.
fail
(
"expected ConflictError"
)
def
test_suite
():
def
test_suite
():
suite
=
TestSuite
()
suite
=
TestSuite
()
...
...
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