Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0033134Openbravo ERPA. Platformpublic2016-06-03 17:372018-01-03 12:39
shuehner 
inigosanchez 
highminorhave not tried
closedfixed 
5
 
3.0PR18Q1 
alostale
Core
No
0033134: ImportEntryProcessor calls initialize() 2 times on OBContext switch causing extra db queries
ImportEntryProcessor.setOBContext function has following code:

        // initialize several things so that they are not initialized
        // during the processing
        obContext.getEntityAccessChecker().initialize();

However the getEntityAccessChecker() does either return a already initialized objects.

Or it creates a new one and does the initialize() calls itself.

So calling initialize() on the result does calls it 2 times.

That is bad as the init method has 2 db queries which are thus called double.

duration: 0.353 ms execute S_2581/C_2582: select adtab0_.AD_Table_ID as col_0_0_, adwindowac2_.IsReadWrite as col_1_0_ from AD_Tab adtab0_ left outer join AD_Window adwindow1_ on adtab0_.AD_Window_ID=adwindow1_.AD_Window_ID left outer join AD_Window_Access adwindowac2_ on adwindow1_.AD_Window_ID=adwindowac2_.AD_Window_ID where adwindowac2_.AD_Role_ID=$1
duration: 0.010 ms execute S_2583/C_2584: select adtableacc0_.AD_Table_Access_ID as AD1_101_, adtableacc0_.AD_Role_ID as AD2_101_, adtableacc0_.AD_Table_ID as AD3_101_, adtableacc0_.AD_Client_ID as AD4_101_, adtableacc0_.AD_Org_ID as AD5_101_, adtableacc0_.IsActive as IsActive101_, adtableacc0_.Created as Created101_, adtableacc0_.CreatedBy as CreatedBy101_, adtableacc0_.UpdatedBy as UpdatedBy101_, adtableacc0_.Updated as Updated101_, adtableacc0_.IsReadOnly as IsReadOnly101_, adtableacc0_.IsExclude as IsExclude101_, adtableacc0_.Inherited_From as Inherited13_101_ from AD_Table_Access adtableacc0_ where adtableacc0_.AD_Role_ID='29A79A279DC54348B58A2C64891F35AA'

2nd set:
duration: 0.322 ms execute S_2585/C_2586: select adtab0_.AD_Table_ID as col_0_0_, adwindowac2_.IsReadWrite as col_1_0_ from AD_Tab adtab0_ left outer join AD_Window adwindow1_ on adtab0_.AD_Window_ID=adwindow1_.AD_Window_ID left outer join AD_Window_Access adwindowac2_ on adwindow1_.AD_Window_ID=adwindowac2_.AD_Window_ID where adwindowac2_.AD_Role_ID=$1
duration: 0.009 ms execute S_2587/C_2588: select adtableacc0_.AD_Table_Access_ID as AD1_101_, adtableacc0_.AD_Role_ID as AD2_101_, adtableacc0_.AD_Table_ID as AD3_101_, adtableacc0_.AD_Client_ID as AD4_101_, adtableacc0_.AD_Org_ID as AD5_101_, adtableacc0_.IsActive as IsActive101_, adtableacc0_.Created as Created101_, adtableacc0_.CreatedBy as CreatedBy101_, adtableacc0_.UpdatedBy as UpdatedBy101_, adtableacc0_.Updated as Updated101_, adtableacc0_.IsReadOnly as IsReadOnly101_, adtableacc0_.IsExclude as IsExclude101_, adtableacc0_.Inherited_From as Inherited13_101_ from AD_Table_Access adtableacc0_ where adtableacc0_.AD_Role_ID='29A79A279DC54348B58A2C64891F35AA'

In install containing webpos.
Enable logging of all sql
Trigger OrderLoader (make a ticket)

Trace SQL logged just before OrderLoader starts it functional work.
Performance
related to feature request 0035622 closed inigosanchez Improve performance of the Entity Access Checker process 
Issue History
2016-06-03 17:37shuehnerNew Issue
2016-06-03 17:37shuehnerAssigned To => platform
2016-06-03 17:37shuehnerModules => Core
2016-06-03 17:37shuehnerTriggers an Emergency Pack => No
2016-06-03 17:37shuehnerTag Attached: Performance
2016-06-03 17:38shuehnerNote Added: 0086997
2016-07-15 09:53alostaleStatusnew => acknowledged
2016-07-15 09:53alostalePrioritynormal => urgent
2016-12-01 13:20alostalePriorityurgent => normal
2016-12-01 14:05alostalePrioritynormal => urgent
2016-12-01 14:05alostalePriorityurgent => high
2017-05-29 13:31shuehnerRelationship addedrelated to 0035622
2017-11-23 10:39inigosanchezStatusacknowledged => scheduled
2017-11-23 10:39inigosanchezAssigned Toplatform => inigosanchez
2017-11-24 10:50inigosanchezReview Assigned To => alostale
2017-11-24 10:58hgbotCheckin
2017-11-24 10:58hgbotNote Added: 0100697
2017-11-24 10:58hgbotStatusscheduled => resolved
2017-11-24 10:58hgbotResolutionopen => fixed
2017-11-24 10:58hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/64d20a56c50aef9567da1c1c781654f13fe9946a [^]
2017-11-27 11:23hgbotCheckin
2017-11-27 11:23hgbotNote Added: 0100735
2017-11-27 11:23alostaleNote Added: 0100736
2017-11-27 11:23alostaleStatusresolved => closed
2017-11-27 11:23alostaleFixed in Version => 3.0PR18Q1
2018-01-03 12:39hudsonbotCheckin
2018-01-03 12:39hudsonbotNote Added: 0101454
2018-01-03 12:39hudsonbotCheckin
2018-01-03 12:39hudsonbotNote Added: 0101459

Notes
(0086997)
shuehner   
2016-06-03 17:38   
Note: removing initialize makes this line of code looks not useful on first glance.

So a code-comment should be added to adjust developer that this line is required and does .initialize() indirectly.
(0100697)
hgbot   
2017-11-24 10:58   
Repository: erp/devel/pi
Changeset: 64d20a56c50aef9567da1c1c781654f13fe9946a
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Fri Nov 24 10:55:40 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/64d20a56c50aef9567da1c1c781654f13fe9946a [^]

Fixed issue 33134: ImportEntryProcessor calls initialize() two times

ImportEntryProcessor was causing extra db queries because it was calling EntityAccessChecker.initialize()
two times. In order to fix the problem, it has been removed one of the calls to initialize method.

---
M src/org/openbravo/service/importprocess/ImportEntryProcessor.java
---
(0100735)
hgbot   
2017-11-27 11:23   
Repository: erp/devel/pi
Changeset: a2e1574d92e2f9fd4d1a663d1403b337d7be8d55
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon Nov 27 11:22:37 2017 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/a2e1574d92e2f9fd4d1a663d1403b337d7be8d55 [^]

related to bug 33134: made comment clearer

---
M src/org/openbravo/service/importprocess/ImportEntryProcessor.java
---
(0100736)
alostale   
2017-11-27 11:23   
reviewed + tested
(0101454)
hudsonbot   
2018-01-03 12:39   
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
(0101459)
hudsonbot   
2018-01-03 12:39   
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