Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0032023Openbravo ERP04. Warehouse managementpublic2016-01-27 13:092016-07-20 11:34
ioritzCia 
aferraz 
highmajoralways
closedfixed 
5
 
3.0PR16Q23.0PR16Q2 
dmiguelez
Google Chrome
Core
No
0032023: CostingUtils.getCurrentValuedStock method consumes unneeded memory
getCurrentValuedStock method in CostingUtils class consumes more memory than it should. It lists the query results where it should use scrolling technique for it.

It should also be evaluated if all the calculation could be done in one query instead of having to loop.

Also with new fields added in cost adjustment developments, the joins to the MaterialTransaction and ShipmentInOut tables are not necessary, neither is the grouping and a couple of coalesces done in the query.
Execute the costing background process.
Performance
related to defect 00321903.0PR16Q2 closed aferraz Performance problems on the PriceDifferenceBackground process 
related to defect 00334113.0PR17Q1 closed dmiguelez Bad performance Costing Background process using 3 types of adjustments 
related to defect 0035959 closed markmm82 Performance problem in Costing Migration Process with high volume of records in m_transaction table 
Issue History
2016-01-27 13:09ioritzCiaNew Issue
2016-01-27 13:09ioritzCiaAssigned To => Triage Finance
2016-01-27 13:09ioritzCiaWeb browser => Google Chrome
2016-01-27 13:09ioritzCiaModules => Core
2016-01-27 13:09ioritzCiaTriggers an Emergency Pack => No
2016-01-27 13:09ioritzCiaTag Attached: Performance
2016-01-27 13:43ioritzCiaWeb browserGoogle Chrome => Google Chrome
2016-01-27 13:45ioritzCiaWeb browserGoogle Chrome => Google Chrome
2016-01-28 18:16ngarciaIssue Monitored: ngarcia
2016-01-28 18:20ngarciaWeb browserGoogle Chrome => Google Chrome
2016-01-28 18:20ngarciaResolution time => 1456873200
2016-02-04 14:08aferrazAssigned ToTriage Finance => aferraz
2016-02-04 14:08aferrazStatusnew => scheduled
2016-02-12 13:53aferrazRelationship addedrelated to 0032190
2016-02-19 12:39hgbotCheckin
2016-02-19 12:39hgbotNote Added: 0084361
2016-02-19 12:39hgbotStatusscheduled => resolved
2016-02-19 12:39hgbotResolutionopen => fixed
2016-02-19 12:39hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/ca36991325a4e9680fbbb9fd36c755ae3f5500de [^]
2016-02-19 12:39dmiguelezReview Assigned To => dmiguelez
2016-02-19 12:39dmiguelezNote Added: 0084363
2016-02-19 12:39dmiguelezStatusresolved => closed
2016-03-17 10:56hudsonbotCheckin
2016-03-17 10:56hudsonbotNote Added: 0085155
2016-07-20 11:31aferrazRelationship addedrelated to 0033411
2016-07-20 11:32aferrazWeb browserGoogle Chrome => Google Chrome
2016-07-20 11:32aferrazFixed in Version => 3.0PR16Q2
2016-07-20 11:34aferrazWeb browserGoogle Chrome => Google Chrome
2016-07-20 11:34aferrazTarget Version => 3.0PR16Q2
2017-05-09 12:31aferrazRelationship addedrelated to 0035959

Notes
(0084361)
hgbot   
2016-02-19 12:39   
Repository: erp/devel/pi
Changeset: ca36991325a4e9680fbbb9fd36c755ae3f5500de
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Mon Feb 15 19:53:12 2016 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/ca36991325a4e9680fbbb9fd36c755ae3f5500de [^]

Fixes issue 32023 & Fixes issue 32190: Improve PriceDifference performance

Some improvements have been done in CostingUtils.getCurrentValuedStock, CostAdjustmentUtils.getValuedStockOnMovementDateByAttrAndLocator, CostAdjustmentUtils.getValuedStockOnTransactionDate and CostingMigrationProcess.getCurrentValuedStock methods:
- Use TransactionCost.PROPERTY_ACCOUNTINGDATE field instead of coalesce(ShipmentInOut.PROPERTY_ACCOUNTINGDATE, MaterialTransaction.PROPERTY_MOVEMENTDATE) to avoid join with ShipmentInOutLine and ShipmentInOut tables.
- Use a scroll instead of looping through a list.
- Loop can not be avoid due to the need of calculate conversion rate recursively.
- Clear every 100 loops will not be done as DAL objects will not be loaded in memory and to avoid session cleared errors.
Retrieve only one or two results in some queries where more results were not needed.
Use isEmpty() instead of size().
Retrieve only lineno field instead of full object in CostAdjustmentUtils.getNewLineNo method.
Improve CostAdjustmentUtils.getTrxCost method.
Do a clear every 100 loops in PriceDifferenceProcess.processPriceDifference method to improve performance.

---
M src/org/openbravo/costing/AverageAlgorithm.java
M src/org/openbravo/costing/AverageCostAdjustment.java
M src/org/openbravo/costing/CostAdjustmentUtils.java
M src/org/openbravo/costing/CostingMigrationProcess.java
M src/org/openbravo/costing/CostingUtils.java
M src/org/openbravo/costing/PriceDifferenceProcess.java
---
(0084363)
dmiguelez   
2016-02-19 12:39   
Code Review + Testing Ok
(0085155)
hudsonbot   
2016-03-17 10:56   
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/b22fb0500156 [^]
Maturity status: Test