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
Labels
Merge Requests
140
Merge Requests
140
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
aaa85090
Commit
aaa85090
authored
Feb 27, 2025
by
Kazuhiko Shiozaki
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMFActivity: force using the more efficient index for non-groupable activity reservation.
parent
11d9c363
Pipeline
#40063
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
product/CMFActivity/Activity/SQLBase.py
product/CMFActivity/Activity/SQLBase.py
+16
-4
No files found.
product/CMFActivity/Activity/SQLBase.py
View file @
aaa85090
...
...
@@ -426,9 +426,13 @@ CREATE TABLE %s (
0
,
)[
1
]
else
:
# MariaDB often choose processing_node_priority_date index
# but node2_priority_date is much faster if there exist
# many node < 0 non-groupable activities.
subquery
=
lambda
*
a
,
**
k
:
str2bytes
(
bytes2str
(
b"("
b"SELECT 3*priority{} AS effective_priority, date"
b" FROM %s"
b" FORCE INDEX (node2_priority_date)"
b" WHERE"
b" {} AND"
b" processing_node=0 AND"
...
...
@@ -781,9 +785,17 @@ CREATE TABLE %s (
0
,
))
else
:
if
group_method_id
:
force_index
=
''
else
:
# MariaDB often choose processing_node_priority_date index
# but node2_priority_date is much faster if there exist
# many node < 0 non-groupable activities.
force_index
=
b'FORCE INDEX (node2_priority_date)'
subquery
=
lambda
*
a
,
**
k
:
str2bytes
(
bytes2str
(
b"("
b"SELECT *, 3*priority{} AS effective_priority"
b" FROM %s"
b" {}"
b" WHERE"
b" {} AND"
b" processing_node=0 AND"
...
...
@@ -799,11 +811,11 @@ CREATE TABLE %s (
b" UNION ALL "
.
join
(
chain
(
(
subquery
(
'-1'
,
'node = %i'
%
processing_node
),
subquery
(
''
,
'node=0'
),
subquery
(
'-1'
,
force_index
,
'node = %i'
%
processing_node
),
subquery
(
''
,
force_index
,
'node=0'
),
),
(
subquery
(
'-1'
,
'node = %i'
%
x
)
subquery
(
'-1'
,
force_index
,
'node = %i'
%
x
)
for
x
in
node_set
),
),
...
...
@@ -821,7 +833,7 @@ CREATE TABLE %s (
# sorted set to filter negative node values.
# This is why this query is only executed when the previous one
# did not find anything.
result
=
Results
(
query
(
subquery
(
'+1'
,
'node>0'
),
0
))
result
=
Results
(
query
(
subquery
(
'+1'
,
force_index
,
'node>0'
),
0
))
if
result
:
# Reserve messages.
uid_list
=
[
x
.
uid
for
x
in
result
]
...
...
Jérome Perrin
@jerome
mentioned in commit
64277413
·
Mar 02, 2025
mentioned in commit
64277413
mentioned in commit 64277413c70a4ab90d4cb7a6ed4d61e39a13fd4a
Toggle commit list
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