Unable to upgrade from version 1.6.6 to version 2.8.0
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Symptoms
The following errors are logged while attempting to upgrade the database:
1
2
3
Error creating bean with name 'dbControlFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.cenqua.crucible.hibernate.DBControlFactoryImpl]: Constructor threw exception; nested exception is com.cenqua.crucible.hibernate.CruDBException: Problem upgrading with script /opt/fecru-upgrade/fecru-2.8.0/sql/HSQL/upgrade/upgrade_30.sql: SQL script error on line 290: "alter table cru_frx add constraint FK3E2EDB53D70B78C3 foreign key (cru_file_revision) references cru_revision;"
(Integrity constraint violation - no parent 74068, table: CRU_FRX in statement [alter table cru_frx add constraint FK3E2EDB53D70B78C3 foreign key (cru_file_revision) references cru_revision])
[……]
Cause
The upgrade is failing because of an "Integrity constraint violation" of type FK3E2EDB53D70B78C3 for the table cru_frx:
1
2
3
4
5
Caused by: java.sql.SQLException: Integrity constraint violation - no parent 74068, table: CRU_FRX in statement [alter table cru_frx add constraint FK3E2EDB53D70B78C3 foreign key (cru_file_revision) references cru_revision]
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
at org.hsqldb.jdbc.jdbcStatement.executeUpdate(Unknown Source)
at com.cenqua.crucible.hibernate.DefaultDBControl.executeScript(DefaultDBControl.java:455)
Workaround
1. Make a backup of the Fisheye/Crucible 1.6.6 instance (7. Backing Up and Restoring Config Data)
2. Install a clean Fisheye/Crucible 2.8.0 on your test server but DO NOT yet start the application.
3. Define a FISHEYE_INST
environment variable and point it to an empty directory.
4. Unzip the 1.6.6 backup Zip file in FISHEYE_INST
.
5. Copy and save the following as 'patchgeneric.sql'.
patchgeneric.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
delete from COMMENT_FIELD where COMMENT_ID not in (select COMMENT_ID from COMMENT);
delete from REVISION where uploadItem not in (select UPLOAD_ID from UPLOAD)
delete from FR_EXTRA where fileRevision not in (Select REVISION_ID from REVISION);
delete from FR_EXTRA where fromRevision not in (Select REVISION_ID from REVISION);
delete from COMPLETED_FRX where PARTICIPANT_ID not in (select PARTICIPANT_ID from REVIEW_PARTICIPANT);
delete from COMPLETED_FRX where FRX_ID not in (select FRX_ID from FR_EXTRA);
delete from FEINDEX_MSG where FR_ID not in (Select REVISION_ID from REVISION);
delete from FR_DETAIL where id not in (Select REVISION_ID from REVISION);
delete from PATCH_REVISION where PATCH_ID not in (select PATCH_ID from PATCH);
delete from PATCH_REVISION where REVISION_ID not in (select REVISION_ID from REVISION);
delete from RECIPIENT where NOTIFICATION_ID not in (Select NOTIFICATION_ID from NOTIFICATION);
delete from REPLY where COMMENT_ID not in (select COMMENT_ID from COMMENT);
delete from REVIEW_COMMENT where COMMENT_ID not in (select COMMENT_ID from COMMENT);
delete from REVISION_COMMENT where COMMENT not in (select COMMENT_ID from COMMENT);
delete from REVISION_COMMENT where revision not in (Select REVISION_ID from REVISION);
delete from REVISION_COMMENT where FRX_ID not in (select FRX_ID from FR_EXTRA);
delete from Comment where review_id not in (select review_ID from review);
delete from FR_EXTRA where REVIEW_ID not in (select review_ID from review);
delete from INVITEES where REVIEW_ID not in (select review_ID from review);
delete from NOTIFICATION where REVIEW not in (select review_ID from review);
delete from PATCH where REVIEW not in (select review_ID from review);
delete from REVIEW where PARENTREVIEW not in (select review_ID from review);
delete from review where project not in (select project_id from cruproject);
delete from REVIEW_COMMENT where REVIEW_ID not in (select review_ID from review);
delete from REVIEW_FIELD where REVIEW_ID not in (select review_ID from review);
delete from REVIEW_PARTICIPANT where REVIEW_ID not in (select review_ID from review);
delete from REVPERMAID where REVIEW_ID not in (select review_ID from review);
commit;
6. From the directory containing the 'patchgeneric.sql' file, run the following from the command-line taking care to change the paths accordingly:
1
java -Xmx2048m -jar <FishEye home directory>/lib/hsqldb-1.8.0.10.jar --inlineRC "URL=jdbc:hsqldb:file:<FISHEYE_INST>/var/data/crudb/crucible;shutdown=true,USER=sa,PASSWORD=" patchgeneric.sql
7. Start the application.
Related
patchgeneric.sql Fails to Help Upgrading Fisheye from Version 1.6.6 to Version 2.8.0
Was this helpful?