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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0033627
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminorhave not tried2016-08-04 17:202016-08-30 10:07
ReportershuehnerView Statuspublic 
Assigned Tomtaal 
PrioritynormalResolutionfixedFixed in Version3.0PR16Q4
StatusclosedFix in branchFixed in SCM revision2f8cbe2f7611
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toalostale
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0033627: debug call in OBCriteria.count does trigger extra db query in some case

DescriptionGiven the following code:
    final OBCriteria<Locator> locators = OBDal.getInstance().createCriteria(Locator.class);
    locators.add(Restrictions.eq(Locator.PROPERTY_ACTIVE, true));
    locators.add(Restrictions.eq(Locator.PROPERTY_WAREHOUSE, shipment.getWarehouse()));
    if (locators.count() == 1) {

with 'shipment.getWarehouse() being a hibernate proxy (not initialized)

Then this debug statement inside OBCriteria.count()
      log.debug("Counting using criteria " + toString());

Triggers init + sql db read of m_warehouse which is not really required.

Steps To Reproducei.e. using POS OrderLoader which contains the above code (in some functional flow).
It maybe easier to reproduce in some small isolated test-case.
Proposed SolutionWrap .debug in isDebugEnabled() to avoid calling toString() on it.
TagsPerformance
Attached Filesdiff file icon 33627.diff [^] (753 bytes) 2016-08-04 17:22 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0033139 closedmario_castello Retail Modules OrderLoader: Inefficient check for m_locator doing 2-3 queries for the same 

-  Notes
(0088823)
shuehner (administrator)
2016-08-04 17:22

Mark as related as this issue here is trigger by the code change in 33139. So after fixing 33139 this bug here does not trigger anymore in that occasion (as the count call is removed).
(0088868)
hgbot (developer)
2016-08-07 16:25

Repository: erp/devel/pi
Changeset: 2f8cbe2f7611ce4b89fe72e273a9c127c93bc952
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Sun Aug 07 16:24:38 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/2f8cbe2f7611ce4b89fe72e273a9c127c93bc952 [^]

Fixes issue 33627: debug call in OBCriteria.count does trigger extra db query in some case
Wrap log.debug in if statement

---
M src/org/openbravo/dal/service/OBCriteria.java
---
(0089043)
hudsonbot (developer)
2016-08-11 18:40

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/edaa05b1fb18 [^]
Maturity status: Test
(0089531)
alostale (developer)
2016-08-30 10:07

code reviewed + tested

- Issue History
Date Modified Username Field Change
2016-08-04 17:20 shuehner New Issue
2016-08-04 17:20 shuehner Assigned To => platform
2016-08-04 17:20 shuehner Modules => Core
2016-08-04 17:20 shuehner Triggers an Emergency Pack => No
2016-08-04 17:21 shuehner Tag Attached: Performance
2016-08-04 17:21 shuehner Relationship added related to 0033139
2016-08-04 17:22 shuehner Note Added: 0088823
2016-08-04 17:22 shuehner File Added: 33627.diff
2016-08-07 10:08 mtaal Assigned To platform => mtaal
2016-08-07 16:25 hgbot Checkin
2016-08-07 16:25 hgbot Note Added: 0088868
2016-08-07 16:25 hgbot Status new => resolved
2016-08-07 16:25 hgbot Resolution open => fixed
2016-08-07 16:25 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/2f8cbe2f7611ce4b89fe72e273a9c127c93bc952 [^]
2016-08-08 10:20 mtaal Review Assigned To => alostale
2016-08-11 18:40 hudsonbot Checkin
2016-08-11 18:40 hudsonbot Note Added: 0089043
2016-08-30 10:07 alostale Note Added: 0089531
2016-08-30 10:07 alostale Status resolved => closed
2016-08-30 10:07 alostale Fixed in Version => 3.0PR16Q4


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker