Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
erp5
Commits
1f541a2d
Commit
1f541a2d
authored
Dec 18, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test order of commit of ZODB, compared to other resources
parent
649a5769
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
10 deletions
+16
-10
product/ERP5/mixin/rule.py
product/ERP5/mixin/rule.py
+4
-0
product/ERP5/tests/testInvalidationBug.py
product/ERP5/tests/testInvalidationBug.py
+12
-10
No files found.
product/ERP5/mixin/rule.py
View file @
1f541a2d
...
...
@@ -595,6 +595,10 @@ class SimulableMixin(Base):
portal
.
portal_simulation
,
is_indexable
=
False
)
applied_rule
.
_setCausalityValue
(
self
)
del
applied_rule
.
isIndexable
# To prevent duplicate root Applied Rule, we reindex immediately and
# lock ZODB, and we rely on the fact that ZODB is committed after
# catalog. This way, we guarantee the catalog is up-to-date as soon as
# ZODB is unlocked.
applied_rule
.
immediateReindexObject
()
self
.
serialize
()
# prevent duplicate root Applied Rule
return
applied_rule
...
...
product/ERP5/tests/testInvalidationBug.py
View file @
1f541a2d
...
...
@@ -70,28 +70,30 @@ class TestInvalidationBug(ERP5TypeTestCase):
len
(
manage_test
(
query
)))
result_list
=
[
map
(
apply
,
test_list
)]
Transaction_commitResources
=
transaction
.
Transaction
.
_commitResources
connection
=
module
.
_p_jar
def
_commitResources
(
self
):
orig_tpc_finish_dict
=
dict
((
rm
.
__class__
,
rm
.
__class__
.
tpc_finish
)
for
rm
in
self
.
_resources
)
def
tpc_finish
(
self
,
txn
):
orig_tpc_finish_dict
[
self
.
__class__
](
self
,
txn
)
result_list
.
append
(
map
(
apply
,
test_list
))
def
tpc_finish
(
rm
,
txn
):
rm
.
__class__
.
tpc_finish
(
rm
,
txn
)
result_list
.
append
(
None
if
rm
is
connection
else
map
(
apply
,
test_list
))
try
:
for
cls
in
orig_tpc_finish_dict
:
cls
.
tpc_finish
=
tpc_finish
for
rm
in
self
.
_resources
:
rm
.
tpc_finish
=
lambda
txn
,
rm
=
rm
:
tpc_finish
(
rm
,
txn
)
return
Transaction_commitResources
(
self
)
finally
:
for
cls
,
tpc_finish
in
orig_tpc_finish_dict
.
iteritems
()
:
cls
.
tpc_finish
=
tpc_finish
for
rm
in
self
.
_resources
:
del
rm
.
tpc_finish
try
:
transaction
.
Transaction
.
_commitResources
=
_commitResources
self
.
commit
()
finally
:
transaction
.
Transaction
.
_commitResources
=
Transaction_commitResources
self
.
tic
()
# Whether ZODB should be committed before or after catalog is not obvious.
# Current behaviour is required to avoid creating duplicated applied rules.
self
.
assertEqual
(
result_list
[
0
],
[
0
,
0
])
self
.
assertEqual
(
result_list
[
1
],
[
0
,
0
])
# activity buffer first
self
.
assertEqual
(
result_list
[
-
2
],
[
1
,
0
])
# catalog
self
.
assertEqual
(
result_list
[
-
3
],
[
1
,
0
])
# catalog
self
.
assertEqual
(
result_list
[
-
2
],
None
)
# ZODB
self
.
assertEqual
(
result_list
[
-
1
],
[
1
,
1
])
# activity tables last
def
testLateInvalidationFromZEO
(
self
):
...
...
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