Openbravo Issue Tracking System - Openbravo ERP |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0033707 | Openbravo ERP | A. Platform | public | 2016-08-12 17:52 | 2016-08-26 13:21 |
|
Reporter | shuehner | |
Assigned To | shuehner | |
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | closed | Resolution | fixed | |
Platform | | OS | 5 | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | 3.0PR16Q4 | |
Merge Request Status | |
Review Assigned To | caristu |
OBNetwork customer | |
Web browser | |
Modules | Core |
Support ticket | |
Regression level | |
Regression date | |
Regression introduced in release | |
Regression introduced by commit | |
Triggers an Emergency Pack | No |
|
Summary | 0033707: Accidental triple query in OBMessageUtils.getI18NMessage |
Description | This function has following code running 3 sql queries to retrieve a single row:
if (messages.list().isEmpty()) {
return null;
}
if (messages.list().size() > 1) {
log4j.warn("More than one message found using key " + key);
}
// pick the first one
final Message message = messages.list().get(0);
That code runs .list() 3 times for the same instance doing 3 queries
Also it does check for >1 result in the filter. However the fiter on ad_message is done one the value column (aka searchKey in DAL). As that column has a unique constraint in the database it is not possible to have >1 row so that extra check is not useful.
Both together allows all three .list() calls to be collapsed into a single .uniqueResult() |
Steps To Reproduce | 1.) Open 'Alert Management' via its button on top of UI
2.) Review queries done to ad_message
|
Proposed Solution | |
Additional Information | |
Tags | Performance |
Relationships | related to | feature request | 0033767 | | closed | platform | Add code to auto-detect 'accidental double query' on same OBQuery or OBCriteria object | related to | design defect | 0036898 | | new | Triage Finance | Performance issues when using DAL |
|
Attached Files | |
|
Issue History |
Date Modified | Username | Field | Change |
2016-08-12 17:52 | shuehner | New Issue | |
2016-08-12 17:52 | shuehner | Assigned To | => platform |
2016-08-12 17:52 | shuehner | Modules | => Core |
2016-08-12 17:52 | shuehner | Triggers an Emergency Pack | => No |
2016-08-12 18:09 | shuehner | Assigned To | platform => shuehner |
2016-08-12 18:09 | shuehner | Tag Attached: Performance | |
2016-08-23 14:33 | hgbot | Checkin | |
2016-08-23 14:33 | hgbot | Note Added: 0089305 | |
2016-08-23 14:33 | hgbot | Status | new => resolved |
2016-08-23 14:33 | hgbot | Resolution | open => fixed |
2016-08-23 14:33 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/e905f809d4099d727be33163b651333ec7b01594 [^] |
2016-08-23 14:34 | shuehner | Review Assigned To | => caristu |
2016-08-23 14:44 | shuehner | Relationship added | related to 0033767 |
2016-08-24 15:21 | caristu | Note Added: 0089349 | |
2016-08-24 15:21 | caristu | Status | resolved => closed |
2016-08-24 15:21 | caristu | Fixed in Version | => 3.0PR16Q4 |
2016-08-25 11:01 | hgbot | Checkin | |
2016-08-25 11:01 | hgbot | Note Added: 0089386 | |
2016-08-25 11:23 | hgbot | Checkin | |
2016-08-25 11:23 | hgbot | Note Added: 0089387 | |
2016-08-25 22:53 | hudsonbot | Checkin | |
2016-08-25 22:53 | hudsonbot | Note Added: 0089415 | |
2016-08-25 22:53 | hudsonbot | Checkin | |
2016-08-25 22:53 | hudsonbot | Note Added: 0089416 | |
2016-08-26 08:23 | hgbot | Checkin | |
2016-08-26 08:23 | hgbot | Note Added: 0089424 | |
2016-08-26 13:21 | hudsonbot | Checkin | |
2016-08-26 13:21 | hudsonbot | Note Added: 0089455 | |
2017-09-19 18:50 | markmm82 | Relationship added | related to 0036898 |
Notes |
|
(0089305)
|
hgbot
|
2016-08-23 14:33
|
|
Repository: erp/devel/pi
Changeset: e905f809d4099d727be33163b651333ec7b01594
Author: Stefan Hühner <stefan.huehner <at> openbravo.com>
Date: Fri Aug 12 17:54:08 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/e905f809d4099d727be33163b651333ec7b01594 [^]
Fixed 33707. Avoid triple query use single .uniqueResult instead.
Filter in that OBQuery is on 'value' field having uniqueConstraint. So not
checking for >1 rows in result is necessary as it can never happen, so remove
that check completely.
Collapse the other 2 .list() calls into a single .uniqueResult avoiding
yet another query.
---
M src/org/openbravo/erpCommon/utility/OBMessageUtils.java
---
|
|
|
|
Code review + testing OK: now just one query is launched to retrieve the message |
|
|
(0089386)
|
hgbot
|
2016-08-25 11:01
|
|
|
|
(0089387)
|
hgbot
|
2016-08-25 11:23
|
|
|
|
|
|
|
|
|
|
(0089424)
|
hgbot
|
2016-08-26 08:23
|
|
|
|
|
|