Upgrading to Confluence 5.9.x or higher version fails with error 'failed during the SCHEMA_UPGRADE phase due to: null'
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
Summary
Problem
Upgrading to Confluence to 5.9.x and above fails with the following error message:
1
2
3
INFO [localhost-startStop-1] [confluence.upgrade.upgradetask.DropSpaceGroupTablesUpgradeTask] doUpgrade Starting dropping unused column SPACES.SPACEGROUPID, table SPACEGROUPPERMISSIONS, and table SPACEGROUPS
ERROR [localhost-startStop-1] [atlassian.confluence.plugin.PluginFrameworkContextListener] launchUpgrades Upgrade failed, application will not start: Upgrade task com.atlassian.confluence.upgrade.upgradetask.DropSpaceGroupTablesUpgradeTask@535b5afa failed during the SCHEMA_UPGRADE phase due to: null
com.atlassian.confluence.upgrade.UpgradeException: Upgrade task com.atlassian.confluence.upgrade.upgradetask.DropSpaceGroupTablesUpgradeTask@535b5afa failed during the SCHEMA_UPGRADE phase due to: null
This is also documented in this bug report: CONFSERVER-43759 - Upgrade fail when FK9228242D16994414 is missing from the spaces table
Diagnosis
Take the following steps to confirm if you are being affected by this issue:
While on Confluence 5.8.x or older, run this SQL query in MySQL to show the structure for the SPACES table:
1
show create table spaces;
If FK9228242D16994414 is not present in the table constraints, you are affected by this issue.
Cause
There is a missing foreign key constraint in the table SPACES
that refers to the SPACEGROUPS
table. Confluence 5.9.x no longer includes the table SPACEGROUPS
, which should be dropped, but when the upgrade task that performs this is run, it fails due to the missing foreign key constraint.
This upgrade task contains a specific list of activities to perform in sequence:
drop the foreign key SPACEGROUPID from SPACES
drop the index s_spacegroupid_idx from SPACES
drop the column SPACES.SPACEGROUPID
drop the table SPACEGROUPPERMISSIONS
drop the table SPACEGROUPS
The task tries to drop the
FK9228242D16994414
constraint, however as it doesn't exist, the returned message is the null pointer error thrown in the Confluence logs above.
Solution
Workaround
Run this SQL command to recreate the constraint on the table Spaces:
1
ALTER TABLE 'SPACES' ADD CONSTRAINT 'FK9228242D16994414' FOREIGN KEY ('SPACEGROUPID') REFERENCES 'SPACEGROUPS' ('SPACEGROUPID');
Verify the SPACES table includes the new constraint
1
show create table spaces;
For Oracle database you need to run this:
add constraint to SPACES table:
1 2 3 4
ALTER TABLE SPACES ADD CONSTRAINT FK9228242D16994414 FOREIGN KEY (SPACEGROUPID) REFERENCES SPACEGROUPS (SPACEGROUPID);
check if the constraint was applied:
1
select * from user_cons_columns where table_name='SPACES' and constraint_name='FK9228242D16994414';
Always back up your data before making any database modifications. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
Was this helpful?