Openbravo Issue Tracking System - Retail Modules
View Issue Details
0027638Retail ModulesCash uppublic2014-09-18 16:522014-10-02 19:02
egoitz 
marvintm 
immediatecriticalalways
closedfixed 
5
 
RR14Q4 
marvintm
No
0027638: The cashup process takes long in some cases and causes locks on the database
The cashup process takes long in some cases and causes locks on the database.
If many cashups are done at the same time and the first one takes long, a lock is made on the ad_sequence table to obtain the documentno for the shipment.
The rest of casuhps are locked until the first one finish.
It causes locks and performance problems on the server.
-Execute several cashups at the same time and check the pg_locks table of postgresql.
Performance
related to defect 0027943 closed mtaal The OrderLoader process produce locks on the ad_sequence table. 
Issue History
2014-09-18 16:52egoitzNew Issue
2014-09-18 16:52egoitzAssigned To => marvintm
2014-09-18 16:52egoitzResolution time => 1411164000
2014-09-18 16:52egoitzTriggers an Emergency Pack => No
2014-09-18 16:53egoitzTag Attached: Performance
2014-09-26 18:02hgbotCheckin
2014-09-26 18:02hgbotNote Added: 0070443
2014-09-26 18:02hgbotCheckin
2014-09-26 18:02hgbotNote Added: 0070444
2014-09-26 18:02hgbotCheckin
2014-09-26 18:02hgbotNote Added: 0070445
2014-09-26 18:02hgbotCheckin
2014-09-26 18:02hgbotNote Added: 0070446
2014-09-26 18:03hgbotCheckin
2014-09-26 18:03hgbotNote Added: 0070447
2014-09-26 18:09hgbotCheckin
2014-09-26 18:09hgbotNote Added: 0070448
2014-09-26 18:09hgbotCheckin
2014-09-26 18:09hgbotNote Added: 0070449
2014-09-26 18:09hgbotCheckin
2014-09-26 18:09hgbotNote Added: 0070450
2014-09-26 22:34mtaalStatusnew => scheduled
2014-09-26 22:34mtaalNote Added: 0070456
2014-09-26 22:34mtaalfix_in_branch => pi
2014-09-26 22:34mtaalNote Added: 0070457
2014-09-26 22:34mtaalStatusscheduled => resolved
2014-09-26 22:34mtaalResolutionopen => fixed
2014-09-30 18:16jpcalventeIssue Monitored: jpcalvente
2014-10-02 19:02marvintmReview Assigned To => marvintm
2014-10-02 19:02marvintmStatusresolved => closed
2014-10-02 19:02marvintmFixed in Version => RR14Q4
2014-10-22 10:23egoitzRelationship addedrelated to 0027943

Notes
(0070443)
hgbot   
2014-09-26 18:02   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 8182ad32c31917bd711e53fc24da1aead418a474
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Fri Sep 26 17:05:44 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/8182ad32c31917bd711e53fc24da1aead418a474 [^]

Related to issue 27638: The cashup process takes long in some cases and causes locks on the database
Made executeHooks method protected to allow testcase to extend it.

---
M src/org/openbravo/retail/posterminal/CashCloseProcessor.java
---
(0070444)
hgbot   
2014-09-26 18:02   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 7f7810cdeba3b757e8e85ecfeb123b700bb80882
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Fri Sep 26 17:07:27 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/7f7810cdeba3b757e8e85ecfeb123b700bb80882 [^]

Related to issue 27638: The cashup process takes long in some cases and causes locks on the database
- Let the flush happen just before enabling the triggers
- change the log level from info to debug
- made executeHooks protected to make it extendable (for unit testcases)

---
M src/org/openbravo/retail/posterminal/OrderLoader.java
---
(0070445)
hgbot   
2014-09-26 18:02   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: bb9887a055cd64ae0bd2880faced99746454e15a
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Fri Sep 26 17:09:51 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/bb9887a055cd64ae0bd2880faced99746454e15a [^]

Related to issue 27638: The cashup process takes long in some cases and causes locks on the database
- placed flush at one location
- implemented getCashCloseProcessor method to make retrieving cash close processor extendable
- moved cashUp.setProcessedbo to cash close processor as it should be there at the end
- saving the cashup is not needed as the cashup is already retrieved from hibernate, saving happens automatically

---
M src/org/openbravo/retail/posterminal/ProcessCashClose.java
---
(0070446)
hgbot   
2014-09-26 18:02   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 7665b2eaa8ccf2e71c4eae5d73b5653965ad4d05
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Fri Sep 26 17:50:12 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/7665b2eaa8ccf2e71c4eae5d73b5653965ad4d05 [^]

Related to issue 27638: The cashup process takes long in some cases and causes locks on the database
- Only keep one flush action, is enough also for larger cashups
- Removed intermediate session clear, cashups are large enough to use clear, also gives clearer/less complex structure
- Read shipments directly from orderline, instead of using separate queries, prevents a query in the database
- Refresh of object from db not needed, adding invoiceline to orderline in the code, this works also

---
M src/org/openbravo/retail/posterminal/OrderGroupingProcessor.java
---
(0070447)
hgbot   
2014-09-26 18:03   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 7b650d0dfbd4ba968a1fcd1af3e27c93652f10be
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Fri Sep 26 17:56:05 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/7b650d0dfbd4ba968a1fcd1af3e27c93652f10be [^]

Related to issue 27638: The cashup process takes long in some cases and causes locks on the database
Added testcase to test performance of cashup and orderloading

---
M src/org/openbravo/retail/posterminal/OrderGroupingProcessor.java
A src-test/org/openbravo/retail/posterminal/OBBaseRetailTest.java
A src-test/org/openbravo/retail/posterminal/POSOrderCashupPerformanceTest.java
A src-test/org/openbravo/retail/posterminal/cashup.json
A src-test/org/openbravo/retail/posterminal/order1.json
A src-test/org/openbravo/retail/posterminal/order2.json
---
(0070448)
hgbot   
2014-09-26 18:09   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 2d6d69c19e41fc3136bfa669e1045a0338ab0079
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Fri Sep 26 18:08:06 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/2d6d69c19e41fc3136bfa669e1045a0338ab0079 [^]

Related to issue 27638, Backed out changeset 7b650d0dfbd4, files committed together
Files should be committed in separate commits

---
M src/org/openbravo/retail/posterminal/OrderGroupingProcessor.java
R src-test/org/openbravo/retail/posterminal/OBBaseRetailTest.java
R src-test/org/openbravo/retail/posterminal/POSOrderCashupPerformanceTest.java
R src-test/org/openbravo/retail/posterminal/cashup.json
R src-test/org/openbravo/retail/posterminal/order1.json
R src-test/org/openbravo/retail/posterminal/order2.json
---
(0070449)
hgbot   
2014-09-26 18:09   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: 66be68f56a16c01623129680f237bd4925c33ccd
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Fri Sep 26 18:08:47 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/66be68f56a16c01623129680f237bd4925c33ccd [^]

Related to issue 27638, added testcase to test/check performance

---
A src-test/org/openbravo/retail/posterminal/OBBaseRetailTest.java
A src-test/org/openbravo/retail/posterminal/POSOrderCashupPerformanceTest.java
A src-test/org/openbravo/retail/posterminal/cashup.json
A src-test/org/openbravo/retail/posterminal/order1.json
A src-test/org/openbravo/retail/posterminal/order2.json
---
(0070450)
hgbot   
2014-09-26 18:09   
Repository: erp/pmods/org.openbravo.retail.posterminal
Changeset: addb7aa2c08aaa1d660a9b82da4432ef6cb6326a
Author: Martin Taal <martin.taal <at> openbravo.com>
Date: Fri Sep 26 18:09:30 2014 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.posterminal/rev/addb7aa2c08aaa1d660a9b82da4432ef6cb6326a [^]

Related to issue 27638: The cashup process takes long in some cases and causes locks on the database
Set the document no at the end of the ordergrouping in a separate flush, this limits the time the sequence table is locked

---
M src/org/openbravo/retail/posterminal/OrderGroupingProcessor.java
---
(0070456)
mtaal   
2014-09-26 22:34   
.
(0070457)
mtaal   
2014-09-26 22:34   
Resolved with above commits