Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0033994Openbravo ERP04. Warehouse managementpublic2016-07-01 14:252016-11-04 15:08
VictorVillar 
dmiguelez 
immediatecriticalalways
closedfixed 
5
 
3.0PR16Q3.33.0PR16Q3.3 
aferraz
Core
No
0033994: Bad performance Costing Background process using 3 types of adjustments
Bad performance Costing Background process using 3 types of adjustments
Bad performance Costing Background process using 3 types of adjustments: Backdated, Price Cost Correction, Negative Stock correction.

This query is taking more than 1.5 seconds:

2016-07-01 04:21:54 CDT LOG: duration: 1699.337 ms execute S_18203/C_18204: select max(materialmg0_.MovementDate) as col_0_0_ from M_Transaction materialmg0_ where materialmg0_.IsCostCalculated='Y' and (materialmg0_.AD_Org_ID in ($1))
No tags attached.
blocks defect 00334113.0PR17Q1 closed dmiguelez Bad performance Costing Background process using 3 types of adjustments 
Issue History
2016-09-14 18:27aferrazTypedefect => backport
2016-09-14 18:27aferrazTarget Version => 3.0PR16Q3.2
2016-09-29 17:52dmiguelezTarget Version3.0PR16Q3.2 => 3.0PR16Q3.3
2016-11-03 21:08hgbotCheckin
2016-11-03 21:08hgbotNote Added: 0091147
2016-11-03 21:08hgbotStatusscheduled => resolved
2016-11-03 21:08hgbotResolutionopen => fixed
2016-11-03 21:08hgbotFixed in SCM revision => http://code.openbravo.com/erp/backports/3.0PR16Q3.3/rev/fa2a7bc604de5c1955078e50ed2300349483722e [^]
2016-11-03 21:08hgbotCheckin
2016-11-03 21:08hgbotNote Added: 0091148
2016-11-03 21:08hgbotCheckin
2016-11-03 21:08hgbotNote Added: 0091149
2016-11-03 21:08hgbotCheckin
2016-11-03 21:08hgbotNote Added: 0091150
2016-11-03 21:08hgbotCheckin
2016-11-03 21:08hgbotNote Added: 0091151
2016-11-03 21:08hgbotCheckin
2016-11-03 21:08hgbotNote Added: 0091152
2016-11-03 21:09aferrazReview Assigned To => aferraz
2016-11-03 21:09aferrazNote Added: 0091153
2016-11-03 21:09aferrazStatusresolved => closed
2016-11-03 21:09aferrazFixed in Version => 3.0PR16Q3.3
2016-11-04 15:06hgbotCheckin
2016-11-04 15:06hgbotNote Added: 0091176
2016-11-04 15:08aferrazNote Deleted: 0091153
2016-11-04 15:08aferrazNote Added: 0091179

Notes
(0091147)
hgbot   
2016-11-03 21:08   
Repository: erp/backports/3.0PR16Q3.3
Changeset: fa2a7bc604de5c1955078e50ed2300349483722e
Author: David Miguelez <david.miguelez <at> openbravo.com>
Date: Mon Sep 26 19:57:27 2016 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR16Q3.3/rev/fa2a7bc604de5c1955078e50ed2300349483722e [^]

Fixes issue 33994: Bad performance in Costing Background with all adjustments

- Add M_TRANSACTION_TRXPROCDATE index same as M_TRANSACTION_MOVEMENTDATE
- Modify M_TRANSACTION_CALCULATED index, by adding movementdate column in order to improve CostingUtils.getMaxTransactionDate query.
- Add new M_LASTTRX table to store last transaction movementdate and improve CostAdjustmentUtils.isNeededBackdatedCostAdjustment query.

---
M src-db/database/model/tables/M_TRANSACTION.xml
M src-db/database/sourcedata/AD_COLUMN.xml
M src-db/database/sourcedata/AD_TABLE.xml
M src/org/openbravo/costing/CostAdjustmentUtils.java
M src/org/openbravo/costing/CostingServer.java
A src-db/database/model/tables/M_LASTTRX.xml
---
(0091148)
hgbot   
2016-11-03 21:08   
Repository: erp/backports/3.0PR16Q3.3
Changeset: 6cbddc71d1342adaa6e764e211788ba9aaec473a
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Tue Sep 27 12:38:06 2016 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR16Q3.3/rev/6cbddc71d1342adaa6e764e211788ba9aaec473a [^]

Related to issue 33994: Code review improvements

- Remove unnecessary M_LASTTRX_PRODUCT_IDX and M_LASTTRX_WAREHOUSE_IDX indexes and create M_LASTTRX_PRODUCT_ORG_WH index with m_product_id, ad_org_id and m_warehouse_id columns.
- Remove unnecessary M_TRX_CALCULATED_MOVEMENTDATE and M_TRX_CALCULATED_PRODUCT_DATES indexes.
- Remove unneeded parameters in CostingServer.updateLastTransaction method, and make it private and non static.
- Remove unnecessary flush() after calling to updateLastTransaction, as flush() is already done in finally statement.
- Move getLastTransaction method from CostingServer to CostAdjustmentUtils class.
- Remove unneeded startingDate parameter in CostAdjustmentUtils.getLastTransaction method.
- Merge isBeforeLastTransaction and isAfterLastTransaction methods into CostAdjustmentUtils.compareToLastTransaction new method.

---
M src-db/database/model/tables/M_LASTTRX.xml
M src-db/database/model/tables/M_TRANSACTION.xml
M src/org/openbravo/costing/CostAdjustmentUtils.java
M src/org/openbravo/costing/CostingServer.java
---
(0091149)
hgbot   
2016-11-03 21:08   
Repository: erp/backports/3.0PR16Q3.3
Changeset: 0016c52766bf8f66379652dff9b2dd8b51c6b386
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Tue Sep 27 19:29:56 2016 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR16Q3.3/rev/0016c52766bf8f66379652dff9b2dd8b51c6b386 [^]

Related to issue 33994: Rename table from M_LASTTRX to M_TRANSACTION_LAST

Rename table from M_LASTTRX to M_TRANSACTION_LAST and remove unneeded movementdate, trxprocessdate, movementtype and qty columns.

---
M src-db/database/sourcedata/AD_COLUMN.xml
M src-db/database/sourcedata/AD_TABLE.xml
M src/org/openbravo/costing/CostAdjustmentUtils.java
M src/org/openbravo/costing/CostingServer.java
A src-db/database/model/tables/M_TRANSACTION_LAST.xml
R src-db/database/model/tables/M_LASTTRX.xml
---
(0091150)
hgbot   
2016-11-03 21:08   
Repository: erp/backports/3.0PR16Q3.3
Changeset: c0602d9ffaad869c0441b60245cddde4e7d85d48
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Tue Oct 11 18:50:35 2016 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR16Q3.3/rev/c0602d9ffaad869c0441b60245cddde4e7d85d48 [^]

Related to issue 33994: Run Synchronize Terminology

---
M src-db/database/sourcedata/AD_COLUMN.xml
M src-db/database/sourcedata/AD_ELEMENT.xml
M src/org/openbravo/costing/CostAdjustmentUtils.java
M src/org/openbravo/costing/CostingServer.java
---
(0091151)
hgbot   
2016-11-03 21:08   
Repository: erp/backports/3.0PR16Q3.3
Changeset: 34ed1ac21390fe3f0eb1a58fd46d64f0c8bfdd00
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Tue Sep 27 19:34:57 2016 +0200
URL: http://code.openbravo.com/erp/backports/3.0PR16Q3.3/rev/34ed1ac21390fe3f0eb1a58fd46d64f0c8bfdd00 [^]

Related to issue 33994: Delete TransactionLast when validating new Costing Rule

Delete M_Transaction_Last when validating a new Costing Rule and exists a previous rule.

---
M src/org/openbravo/costing/CostingRuleProcess.java
---
(0091152)
hgbot   
2016-11-03 21:08   
Repository: erp/backports/3.0PR16Q3.3
Changeset: 1aefec4714154d8b6d03ed44897b620170a48cdb
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Thu Nov 03 13:57:43 2016 +0100
URL: http://code.openbravo.com/erp/backports/3.0PR16Q3.3/rev/1aefec4714154d8b6d03ed44897b620170a48cdb [^]

Related to issue 33994: Initialize TransactionLast table

In case TransactionLast has not been initialized yet, it will be done by CostAdjustmentUtils.insertLastTransaction method when calling CostAdjustmentUtils.isNeededBackdatedCostAdjustment.

---
M src/org/openbravo/costing/CostAdjustmentUtils.java
---
(0091176)
hgbot   
2016-11-04 15:06   
Repository: erp/backports/3.0PR16Q3.3
Changeset: 8c376c672a5c4fcae3f4136cd109e92eb7907a70
Author: Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
Date: Fri Nov 04 14:33:35 2016 +0100
URL: http://code.openbravo.com/erp/backports/3.0PR16Q3.3/rev/8c376c672a5c4fcae3f4136cd109e92eb7907a70 [^]

Related to issue 33994: Update last transaction before check cost adjustments

---
M src/org/openbravo/costing/CostingServer.java
---
(0091179)
aferraz   
2016-11-04 15:08   
Code review + Testing OK