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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0033794
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminorhave not tried2016-08-24 14:212016-08-26 13:21
ReportershuehnerView Statuspublic 
Assigned Toshuehner 
PrioritynormalResolutionfixedFixed in Version3.0PR16Q4
StatusclosedFix in branchFixed in SCM revision4dddd6f401c6
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

0033794: Accidental double queries in DataSourceServiceProvider.getDataSourceFromDataSourceName

DescriptionThat function calls .list() twice on same instance leading do sql query run twice.

As the filter used is for a field (name) having a unique constraint double .list() usage can be simplified to just .uniqueResult as the case of >1 result rows cannot happen.
Steps To Reproducewith debugging code from https://issues.openbravo.com/view.php?id=33767 [^] applied
run try (erp) and observe debugging output during try-initial-pgsql job

Unknwown which exact UI action triggers this special case which is 'get datasourceByName compared to getting it byId.

See logic in getRealDataSource for the difference in calling.
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 

-  Notes
(0089345)
hgbot (developer)
2016-08-24 14:24

Repository: erp/devel/pi
Changeset: 4dddd6f401c6cf36a2aa5af49458abe2f8c5280f
Author: Stefan Hühner <stefan.huehner <at> openbravo.com>
Date: Wed Aug 24 14:23:41 2016 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/4dddd6f401c6cf36a2aa5af49458abe2f8c5280f [^]

Fixed 33794. Avoid double .list() call by using .uniqueResult() instead.

Code did check for >1 result rows while reading from obserds_datasource.
However as the filter is on the name column and that column has an unique
constraint that case of >1 cannot happen.

So simplify to just call .uniqueResult() removing both .list() calls.

---
M modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServiceProvider.java
---
(0089385)
caristu (developer)
2016-08-25 10:52

Code reviewed
(0089425)
hgbot (developer)
2016-08-26 08:25

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

related to issue 33794: updated copyright year

---
M modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DataSourceServiceProvider.java
---
(0089456)
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-24 14:21 shuehner New Issue
2016-08-24 14:21 shuehner Assigned To => platform
2016-08-24 14:21 shuehner Modules => Core
2016-08-24 14:21 shuehner Triggers an Emergency Pack => No
2016-08-24 14:21 shuehner Tag Attached: Performance
2016-08-24 14:21 shuehner Relationship added related to 0033767
2016-08-24 14:24 hgbot Checkin
2016-08-24 14:24 hgbot Note Added: 0089345
2016-08-24 14:24 hgbot Status new => resolved
2016-08-24 14:24 hgbot Resolution open => fixed
2016-08-24 14:24 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/4dddd6f401c6cf36a2aa5af49458abe2f8c5280f [^]
2016-08-24 14:24 shuehner Review Assigned To => caristu
2016-08-24 15:00 shuehner Assigned To platform => shuehner
2016-08-25 10:52 caristu Note Added: 0089385
2016-08-25 10:52 caristu Status resolved => closed
2016-08-25 10:52 caristu Fixed in Version => 3.0PR16Q4
2016-08-26 08:25 hgbot Checkin
2016-08-26 08:25 hgbot Note Added: 0089425
2016-08-26 13:21 hudsonbot Checkin
2016-08-26 13:21 hudsonbot Note Added: 0089456


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker