Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0036902Openbravo ERPA. Platformpublic2017-09-20 14:062017-09-22 13:26
asiermartirena 
inigosanchez 
immediatemajorhave not tried
closedfixed 
5
 
3.0PR17Q4 
alostale
Core
Coding ( Testing )
2017-09-14
pi
https://code.openbravo.com/erp/devel/pi/rev/d936b7f0882f [^]
No
0036902: Update.database fails under some circumstances if a model change is defined
Update.database fails if a model change such as columnSizeChange is defined in a configScript (Not all model changes generates the reported problem.) and the data is bigger than old size (defined in core) but smaller than new size.

This problem has been found trying to update a BUT Instance with the new fixed issue of DBSM (0036137).
1.- Applied attached diff (columnSizeChange is done in description of AD_USER: 255 to 290) in pi
2.- Execute ant smartbuild -Dlocal=no -Dtr=no -> model change is applied properly.
3.- Update the value of description column for a user:
UPDATE ad_user SET description='{STRING_BIGGER_THAN_255_AND_SMALLER_THAN_290}' WHERE AD_USER_ID='167450A5BB284AB29C4FEF039E98C963';
4.- Execute ant smartbuild -Dlocal=no -Dtr=no again -> ERROR*

*The ERROR appears in the recreation of the table AD_USER, when it is tried to insert the data in the recreated table.
It should be apply the configScript files properly BEFORE the 'platform.alterTables(originaldb, db, !isFailonerror());' method is invoked in update.database task.
No tags attached.
caused by defect 0036137 closed inigosanchez [SER-QA 2918] Config script removeCheckChange are not applied on install.source 
diff issue36902.diff (626) 2017-09-20 16:56
https://issues.openbravo.com/file_download.php?file_id=11082&type=bug
Issue History
2017-09-20 14:06asiermartirenaNew Issue
2017-09-20 14:06asiermartirenaAssigned To => inigosanchez
2017-09-20 14:06asiermartirenaModules => Core
2017-09-20 14:06asiermartirenaResolution time => 1506463200
2017-09-20 14:06asiermartirenaRegression level => Coding ( Testing )
2017-09-20 14:06asiermartirenaRegression date => 2017-09-14
2017-09-20 14:06asiermartirenaRegression introduced in release => pi
2017-09-20 14:06asiermartirenaRegression introduced by commit => https://code.openbravo.com/erp/devel/pi/rev/d936b7f0882f [^]
2017-09-20 14:06asiermartirenaTriggers an Emergency Pack => No
2017-09-20 14:49inigosanchezStatusnew => acknowledged
2017-09-20 14:49inigosanchezStatusacknowledged => scheduled
2017-09-20 16:20inigosanchezSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=15949#r15949
2017-09-20 16:20inigosanchezProposed Solution updated
2017-09-20 16:28inigosanchezSummaryUpdate database process doesn't apply length changes from templates => Update.database fails under some circumstances if a model change is defined
2017-09-20 16:28inigosanchezDescription Updatedbug_revision_view_page.php?rev_id=15951#r15951
2017-09-20 16:28inigosanchezRelationship addedcaused by 0036137
2017-09-20 16:56inigosanchezFile Added: issue36902.diff
2017-09-21 15:08hgbotCheckin
2017-09-21 15:08hgbotNote Added: 0099214
2017-09-21 15:08hgbotStatusscheduled => resolved
2017-09-21 15:08hgbotResolutionopen => fixed
2017-09-21 15:08hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/dbsm-main/rev/e72db5668a01d3fcee179c1ba7f3b76100110ca8 [^]
2017-09-21 15:09hgbotCheckin
2017-09-21 15:09hgbotNote Added: 0099215
2017-09-21 15:10inigosanchezReview Assigned To => alostale
2017-09-21 15:13hgbotCheckin
2017-09-21 15:13hgbotNote Added: 0099216
2017-09-21 15:13hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/dbsm-main/rev/e72db5668a01d3fcee179c1ba7f3b76100110ca8 [^] => http://code.openbravo.com/erp/devel/pi/rev/0e8f0e82bcd976a9988b821ca5bbd54cc7236d45 [^]
2017-09-22 03:19hudsonbotCheckin
2017-09-22 03:19hudsonbotNote Added: 0099451
2017-09-22 10:12alostaleNote Added: 0099465
2017-09-22 10:12alostaleStatusresolved => new
2017-09-22 10:12alostaleResolutionfixed => open
2017-09-22 10:14alostalePriorityurgent => immediate
2017-09-22 12:23inigosanchezStatusnew => scheduled
2017-09-22 12:31hgbotCheckin
2017-09-22 12:31hgbotNote Added: 0099479
2017-09-22 13:26alostaleStatusscheduled => resolved
2017-09-22 13:26alostaleResolutionopen => fixed
2017-09-22 13:26alostaleNote Added: 0099484
2017-09-22 13:26alostaleStatusresolved => closed
2017-09-22 13:26alostaleFixed in Version => 3.0PR17Q4

Notes
(0099214)
hgbot   
2017-09-21 15:08   
Repository: erp/devel/dbsm-main
Changeset: e72db5668a01d3fcee179c1ba7f3b76100110ca8
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Wed Sep 20 17:09:41 2017 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/e72db5668a01d3fcee179c1ba7f3b76100110ca8 [^]

Fixed issue 36902: Update.database+configScript fails under some circumstances

The problem was that update.database task fails under some circumstances if a model change
is defined in a configScript file. The problem has been found trying to update the database
in an instance with a columnSizeChange defined in the configScript file.

The problem was introduced in these improvements of DBSM sources (0036137). Before these
changesets on update.database task, the ModelChanges had been applied before and after the
platform.alterTables method was invoked. After these improvements were introduced into the
distribution, the ModelChanges had only applied after the platform.alterTables method was
invoked. (Only once)

The problem has been resolved by take into account this situation. Now the model changes are
applied (Data changes too) before platform.alterTables method is invoked in order to ensures
that when any table is recreated, all the model changes are applied properly.

---
M src/org/openbravo/ddlutils/task/AlterDatabaseDataAll.java
---
(0099215)
hgbot   
2017-09-21 15:09   
Repository: erp/devel/dbsm-main
Changeset: e642cdd74ad2b1d11dbb0e9ea9c57b18e57ac8c3
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Thu Sep 21 14:48:24 2017 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/e642cdd74ad2b1d11dbb0e9ea9c57b18e57ac8c3 [^]

Related with issue 36902:Added test case and changes in the test infrastructure

On one hand it is added a test case for the reported regression. On the other hand several improvements in the test infrastructure have been done:
- now update.database of the test applys configScript files in the same moment as the update.database of the production.
- The final comparation in update.database task now it is realized as expected (model loaded from the db and model readed from the xml+configScript)
- Some methods have been moved to ConfigScriptBaseTest in order to avoid duplicated code.
- Now createDatabase method in DbsmTest applys configScript in the database (physically) too, not only in the model of the database.

---
M src-test/src/org/openbravo/dbsm/test/base/DbsmTest.java
M src-test/src/org/openbravo/dbsm/test/configscript/ConfigScriptBaseTest.java
M src-test/src/org/openbravo/dbsm/test/configscript/ConfigScriptColumnDataChange.java
M src-test/src/org/openbravo/dbsm/test/configscript/ConfigScriptColumnSizeChange.java
A src-test/data/configScriptsChangeSizeColumn/TEST.xml
---
(0099216)
hgbot   
2017-09-21 15:13   
Repository: erp/devel/pi
Changeset: 0e8f0e82bcd976a9988b821ca5bbd54cc7236d45
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Thu Sep 21 14:53:58 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/0e8f0e82bcd976a9988b821ca5bbd54cc7236d45 [^]

Fixed issue 36902: Update.database+configScript fails under some circumstances

The problem was that update.database task fails under some circumstances if a model change
is defined in a configScript file. The problem has been found trying to update the database
in an instance with a columnSizeChange defined in the configScript file.

The problem was introduced in these improvements of DBSM sources (0036137). Before these
changesets on update.database task, the ModelChanges had been applied before and after the
platform.alterTables method was invoked. After these improvements were introduced into the
distribution, the ModelChanges had only applied after the platform.alterTables method was
invoked. (Only once)

The problem has been resolved by take into account this situation. Now the model changes are
applied (Data changes too) before platform.alterTables method is invoked in order to ensures
that when any table is recreated, all the model changes are applied properly.

---
M src-db/database/lib/dbsourcemanager.jar
---
(0099451)
hudsonbot   
2017-09-22 03:19   
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/79f756868bba [^]
Maturity status: Test
(0099465)
alostale   
2017-09-22 10:12   
reopen: test fails after latest changes:

  org.openbravo.dbsm.test.model.recreation.PLCode.thereShouldNoBePLRecreationIfNotModified
(0099479)
hgbot   
2017-09-22 12:31   
Repository: erp/devel/dbsm-main
Changeset: 0feb46b0353da025e3675e426cbc4f6bd6320a5b
Author: Inigo Sanchez <inigo.sanchez <at> openbravo.com>
Date: Fri Sep 22 12:11:43 2017 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/0feb46b0353da025e3675e426cbc4f6bd6320a5b [^]

Related with the issue 36902: Revert a change added by mistake

The reverted change is in test infraestructure. Also removed a comment.

---
M src-test/src/org/openbravo/dbsm/test/base/DbsmTest.java
---
(0099484)
alostale   
2017-09-22 13:26   
reviewed + tested