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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0042908
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] Y. DBSourceManagermajoralways2020-01-16 14:012020-01-24 15:03
ReportergorkaionView Statuspublic 
Assigned Toalostale 
PriorityurgentResolutionfixedFixed in Version3.0PR20Q2
StatusclosedFix in branchFixed in SCM revision7a3ad07f56f1
ProjectionnoneETAnoneTarget Version
OSAnyDatabasePostgreSQLJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0042908: update/export database fails with sequences having a big start

DescriptionAfter upgrade to PG10 the update.database fails with the following error in case of having a stored sequence with a value bigger than max int value.

update.database.java:
     [java] 0 INFO - Database connection: XXXX User: XXXX. System User: XXXX
     [java] 1137 INFO - Executing full update.database
     [java] 1193 INFO - Max threads 2
     [java] 1607 INFO - Loading model from database...
     [java] 1672 INFO - Reading tables...
     [java] 15158 INFO - Reading views...
     [java] 15363 INFO - Reading sequences...
     [java] 15427 ERROR - Bad value for type int : 600,000,027,058
     [java] org.postgresql.util.PSQLException: Bad value for type int : 600,000,027,058
     [java] at org.postgresql.jdbc.PgResultSet.readLongValue(PgResultSet.java:3057)
     [java] at org.postgresql.jdbc.PgResultSet.getInt(PgResultSet.java:2057)
     [java] at org.apache.commons.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.java:225)
     [java] at org.apache.commons.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.java:225)
     [java] at org.apache.ddlutils.platform.postgresql.PostgreSql10ModelLoader$1$1.getRow(PostgreSql10ModelLoader.java:48)
     [java] at org.apache.ddlutils.platform.ModelLoaderBase.readList(ModelLoaderBase.java:833)
     [java] at org.apache.ddlutils.platform.postgresql.PostgreSql10ModelLoader.access$200(PostgreSql10ModelLoader.java:28)
     [java] at org.apache.ddlutils.platform.postgresql.PostgreSql10ModelLoader$1.getRow(PostgreSql10ModelLoader.java:45)
     [java] at org.apache.ddlutils.platform.ModelLoaderBase.readList(ModelLoaderBase.java:833)
     [java] at org.apache.ddlutils.platform.postgresql.PostgreSql10ModelLoader.readSequences(PostgreSql10ModelLoader.java:33)
     [java] at org.apache.ddlutils.platform.ModelLoaderBase.readDatabase(ModelLoaderBase.java:218)
     [java] at org.apache.ddlutils.platform.postgresql.PostgreSqlModelLoader.readDatabase(PostgreSqlModelLoader.java:89)
     [java] at org.apache.ddlutils.platform.ModelLoaderBase.getDatabase(ModelLoaderBase.java:131)
     [java] at org.apache.ddlutils.platform.PlatformImplBase.loadModelFromDatabase(PlatformImplBase.java:2210)
     [java] at org.openbravo.ddlutils.process.DBUpdater.update(DBUpdater.java:86)
     [java] at org.openbravo.ddlutils.task.AlterDatabaseDataAll.doExecute(AlterDatabaseDataAll.java:69)
     [java] at org.openbravo.ddlutils.task.BaseDatabaseTask.execute(BaseDatabaseTask.java:88)
     [java] at org.openbravo.ddlutils.task.AlterDatabaseJava.main(AlterDatabaseJava.java:81)
     [java] org.apache.ddlutils.DatabaseOperationException: org.postgresql.util.PSQLException: Bad value for type int : 600,000,027,058
     [java] at org.apache.ddlutils.platform.PlatformImplBase.loadModelFromDatabase(PlatformImplBase.java:2212)
     [java] at org.openbravo.ddlutils.process.DBUpdater.update(DBUpdater.java:86)
     [java] at org.openbravo.ddlutils.task.AlterDatabaseDataAll.doExecute(AlterDatabaseDataAll.java:69)
     [java] at org.openbravo.ddlutils.task.BaseDatabaseTask.execute(BaseDatabaseTask.java:88)
     [java] at org.openbravo.ddlutils.task.AlterDatabaseJava.main(AlterDatabaseJava.java:81)
     [java] Caused by: org.postgresql.util.PSQLException: Bad value for type int : 600,000,027,058
     [java] at org.postgresql.jdbc.PgResultSet.readLongValue(PgResultSet.java:3057)
     [java] at org.postgresql.jdbc.PgResultSet.getInt(PgResultSet.java:2057)
     [java] at org.apache.commons.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.java:225)
     [java] at org.apache.commons.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.java:225)
     [java] at org.apache.ddlutils.platform.postgresql.PostgreSql10ModelLoader$1$1.getRow(PostgreSql10ModelLoader.java:48)
     [java] at org.apache.ddlutils.platform.ModelLoaderBase.readList(ModelLoaderBase.java:833)
     [java] at org.apache.ddlutils.platform.postgresql.PostgreSql10ModelLoader.access$200(PostgreSql10ModelLoader.java:28)
     [java] at org.apache.ddlutils.platform.postgresql.PostgreSql10ModelLoader$1.getRow(PostgreSql10ModelLoader.java:45)
     [java] at org.apache.ddlutils.platform.ModelLoaderBase.readList(ModelLoaderBase.java:833)
     [java] at org.apache.ddlutils.platform.postgresql.PostgreSql10ModelLoader.readSequences(PostgreSql10ModelLoader.java:33)
     [java] at org.apache.ddlutils.platform.ModelLoaderBase.readDatabase(ModelLoaderBase.java:218)
     [java] at org.apache.ddlutils.platform.postgresql.PostgreSqlModelLoader.readDatabase(PostgreSqlModelLoader.java:89)
     [java] at org.apache.ddlutils.platform.ModelLoaderBase.getDatabase(ModelLoaderBase.java:131)
     [java] at org.apache.ddlutils.platform.PlatformImplBase.loadModelFromDatabase(PlatformImplBase.java:2210)
     [java] ... 4 more
Steps To ReproduceAdd a sequence with a very big value
Try to execute a update.database using PG10.
Proposed SolutionPostgreSql10ModelLoader is executing getInt(). It should be modified to support bigint data type.
              sequence.setStart(seqDetails.getInt(1));
              sequence.setIncrement(seqDetails.getInt(2));

Those sequences are loaded from pg_sequence relation. In pg10 the datatype of the sequence is bigint instead of int.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0116941)
alostale (developer)
2020-01-16 16:33

MR: https://gitlab.com/openbravo/product/dbsm/merge_requests/4 [^]
(0116977)
hgbot (developer)
2020-01-17 09:44

Repository: erp/devel/pi
Changeset: a047a5e9154c5901b9da99c2f51f9b0726acee0e
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Jan 17 09:41:52 2020 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/a047a5e9154c5901b9da99c2f51f9b0726acee0e [^]

fixed BUG-42908: sequences with a big start value fail

  Sequences with a start value bigger than max integer value(2147483647)
  were not supported throwing exception when updating database.

  Internally dbsm used int variables to store this value. It has now
  been changed to long as it is the type PostgreSQL returns from queries
  to pg_sequence.

---
A dbsourcemanager.jar
---
(0116985)
hgbot (developer)
2020-01-17 09:56

Repository: erp/devel/pi
Changeset: 67b17b8a537ce7e2c80c116265a4184e1f681b79
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Jan 17 09:55:45 2020 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/67b17b8a537ce7e2c80c116265a4184e1f681b79 [^]

fixed BUG-42908: sequences with a big start value fail

  Moved dbsourcemanager.jar to its proper location

---
M src-db/database/lib/dbsourcemanager.jar
R dbsourcemanager.jar
---
(0116986)
alostale (developer)
2020-01-17 09:57

dbsm commit: https://gitlab.com/openbravo/product/dbsm/commit/e1a7b4d625f2105cf42084d43a1a16707ffc6cc3 [^]
(0116988)
hgbot (developer)
2020-01-17 10:22

Repository: erp/devel/pi
Changeset: 7a3ad07f56f165bcc236c84f0dd502f0488548da
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Fri Jan 17 10:22:21 2020 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/7a3ad07f56f165bcc236c84f0dd502f0488548da [^]

fixed BUG-42908: sequences with a big start value fail

  Fixed dbsourcemanager.jar. It got corrupted due to an incremental
  compilation not detecting byte code API change (int to long) in
  Sequnce.getStart method causing its users not to be re-generated.

  New jar version is compiled after a cleanup.

---
M src-db/database/lib/dbsourcemanager.jar
---
(0117237)
caristu (developer)
2020-01-24 15:03

Reviewed + tested

- Issue History
Date Modified Username Field Change
2020-01-16 14:01 gorkaion New Issue
2020-01-16 14:01 gorkaion Assigned To => platform
2020-01-16 14:01 gorkaion Modules => Core
2020-01-16 14:01 gorkaion Triggers an Emergency Pack => No
2020-01-16 16:32 alostale Status new => scheduled
2020-01-16 16:32 alostale Assigned To platform => alostale
2020-01-16 16:32 alostale Review Assigned To => caristu
2020-01-16 16:33 alostale Note Added: 0116941
2020-01-17 09:40 alostale Summary update database fails with PG10 in case of having big stored sequences => update/export database fails with sequences having a big start
2020-01-17 09:44 hgbot Checkin
2020-01-17 09:44 hgbot Note Added: 0116977
2020-01-17 09:44 hgbot Status scheduled => resolved
2020-01-17 09:44 hgbot Resolution open => fixed
2020-01-17 09:44 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/a047a5e9154c5901b9da99c2f51f9b0726acee0e [^]
2020-01-17 09:56 hgbot Checkin
2020-01-17 09:56 hgbot Note Added: 0116985
2020-01-17 09:56 hgbot Fixed in SCM revision http://code.openbravo.com/erp/devel/pi/rev/a047a5e9154c5901b9da99c2f51f9b0726acee0e [^] => http://code.openbravo.com/erp/devel/pi/rev/67b17b8a537ce7e2c80c116265a4184e1f681b79 [^]
2020-01-17 09:57 alostale Note Added: 0116986
2020-01-17 10:22 hgbot Checkin
2020-01-17 10:22 hgbot Note Added: 0116988
2020-01-17 10:22 hgbot Fixed in SCM revision http://code.openbravo.com/erp/devel/pi/rev/67b17b8a537ce7e2c80c116265a4184e1f681b79 [^] => http://code.openbravo.com/erp/devel/pi/rev/7a3ad07f56f165bcc236c84f0dd502f0488548da [^]
2020-01-24 15:03 caristu Note Added: 0117237
2020-01-24 15:03 caristu Status resolved => closed
2020-01-24 15:03 caristu Fixed in Version => 3.0PR20Q2


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker