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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0039755
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] I. Performancemajorhave not tried2018-12-04 15:262018-12-17 20:39
ReporterSandrahuguetView Statuspublic 
Assigned ToSandrahuguet 
PrioritynormalResolutionfixedFixed in Version3.0PR19Q1
StatusclosedFix in branchFixed in SCM revisione893c16b5687
ProjectionnoneETAnoneTarget Version
OS@0@DatabasePostgreSQLJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Toalostale
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0039755: It would be nice to have a method to use lock "FOR NO KEY UPDATE"

DescriptionIt would be nice to have a method to use lock "FOR NO KEY UPDATE", because "FOR UPDATE" in PostgreSQL is too aggressive.
Steps To Reproduce- In order to easily simulate the 2 transactions are processed at same time it is necessary to set a break-point just after execution of following code :

financialAccount.setCurrentBalance(financialAccount.getCurrentBalance().subtract(transaction.getDepositAmount()).add(transaction.getPaymentAmount()));

- Go to Payment In and create a payment:
  Organization: F&B España - Region Norte
  Received From: Alimentos y Supermercados, S.A
  Payment Method: Transferencia
  Deposit To: Cuenta de Banco - EUR
  Amount: 100
  In Add details - > Overpayment Action: Leave the credit to be used later
  Done and execution should be stopped in previous break-point

- Open "new incognito window" in Chrome and access
  Go to Payment In and create a new payment:
  Organization: F&B España - Region Norte
  Received From: Restaurantes Luna Llena, S.A.
  Payment Method: Transferencia
  Deposit To: Cuenta de Banco - EUR
  Amount: 200
  Click in add details, the popup does not open, save the header is locked
Proposed SolutionThis is required for PostgreSQL as a workaround until a newer Hibernate version implements HHH-13135 [1].

[1] https://hibernate.atlassian.net/browse/HHH-13135 [^]
TagsPerformance
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
depends on backport 00397563.0PR18Q4.1 closedSandrahuguet It would be nice to have a method to use lock "FOR NO KEY UPDATE" 
depends on backport 00397573.0PR18Q3.4 closedSandrahuguet It would be nice to have a method to use lock "FOR NO KEY UPDATE" 
blocks defect 0039672 closedSandrahuguet Improve contention problems in fin_financial_account 

-  Notes
(0108285)
hgbot (developer)
2018-12-05 15:21

Repository: erp/devel/pi
Changeset: 18fd96916ab517067b233cfba9f2f54c70ce3cde
Author: Sandra Huguet <sandra.huguet <at> openbravo.com>
Date: Tue Dec 04 15:42:37 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/18fd96916ab517067b233cfba9f2f54c70ce3cde [^]

Fixed issue 39755 added in OBDAL lockForNoKeyUpdate

new lockForNoKeyUpdate method to allow the use "FOR NO KEY UPDATE",
because "FOR UPDATE" in PostgreSQL is too aggressive.

---
M src/org/openbravo/dal/service/OBDal.java
---
(0108298)
hgbot (developer)
2018-12-05 17:23

Repository: erp/devel/pi
Changeset: 1c1d34a46d47bd88ecdaeeda7e84e00d9c313ec0
Author: Sandra Huguet <sandra.huguet <at> openbravo.com>
Date: Wed Dec 05 17:17:46 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/1c1d34a46d47bd88ecdaeeda7e84e00d9c313ec0 [^]

related to issue 39755 code review changes

Not necessary to return the id. Only creates the lock.
Use createNativeQuery and improve code.

---
M src/org/openbravo/dal/service/OBDal.java
---
(0108300)
alostale (manager)
2018-12-05 17:32

core reviewed + tested in Oracle and PostgreSQL. In both cases:
* Lock is correctly acquired (concurrent threads wait the one with the lock to release it in order to continue).
* Acquiring a record doesn't prevent insertions in other entities with a FK to that record (locking BP an creating an Order for that BP is now possible in PG)
(0108365)
Sandrahuguet (developer)
2018-12-10 16:15

reopen in order to improve lockForNoKeyUpdate method
(0108366)
Sandrahuguet (developer)
2018-12-10 16:16

Discussion thread open by ALO in Hibernate forums about pessimistic write locks being too aggressive in PostgreSQL [1].

[1] https://discourse.hibernate.org/t/too-aggressive-pessimistic-write-lock-in-postgresql/1824 [^] [^]
(0108379)
hgbot (developer)
2018-12-11 08:12

Repository: erp/devel/pi
Changeset: e893c16b5687c6bd83456b837b55c0e77a9c6b7f
Author: Sandra Huguet <sandra.huguet <at> openbravo.com>
Date: Mon Dec 10 16:26:15 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/e893c16b5687c6bd83456b837b55c0e77a9c6b7f [^]

fixed issue 39755 change lockForNoKeyUpdate to return the instance with the lock

*Retrieves an object from the database getting a lock "for no key update" for the indicated
object. Change method name, parameters and return.
*Improve and modify the javadoc with the required changes.

---
M src/org/openbravo/dal/service/OBDal.java
---
(0108398)
alostale (manager)
2018-12-11 15:40

code reviewed + tested + added automatic test cases

https://code.openbravo.com/erp/devel/pi/rev/7e4c318ad6a32159a18d3de6a070cd12f6705217 [^]
(0108513)
hudsonbot (developer)
2018-12-11 20:22

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/470e3cd384c5 [^]
Maturity status: Test
(0108515)
hudsonbot (developer)
2018-12-11 20:22

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/470e3cd384c5 [^]
Maturity status: Test
(0108517)
hudsonbot (developer)
2018-12-11 20:22

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/470e3cd384c5 [^]
Maturity status: Test
(0108579)
hgbot (developer)
2018-12-13 12:12

Repository: erp/devel/pi
Changeset: 2df0dc2f8b0834aeeb5cc605e424c72c7263bb93
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Dec 13 12:07:51 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/2df0dc2f8b0834aeeb5cc605e424c72c7263bb93 [^]

related with issue 39755: prevent time based thread syncrhonization in tests

  Time based synchronization is error-prone and can cause false positives.

  Synchronizing events now with CountDownLatch.

---
M src-test/src/org/openbravo/test/dal/DalLockingTest.java
---
(0108580)
hgbot (developer)
2018-12-13 12:35

Repository: erp/devel/pi
Changeset: 9b27c5a81726ff17cf81cc382fe7d9d87a96f974
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Thu Dec 13 12:35:23 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/9b27c5a81726ff17cf81cc382fe7d9d87a96f974 [^]

related with issue 39755: fail if timeout is reached
  + raname function

---
M src-test/src/org/openbravo/test/dal/DalLockingTest.java
---
(0108607)
hgbot (developer)
2018-12-14 11:44

Repository: erp/devel/pi
Changeset: 2da162a5e21339af4a8662733fc9a45744d997a5
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Dec 14 11:43:52 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/2da162a5e21339af4a8662733fc9a45744d997a5 [^]

related with issue 39755: preventing false test positives

  T1 and T2 could finish exactly at the same time, now the chances are reduced
  by adding a short delay to T2 after finalization. Also synchronizing on exectionOrder

---
M src-test/src/org/openbravo/test/dal/DalLockingTest.java
---
(0108623)
hudsonbot (developer)
2018-12-14 16:04

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/d4b3ed34e1c8 [^]
Maturity status: Test
(0108624)
hudsonbot (developer)
2018-12-14 16:04

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/d4b3ed34e1c8 [^]
Maturity status: Test
(0108626)
hudsonbot (developer)
2018-12-14 16:04

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/d4b3ed34e1c8 [^]
Maturity status: Test
(0108643)
hgbot (developer)
2018-12-17 14:38

Repository: erp/devel/pi
Changeset: 7aada5d51e104d56dfe7f9f05898ce43569546c0
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Mon Dec 17 13:59:23 2018 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/7aada5d51e104d56dfe7f9f05898ce43569546c0 [^]

related with issue 39755: give some time to complete the thread

---
M src-test/src/org/openbravo/test/dal/DalLockingTest.java
---
(0108657)
hudsonbot (developer)
2018-12-17 20: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/79c941a6a880 [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2018-12-04 15:26 Sandrahuguet New Issue
2018-12-04 15:26 Sandrahuguet Assigned To => Sandrahuguet
2018-12-04 15:26 Sandrahuguet Modules => Core
2018-12-04 15:26 Sandrahuguet Triggers an Emergency Pack => No
2018-12-04 15:28 Sandrahuguet Tag Attached: Performance
2018-12-04 15:28 Sandrahuguet Relationship added blocks 0039672
2018-12-04 15:29 Sandrahuguet Status new => scheduled
2018-12-05 13:20 Sandrahuguet Review Assigned To => alostale
2018-12-05 15:21 hgbot Checkin
2018-12-05 15:21 hgbot Note Added: 0108285
2018-12-05 15:21 hgbot Status scheduled => resolved
2018-12-05 15:21 hgbot Resolution open => fixed
2018-12-05 15:21 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/18fd96916ab517067b233cfba9f2f54c70ce3cde [^]
2018-12-05 17:23 hgbot Checkin
2018-12-05 17:23 hgbot Note Added: 0108298
2018-12-05 17:32 alostale Note Added: 0108300
2018-12-05 17:32 alostale Status resolved => closed
2018-12-05 17:32 alostale Fixed in Version => 3.0PR19Q1
2018-12-10 16:15 Sandrahuguet Note Added: 0108365
2018-12-10 16:15 Sandrahuguet Status closed => new
2018-12-10 16:15 Sandrahuguet Resolution fixed => open
2018-12-10 16:15 Sandrahuguet Fixed in Version 3.0PR19Q1 =>
2018-12-10 16:16 Sandrahuguet Note Added: 0108366
2018-12-11 08:12 hgbot Checkin
2018-12-11 08:12 hgbot Note Added: 0108379
2018-12-11 08:12 hgbot Status new => resolved
2018-12-11 08:12 hgbot Resolution open => fixed
2018-12-11 08:12 hgbot Fixed in SCM revision http://code.openbravo.com/erp/devel/pi/rev/18fd96916ab517067b233cfba9f2f54c70ce3cde [^] => http://code.openbravo.com/erp/devel/pi/rev/e893c16b5687c6bd83456b837b55c0e77a9c6b7f [^]
2018-12-11 13:29 alostale Note Added: 0108387
2018-12-11 13:29 alostale OS 30 =>
2018-12-11 13:29 alostale OS Version Openbravo Appliance 14.04 =>
2018-12-11 13:29 alostale Proposed Solution updated
2018-12-11 13:30 alostale Note Deleted: 0108387
2018-12-11 13:30 alostale OS 0 =>
2018-12-11 13:30 alostale Proposed Solution updated
2018-12-11 15:40 alostale Note Added: 0108398
2018-12-11 15:40 alostale Status resolved => closed
2018-12-11 15:40 alostale Fixed in Version => 3.0PR19Q1
2018-12-11 20:22 hudsonbot Checkin
2018-12-11 20:22 hudsonbot Note Added: 0108513
2018-12-11 20:22 hudsonbot Checkin
2018-12-11 20:22 hudsonbot Note Added: 0108515
2018-12-11 20:22 hudsonbot Checkin
2018-12-11 20:22 hudsonbot Note Added: 0108517
2018-12-13 12:12 hgbot Checkin
2018-12-13 12:12 hgbot Note Added: 0108579
2018-12-13 12:35 hgbot Checkin
2018-12-13 12:35 hgbot Note Added: 0108580
2018-12-14 11:44 hgbot Checkin
2018-12-14 11:44 hgbot Note Added: 0108607
2018-12-14 16:04 hudsonbot Checkin
2018-12-14 16:04 hudsonbot Note Added: 0108623
2018-12-14 16:04 hudsonbot Checkin
2018-12-14 16:04 hudsonbot Note Added: 0108624
2018-12-14 16:04 hudsonbot Checkin
2018-12-14 16:04 hudsonbot Note Added: 0108626
2018-12-17 14:38 hgbot Checkin
2018-12-17 14:38 hgbot Note Added: 0108643
2018-12-17 20:39 hudsonbot Checkin
2018-12-17 20:39 hudsonbot Note Added: 0108657


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker