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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0033137
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Retail Modules] Web POSminorhave not tried2016-06-05 14:142016-06-15 19:12
ReportershuehnerView Statuspublic 
Assigned Toshuehner 
PrioritynormalResolutionfixedFixed in Version
StatusclosedFix in branchFixed in SCM revisionff679a972979
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tomarvintm
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0033137: Useless m_product read from services product even if services are not used

DescriptionThe addition of services project with createLinesForServiceProduct and the HashMap orderlineServiceList added a m_product read to OrderLoader which is not required if services are not used.

That extra overhead should be at least avoided if services are not used.

Relevant code is in createOrderLines:
      if ("S".equals(orderline.getProduct().getProductType())) {
        // related can be null
        if (jsonOrderLine.has("relatedLines")) {
          orderLineServiceList.put(orderline.getId(), jsonOrderLine.getJSONArray("relatedLines"));

The conditions can be swapped around to avoid the getProduct() call if there is no relatedLines in the json.
Steps To ReproduceTrace all SQL of orderloader.
TagsPerformance
Attached Filesdiff file icon 33137_part1.diff [^] (4,710 bytes) 2016-06-05 14:20 [Show Content]
diff file icon 33137_part2.diff [^] (802 bytes) 2016-06-05 14:20 [Show Content]

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0033178 closedSandrahuguet Service project related code in OrderLoader re-reads just created orderline 

-  Notes
(0087002)
shuehner (administrator)
2016-06-05 14:20

Patch in 2 parts:
a.) Review createLinesForServiceProduct function which only does any real work if the 'value' part of the HashMap is not null.
So the else part inside createOrderLines which insert into the HashMap with value=null is useless.
33137_part1.diff cleans up that part to avoid some overhead and simplify the code.

b.) Now with the part inside createOrderLines simplified the 2 if conditions can be swapped around which does not trigger getProduct() sql read unless there is really a relatedLines item present in the json.

So the read overhead is removed unless services/relatedLines are really used.
(0087130)
hgbot (developer)
2016-06-09 15:48

Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 70c2aca3faa72a1a4535e3ca46e94c481dd9bd2c
Author: Stefan Hühner <stefan.huehner <at> openbravo.com>
Date: Tue Jun 07 17:19:06 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/70c2aca3faa72a1a4535e3ca46e94c481dd9bd2c [^]

Issue 33137. Simplify code related to createLinesForServiceProduct.

The only reader of the HashMap orderLineServiceList only does any processing
if the value part of the map is not null.
So avoid inserting into the HashMap any entries which have value null as those
are not useful (and remove the != null check also)

---
M src/org/openbravo/retail/posterminal/OrderLoader.java
---
(0087131)
hgbot (developer)
2016-06-09 15:48

Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: ff679a9729794badd242c68064c80efc8c4e1457
Author: Stefan Hühner <stefan.huehner <at> openbravo.com>
Date: Tue Jun 07 17:20:39 2016 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/ff679a9729794badd242c68064c80efc8c4e1457 [^]

Fixed 33137. Avoid m_product read if not service lines are used.

Swap check condition for m_product.getType() == S and if the json
has a relatedLines part.
By checking json first we avoid the m_product read in the normal case.

---
M src/org/openbravo/retail/posterminal/OrderLoader.java
---

- Issue History
Date Modified Username Field Change
2016-06-05 14:14 shuehner New Issue
2016-06-05 14:14 shuehner Assigned To => Retail
2016-06-05 14:14 shuehner Triggers an Emergency Pack => No
2016-06-05 14:14 shuehner Tag Attached: Performance
2016-06-05 14:20 shuehner Note Added: 0087002
2016-06-05 14:20 shuehner File Added: 33137_part1.diff
2016-06-05 14:20 shuehner File Added: 33137_part2.diff
2016-06-07 18:09 shuehner Relationship added related to 0033178
2016-06-09 15:48 hgbot Checkin
2016-06-09 15:48 hgbot Note Added: 0087130
2016-06-09 15:48 hgbot Checkin
2016-06-09 15:48 hgbot Note Added: 0087131
2016-06-09 15:48 hgbot Status new => resolved
2016-06-09 15:48 hgbot Resolution open => fixed
2016-06-09 15:48 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/ff679a9729794badd242c68064c80efc8c4e1457 [^]
2016-06-09 15:57 shuehner Assigned To Retail => shuehner
2016-06-09 15:57 shuehner Review Assigned To => marvintm
2016-06-15 19:12 marvintm Status resolved => closed


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker