Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0033707
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminorhave not tried2016-08-12 17:522016-08-26 13:21
ReportershuehnerView Statuspublic 
Assigned Toshuehner 
PrioritynormalResolutionfixedFixed in Version3.0PR16Q4
StatusclosedFix in branchFixed in SCM revisione905f809d409
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0033707: Accidental triple query in OBMessageUtils.getI18NMessage

DescriptionThis 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 Reproduce1.) Open 'Alert Management' via its button on top of UI
2.) Review queries done to ad_message

TagsPerformance
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to feature request 0033767 closedplatform Add code to auto-detect 'accidental double query' on same OBQuery or OBCriteria object 
related to design defect 0036898 newTriage Finance Performance issues when using DAL 

-  Notes
(0089305)
hgbot (developer)
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
---
(0089349)
caristu (developer)
2016-08-24 15:21

Code review + testing OK: now just one query is launched to retrieve the message
(0089386)
hgbot (developer)
2016-08-25 11:01

Repository: erp/devel/pi
Changeset: 51c44fe5c05702c37fd3d6f7e5657b14239d20aa
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Thu Aug 25 11:01:24 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/51c44fe5c05702c37fd3d6f7e5657b14239d20aa [^]

related to issue 33707: code review improvements

---
M src/org/openbravo/erpCommon/utility/OBMessageUtils.java
---
(0089387)
hgbot (developer)
2016-08-25 11:23

Repository: erp/devel/pi
Changeset: 70d44c2f8c70b2a080f01716d3668e8656570fa8
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Thu Aug 25 11:22:44 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/70d44c2f8c70b2a080f01716d3668e8656570fa8 [^]

related to issue 33707: reverting limit removal

---
M src/org/openbravo/erpCommon/utility/OBMessageUtils.java
---
(0089415)
hudsonbot (developer)
2016-08-25 22:53

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/5e50832c9b35 [^]
Maturity status: Test
(0089416)
hudsonbot (developer)
2016-08-25 22:53

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/5e50832c9b35 [^]
Maturity status: Test
(0089424)
hgbot (developer)
2016-08-26 08:23

Repository: erp/devel/pi
Changeset: 3a75b98096ef5a5d6f29c81133ca66e45e93d0ed
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Fri Aug 26 08:22:55 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/3a75b98096ef5a5d6f29c81133ca66e45e93d0ed [^]

related to issue 33707: updated copyright year

---
M src/org/openbravo/erpCommon/utility/OBMessageUtils.java
---
(0089455)
hudsonbot (developer)
2016-08-26 13:21

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/f7253a361e2a [^]
Maturity status: Test

- 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


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker