Bug 600284

Summary: After upgrade JON2.3.1 to JON2.4Beta0 during SYNCHRONIZE 'JBoss Patch Channel' gets exception in server log - ERROR: integer out of range
Product: [Other] RHQ Project Reporter: Rajan Timaniya <rtimaniy>
Component: ContentAssignee: John Mazzitelli <mazz>
Status: CLOSED CURRENTRELEASE QA Contact: Rajan Timaniya <rtimaniy>
Severity: medium Docs Contact:
Priority: urgent    
Version: 3.0.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-08-12 16:52:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 565628, 591531    
Attachments:
Description Flags
server log none

Description Rajan Timaniya 2010-06-04 10:51:36 UTC
Created attachment 421197 [details]
server log

Description of problem:
After upgrade JON2.3.1 to JON2.4Beta0 during SYNCHRONIZE 'JBoss Patch Channel' gets exception in server log ERROR: integer out of range

2010-06-04 15:02:03,301 INFO  [org.rhq.enterprise.server.plugin.pc.content.ContentServerPluginContainer] Scheduled repo sync job [32d4a362:syncRepoImmediate] to fire now at [Fri Jun 04 15:02:03 IST 2010] for [Repo: id=[101], name=[JBoss Patch Channel]].
2010-06-04 15:02:03,439 WARN  [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: 22003
2010-06-04 15:02:03,440 ERROR [org.hibernate.util.JDBCExceptionReporter] Batch entry 0 insert into RHQ_REPO_SYNC (REPO_ID, STATUS, START_TIME, END_TIME, RESULTS, PERCENT_COMPLETE, ID) values ('101', 'INPROGRESS', '1275643923400', NULL, 'Fri Jun 04 15:02:03 IST 2010: Start synchronization of Repository [JBoss Patch Channel]
Fri Jun 04 15:02:03 IST 2010: Getting currently known list of content source packages...
', NULL, '10001') was aborted.  Call getNextException to see the cause.
2010-06-04 15:02:03,440 WARN  [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: 22003
2010-06-04 15:02:03,440 ERROR [org.hibernate.util.JDBCExceptionReporter] ERROR: integer out of range
2010-06-04 15:02:03,440 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.exception.DataException: Could not execute JDBC batch update
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:77)


Version-Release number of selected component (if applicable):
JON 2.4.0.Beta0  (http://jon01.qa.atl2.redhat.com:8042/dist/qa/2.4.0/)

Steps to Reproduce:
1) Install JON2.3.1 with Postgres 8.3 and agent
2) Log-in to JON
3) Go to Administration > Content > Content Sources
4) Click on 'JBoss CSP Patch Feed' link
5) Provide appropriate details (username, password, active=yes) for 'CSP Feed Settings' and save it
6) Click on 'SYNCHRONIZE'
7) Verify that there are packages (JBossAS and JBossEAP) listed under 'Packages' section
8) Stop/Down JON2.3.1 server (keep agent running)
9) Upgrade JON2.3.1 to JON2.4Beta0 (with same database - Postgres 8.3)
10) Log-in to JON2.4Beta0
11) Administration -> Content -> Content Sources
12) click on 'JBoss Patch Content Source' link
13) click on 'JBoss Patch Channel' link
14) Verify that there are packages (JBossAS and JBossEAP) listed under 'Packages' section
15) Click on 'SYNCHRONIZE' button
16) Please refer server log
  
Actual results:
After upgrade JON2.3.1 to JON2.4Beta0 during SYNCHRONIZE 'JBoss Patch Channel' gets exception in server log - ERROR: integer out of range

Expected results:
After upgrade JON2.3.1 to JON2.4Beta0 SYNCHRONIZE 'JBoss Patch Channel' should work without error/exception.

Additional info:
Please refer attached server log.

Comment 1 Rajan Timaniya 2010-06-04 10:54:37 UTC
Test environment:
OS - RHEL 5.4
JDK - SUN JDK 1.6.0_18-ea
Database - Postgres 8.3

Comment 2 John Mazzitelli 2010-06-04 16:00:28 UTC
db-upgrade.xml is incorrect - its setting the db column type of INTEGER where it should be using LONG:

@@ -2288,31 +2288,31 @@
             <schemaSpec version="2.72">
                 <schema-createSequence name="RHQ_REPO_SYNC_ID_SEQ" initial="10001" />
                 <schema-directSQL>
                     <statement>
                         CREATE TABLE RHQ_REPO_SYNC ( ID INTEGER PRIMARY KEY )
                     </statement>
                 </schema-directSQL>
                 <schema-alterColumn table="RHQ_REPO_SYNC" column="ID" nullable="false" />
                 <schema-addColumn table="RHQ_REPO_SYNC" column="STATUS" precision="16" columnType="VARCHAR2" />
                 <schema-alterColumn table="RHQ_REPO_SYNC" column="STATUS" nullable="false" />
-                <schema-addColumn table="RHQ_REPO_SYNC" column="START_TIME" columnType="INTEGER" />
+                <schema-addColumn table="RHQ_REPO_SYNC" column="START_TIME" columnType="LONG" />
                 <schema-alterColumn table="RHQ_REPO_SYNC" column="START_TIME" nullable="false" />
-                <schema-addColumn table="RHQ_REPO_SYNC" column="END_TIME" columnType="INTEGER" />
+                <schema-addColumn table="RHQ_REPO_SYNC" column="END_TIME" columnType="LONG" />
                 <schema-addColumn table="RHQ_REPO_SYNC" column="RESULTS" columnType="LONGVARCHAR" />
                 <schema-addColumn table="RHQ_REPO_SYNC" column="PERCENT_COMPLETE" columnType="LONG" />
                 <schema-addColumn table="RHQ_REPO_SYNC" column="REPO_ID" columnType="INTEGER" />
                 <schema-alterColumn table="RHQ_REPO_SYNC" column="REPO_ID" nullable="false" />
                 <schema-directSQL>
                     <statement desc="Creating RHQ_REPO_SYNC foreign key relation to RHQ_REPO for scheduled jobs">
                         ALTER TABLE RHQ_REPO_SYNC
-                        ADD CONSTRAINT RHQ_RS_REPO_ID_FKEY
+                        ADD CONSTRAINT RHQ_REPO_SYNC_REPO_ID_FKEY
                         FOREIGN KEY (REPO_ID)
                         REFERENCES RHQ_REPO (ID)
                     </statement>
                 </schema-directSQL>
             </schemaSpec>
 
             <schemaSpec version="2.75">
                 <schema-addColumn table="RHQ_REPO" column="SYNC_SCHEDULE" columnType="VARCHAR2" precision="64" />
             </schemaSpec>

Comment 3 John Mazzitelli 2010-06-04 16:06:34 UTC
rajan - this was a very good find. keep up the good work.

git commit to fix db-upgrade.xml: 39bd63d1e9890393953225d5bd75bc58a5359c50

Comment 4 Rajan Timaniya 2010-06-07 12:26:11 UTC
Tested on JON2.4 Beta1 with Oracle 10g

Steps
1) Install JON2.3.1 with Oracle 10g and agent
2) Log-in to JON
3) Go to Administration > Content > Content Sources
4) Click on 'JBoss CSP Patch Feed' link
5) Provide appropriate details (username, password, active=yes) for 'CSP Feed
Settings' and save it
6) Click on 'SYNCHRONIZE'
7) Verify that there are packages (JBossAS and JBossEAP) listed under
'Packages' section
8) Stop/Down JON2.3.1 server (keep agent running)
9) Upgrade JON2.3.1 to JON2.4Beta0 (with same database - Oracle 10g)
10) Log-in to JON2.4Beta0
11) Administration -> Content -> Content Sources
12) click on 'JBoss Patch Content Source' link
13) click on 'JBoss Patch Channel' link
14) Verify that there are packages (JBossAS and JBossEAP) listed under
'Packages' section
15) Click on 'SYNCHRONIZE' button
16) Please refer server log

After upgrade JON2.3.1 to JON2.4Beta0 SYNCHRONIZE 'JBoss Patch Channel' works fine without error/exception.

I will test this bug with Postgres database.

Comment 5 Rajan Timaniya 2010-06-08 10:49:28 UTC
Verified on JON 2.4Beta1 with Postgres 8.3/8.4

Steps
1) Install JON2.3.1 with Postgres 8.3/8.4 and agent
2) Log-in to JON
3) Go to Administration > Content > Content Sources
4) Click on 'JBoss CSP Patch Feed' link
5) Provide appropriate details (username, password, active=yes) for 'CSP Feed
Settings' and save it
6) Click on 'SYNCHRONIZE'
7) Verify that there are packages (JBossAS and JBossEAP) listed under
'Packages' section
8) Stop/Down JON2.3.1 server (keep agent running)
9) Upgrade JON2.3.1 to JON2.4Beta1 (with same database - Postgres 8.3/8.4)
10) Log-in to JON2.4Beta1
11) Administration -> Content -> Content Sources
12) click on 'JBoss Patch Content Source' link
13) click on 'JBoss Patch Channel' link
14) Verify that there are packages (JBossAS and JBossEAP) listed under
'Packages' section
15) Click on 'SYNCHRONIZE' button
16) Please refer server log

After upgrade JON2.3.1 to JON2.4Beta1 SYNCHRONIZE 'JBoss Patch Channel' works
fine without error/exception.

Comment 6 Corey Welton 2010-08-12 16:52:05 UTC
Mass-closure of verified bugs against JON.