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
acc6eaef
Commit
acc6eaef
authored
Mar 23, 2005
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Beefed up the test case; rewrote the C a little.
parent
94b2c942
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
7 deletions
+38
-7
branches/bug1734/src/BTrees/MergeTemplate.c
branches/bug1734/src/BTrees/MergeTemplate.c
+7
-7
branches/bug1734/src/BTrees/tests/testConflict.py
branches/bug1734/src/BTrees/tests/testConflict.py
+31
-0
No files found.
branches/bug1734/src/BTrees/MergeTemplate.c
View file @
acc6eaef
...
...
@@ -93,6 +93,13 @@ bucket_merge(Bucket *s1, Bucket *s2, Bucket *s3)
SetIteration
i1
=
{
0
,
0
,
0
},
i2
=
{
0
,
0
,
0
},
i3
=
{
0
,
0
,
0
};
int
cmp12
,
cmp13
,
cmp23
,
mapping
,
set
;
/* If either "after" bucket is empty, punt. */
if
(
s2
->
len
==
0
||
s3
->
len
==
0
)
{
merge_error
(
-
1
,
-
1
,
-
1
,
12
);
goto
err
;
}
if
(
initSetIteration
(
&
i1
,
OBJECT
(
s1
),
1
)
<
0
)
goto
err
;
if
(
initSetIteration
(
&
i2
,
OBJECT
(
s2
),
1
)
<
0
)
...
...
@@ -117,13 +124,6 @@ bucket_merge(Bucket *s1, Bucket *s2, Bucket *s3)
if
(
i3
.
next
(
&
i3
)
<
0
)
goto
err
;
/* If either "after" bucket was empty, punt. */
if
(
i2
.
position
<
0
||
i3
.
position
<
0
)
{
merge_error
(
i1
.
position
,
i2
.
position
,
i3
.
position
,
12
);
goto
err
;
}
/* Consult zodb/btrees/interfaces.py for the meaning of the last
* argument passed to merge_error().
*/
...
...
branches/bug1734/src/BTrees/tests/testConflict.py
View file @
acc6eaef
...
...
@@ -812,6 +812,37 @@ class NastyConfict(Base, TestCase):
else
:
self
.
fail
(
"expected ConflictError"
)
# Same thing, except commit the transactions in the opposite order.
b
=
OOBTree
()
for
i
in
range
(
0
,
200
,
4
):
b
[
i
]
=
i
r1
=
self
.
db
.
open
().
root
()
r1
[
"t"
]
=
b
transaction
.
commit
()
r2
=
self
.
db
.
open
(
synch
=
False
).
root
()
copy
=
r2
[
"t"
]
# Make sure all of copy is loaded.
list
(
copy
.
values
())
self
.
assertEqual
(
b
.
_p_serial
,
copy
.
_p_serial
)
# Now one transaction empties the first bucket, and another adds a
# key to the first bucket.
b
[
1
]
=
1
transaction
.
commit
()
for
k
in
range
(
0
,
60
,
4
):
del
copy
[
k
]
try
:
transaction
.
commit
()
except
ConflictError
,
detail
:
self
.
assert_
(
str
(
detail
).
startswith
(
'database conflict error'
))
transaction
.
abort
()
else
:
self
.
fail
(
"expected ConflictError"
)
def
test_suite
():
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