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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0028479
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminorhave not tried2014-12-23 16:072018-01-03 12:38
ReporteralostaleView Statuspublic 
Assigned Toalostale 
PriorityhighResolutionfixedFixed in Version3.0PR18Q1
StatusclosedFix in branchFixed in SCM revision3dcf5dc6325f
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

0028479: unneeded queries to ad_langue table

DescriptionWhenever a new DAL object instance of any entity that has a reference to AD_Language is created, a query to AD_Language table is executed. This is caused because:

1. Hibernate eagerly initializes many-to-one references that are linked not by primary key but by unique constraint.
2. After this eager initialization the object is not included in 1st level cache.

This is noticeable, for example, when standard views are generated in an instance with translations installed, ad_langue table is unnecessarily queried.

The problem is caused while initializing proxies for trl lists (ie. fld.getADFieldTrlList()). Translation relationship is based not on FK but on unique constraint, due to some issue in Hibernate these relationships are not proxied nor cached, resulting on being queried whenever the object is initialized.

In a customer with translations installed, it's been measured queries to AD_Language to be ~ 8% of the total number of executed queries.
Steps To Reproduce1. Install Spanish translation
2. Set all modules in development so view is always computed
3. Set pg to log all queries
4. Open BP window
    -> Check there are 8500 queries to ad_language (all of them retrieving the same record)
Proposed SolutionBackport HHH-11703 [1] Hibernate issue that adds objects initialized by a unique contraint to 1st level cache. In this way, only one query per different language is executed per request (which typically is just one) instead one per record initialized.

---
[1] https://hibernate.atlassian.net/browse/HHH-11703 [^]
TagsPerformance
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0028477 closedalostale view generation: unneeded queries to trl tables 
related to defect 00207423.0MP13 closedmtaal Many-to-one references to language are always eagerly fetched using a separate query 
related to feature request 0037064 closedcaristu upgrade hibernate to 5.3.2 

-  Notes
(0099855)
alostale (manager)
2017-10-10 16:03

See https://hibernate.atlassian.net/browse/HHH-11703 [^]
(0099901)
hgbot (developer)
2017-10-13 12:19

Repository: erp/devel/pi
Changeset: 3dcf5dc6325f829eef34ffb86a1832aad5502b14
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Oct 13 12:03:15 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/3dcf5dc6325f829eef34ffb86a1832aad5502b14 [^]

fixed bug 28479: unneeded queries to ad_langue

  Backports HHH-11703 [1] Hibernate issue that adds objects initialized by a
  unique contraint to 1st level cache. In this way, only one query per different
  language is executed per request (which typically is just one) instead one per
  record initialized.

  Find code for backport here [2].

---
  [1] https://hibernate.atlassian.net/browse/HHH-11703 [^]
  [2] https://github.com/alostale/hibernate-orm [^]

---
M lib/runtime/hibernate3-patched.jar
---
(0099979)
caristu (developer)
2017-10-20 15:31

Verified
(0101329)
hudsonbot (developer)
2018-01-03 12:38

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/c81e0d3cbab5 [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2014-12-23 16:07 alostale New Issue
2014-12-23 16:07 alostale Assigned To => AugustoMauch
2014-12-23 16:07 alostale Modules => Core
2014-12-23 16:07 alostale Triggers an Emergency Pack => No
2014-12-23 16:09 alostale Tag Attached: per
2014-12-23 16:09 alostale Tag Detached: per
2014-12-23 16:09 alostale Tag Attached: Performance
2014-12-23 16:10 alostale Relationship added related to 0028477
2015-01-07 16:06 shuehner Issue Monitored: shuehner
2015-03-06 14:45 alostale Priority normal => urgent
2015-03-06 14:45 alostale Status new => scheduled
2015-03-06 14:46 alostale Status scheduled => acknowledged
2015-03-11 08:10 alostale Target Version 3.0PR15Q2 =>
2015-03-17 14:37 alostale Assigned To AugustoMauch => platform
2015-11-11 11:37 alostale Priority urgent => normal
2015-11-11 12:42 alostale Priority normal => high
2016-12-01 13:24 alostale Priority high => normal
2016-12-01 14:03 alostale Priority normal => high
2017-10-10 16:03 alostale Note Added: 0099855
2017-10-13 12:02 alostale Relationship added related to 0020742
2017-10-13 12:13 alostale Review Assigned To => caristu
2017-10-13 12:13 alostale Summary view generation: unneeded queries to ad_langue table => unneeded queries to ad_langue table
2017-10-13 12:13 alostale Description Updated View Revisions
2017-10-13 12:13 alostale Steps to Reproduce Updated View Revisions
2017-10-13 12:13 alostale Proposed Solution updated
2017-10-13 12:13 alostale Description Updated View Revisions
2017-10-13 12:19 hgbot Checkin
2017-10-13 12:19 hgbot Note Added: 0099901
2017-10-13 12:19 hgbot Status acknowledged => resolved
2017-10-13 12:19 hgbot Resolution open => fixed
2017-10-13 12:19 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/3dcf5dc6325f829eef34ffb86a1832aad5502b14 [^]
2017-10-13 12:36 alostale Assigned To platform => alostale
2017-10-13 12:38 alostale Relationship added related to 0037064
2017-10-20 15:31 caristu Note Added: 0099979
2017-10-20 15:31 caristu Status resolved => closed
2017-10-20 15:31 caristu Fixed in Version => 3.0PR18Q1
2018-01-03 12:38 hudsonbot Checkin
2018-01-03 12:38 hudsonbot Note Added: 0101329


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker