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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0036984
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] Y. DBSourceManagerminorhave not tried2017-10-02 13:512018-01-03 12:38
ReporterinigosanchezView Statuspublic 
Assigned Toalostale 
PriorityimmediateResolutionfixedFixed in Version
StatusclosedFix in branchFixed in SCM revisionca7b91c647e0
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned ToAugustoMauch
Web browser
ModulesCore
Regression levelCoding ( Testing )
Regression date2017-09-25
Regression introduced in releasepi
Regression introduced by commithttps://code.openbravo.com/erp/devel/dbsm-main/rev/d0d4150b7e96 [^]
Triggers an Emergency PackNo
Summary

0036984: Upgrading from 2.50 to pi some unique constraints are violated

DescriptionWhen upgrading from 2.50 to pi, some unique constraints are violating in the new database. See the log of the job[1] that raises the reported problem.

This occurs because an old window (2.5 window: Cost Center) has changes in its ID and a unique constraint depends on this change (unique constraint of ad_window: client_id, name, module_id). When alter the data in update.database task having this scenario, the order the data are loaded into the database are:
- insert: Cost Center - 79FC23AB84F04384B4B7CCCADCDD2942 -> ERROR BECAUSE (client, name, module) is in the database from 2.5
- update: Cost Center - 800030 to Manufacturing Cost Center - 800030 -> Is not executed for the error on insert

Before the changeset that introduces the regression, all the data changes were handled individually and under some lucky circumstances, all the data was updated properly.



[1].- https://ci.openbravo.com/job/up-2.50topi-pgsql/206/consoleText [^]
Steps To ReproduceFollowing the steps in the job[1]:
1.- hg clone a fresh pi
2.- hg up 2.50MP24
3.- ant install.source
4.- Execute the following query into the db: DELETE FROM C_BP_CUSTOMER_ACCT WHERE C_BP_CUSTOMER_ACCT_id IN ('1000020', '1000019', '1000024', '1000022', '1000021');
5.- hg update tip
6.- ant smartbuild -Dlocal=no

The following ERROR is raised:
[java] 75270 INFO - Updating Application Dictionary data...
     [java] org.apache.ddlutils.DatabaseOperationException: Error while inserting into the database: ERROR: duplicate key value violates unique constraint "ad_window_name"
     [java] Detail: Key (ad_client_id, name, ad_module_id)=(0, Cost Center, 0) already exists.
     [java] at org.apache.ddlutils.platform.PlatformImplBase.insert(PlatformImplBase.java:1724)
     [java] at org.apache.ddlutils.platform.PlatformImplBase.upsert(PlatformImplBase.java:1618)
     [java] at org.apache.ddlutils.platform.PlatformImplBase.alterData(PlatformImplBase.java:851)
     [java] at org.openbravo.ddlutils.task.AlterDatabaseDataAll.doExecute(AlterDatabaseDataAll.java:228)
     [java] at org.openbravo.ddlutils.task.BaseDatabaseTask.execute(BaseDatabaseTask.java:86)
     [java] at org.openbravo.ddlutils.task.AlterDatabaseJava.main(AlterDatabaseJava.java:57)
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
depends on backport 00369903.0PR17Q4 closedplatform Upgrading from 2.50 to pi some unique constraints are violated 
caused by defect 0035653 closedalostale update.database can fail updating src tables with a check constraint where more than one column participates 

-  Notes
(0099706)
hgbot (developer)
2017-10-03 08:09

Repository: erp/devel/pi
Changeset: 9e6fb4d1a5a522b79b23d5037832a3f78c62c536
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Oct 03 07:52:31 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/9e6fb4d1a5a522b79b23d5037832a3f78c62c536 [^]

fixed bug 36984: 2.50->pi upgrade fails

  If failed becuse of the order source data rows are inserted/deleted/updated.

  Before 35653 was fixed, rows were sorted by their ID and insertions deltions
  and updates were performed in that order. Afterwars, rows were sorted in the
  same way, but insertions and deletions were performed before updates.

  This casues that, in some weird cases, constraints to be broken while updating
  making the process to fail.

  Now it has been fixed by restoring previous order, so that updates are not
  postponed anymore.

---
M src-db/database/lib/dbsourcemanager.jar
---
(0099707)
hgbot (developer)
2017-10-03 08:14

Repository: erp/devel/dbsm-main
Changeset: 3a727b10ea614c008910c737983459d4996254cb
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Oct 03 07:38:23 2017 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/3a727b10ea614c008910c737983459d4996254cb [^]

related to bug 36984, related to bug 36938: added test case

  for 36984, disabled due to 36938

---
M src-test/src/org/openbravo/dbsm/test/sourcedata/SourcedataUpdates.java
A src-test/data/datachanges1/v1/TEST.xml
A src-test/data/datachanges1/v2/TEST.xml
A src-test/model/constraints/SIMPLE_UNIQUE.xml
---
(0099709)
hgbot (developer)
2017-10-03 08:14

Repository: erp/devel/dbsm-main
Changeset: 896deca36098298ba5d5ee707fbf8c5dc76f9d16
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Oct 03 07:45:08 2017 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/896deca36098298ba5d5ee707fbf8c5dc76f9d16 [^]

fixed bug 36984: 2.50->pi upgrade fails

  If failed becuse of the order source data rows are inserted/deleted/updated.

  Before 35653 was fixed, rows were sorted by their ID and insertions deltions
  and updates were performed in that order. Afterwars, rows were sorted in the
  same way, but insertions and deletions were performed before updates.

  This casues that, in some weird cases, constraints to be broken while updating
  making the process to fail.

  Now it has been fixed by restoring previous order, so that updates are not
  postponed anymore.

---
M src/org/apache/ddlutils/platform/PlatformImplBase.java
---
(0099710)
hgbot (developer)
2017-10-03 08:14

Repository: erp/devel/pi
Changeset: ca7b91c647e0ae3e6f15d4d153127dccaa781d8f
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Oct 03 07:57:51 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/ca7b91c647e0ae3e6f15d4d153127dccaa781d8f [^]

fixed bug 36984: 2.50->pi upgrade fails

  Fixed jar which was generated from an incorrect version

---
M src-db/database/lib/dbsourcemanager.jar
---
(0099724)
hgbot (developer)
2017-10-03 14:09

Repository: erp/devel/dbsm-main
Changeset: 0a082650b68deb2338c2212d4d0e5455bd2ae7d3
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Oct 03 09:03:30 2017 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/0a082650b68deb2338c2212d4d0e5455bd2ae7d3 [^]

related to bug 36984, related to bug 36938: enabled test case

---
M src-test/src/org/openbravo/dbsm/test/sourcedata/SourcedataUpdates.java
---
(0099763)
AugustoMauch (developer)
2017-10-04 15:00

Code reviewed and verified
(0101305)
hudsonbot (developer)
2018-01-03 12:38

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/c81e0d3cbab5 [^]
Maturity status: Test
(0101306)
hudsonbot (developer)
2018-01-03 12:38

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/c81e0d3cbab5 [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2017-10-02 13:51 inigosanchez New Issue
2017-10-02 13:51 inigosanchez Assigned To => platform
2017-10-02 13:51 inigosanchez Modules => Core
2017-10-02 13:51 inigosanchez Regression level => Coding ( Testing )
2017-10-02 13:51 inigosanchez Regression date => 2017-09-25
2017-10-02 13:51 inigosanchez Regression introduced in release => pi
2017-10-02 13:51 inigosanchez Regression introduced by commit => https://code.openbravo.com/erp/devel/dbsm-main/rev/d0d4150b7e96 [^]
2017-10-02 13:51 inigosanchez Triggers an Emergency Pack => No
2017-10-02 13:52 inigosanchez Relationship added caused by 0035653
2017-10-02 14:11 inigosanchez Description Updated View Revisions
2017-10-02 14:11 inigosanchez Steps to Reproduce Updated View Revisions
2017-10-03 07:50 alostale Status new => scheduled
2017-10-03 07:50 alostale Assigned To platform => alostale
2017-10-03 07:50 alostale Target Version 3.0PR17Q4 =>
2017-10-03 08:09 hgbot Checkin
2017-10-03 08:09 hgbot Note Added: 0099706
2017-10-03 08:09 hgbot Status scheduled => resolved
2017-10-03 08:09 hgbot Resolution open => fixed
2017-10-03 08:09 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/9e6fb4d1a5a522b79b23d5037832a3f78c62c536 [^]
2017-10-03 08:14 hgbot Checkin
2017-10-03 08:14 hgbot Note Added: 0099707
2017-10-03 08:14 hgbot Checkin
2017-10-03 08:14 hgbot Note Added: 0099709
2017-10-03 08:14 hgbot Fixed in SCM revision http://code.openbravo.com/erp/devel/pi/rev/9e6fb4d1a5a522b79b23d5037832a3f78c62c536 [^] => http://code.openbravo.com/erp/devel/dbsm-main/rev/896deca36098298ba5d5ee707fbf8c5dc76f9d16 [^]
2017-10-03 08:14 hgbot Checkin
2017-10-03 08:14 hgbot Note Added: 0099710
2017-10-03 08:14 hgbot Fixed in SCM revision http://code.openbravo.com/erp/devel/dbsm-main/rev/896deca36098298ba5d5ee707fbf8c5dc76f9d16 [^] => http://code.openbravo.com/erp/devel/pi/rev/ca7b91c647e0ae3e6f15d4d153127dccaa781d8f [^]
2017-10-03 08:57 alostale Review Assigned To => AugustoMauch
2017-10-03 14:09 hgbot Checkin
2017-10-03 14:09 hgbot Note Added: 0099724
2017-10-04 15:00 AugustoMauch Note Added: 0099763
2017-10-04 15:00 AugustoMauch Status resolved => closed
2017-10-04 15:00 AugustoMauch Fixed in Version => 3.0PR17Q4
2017-10-04 15:03 AugustoMauch Fixed in Version 3.0PR17Q4 =>
2018-01-03 12:38 hudsonbot Checkin
2018-01-03 12:38 hudsonbot Note Added: 0101305
2018-01-03 12:38 hudsonbot Checkin
2018-01-03 12:38 hudsonbot Note Added: 0101306


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker