Upgrade Fails with User_Mapping Constraint Error
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
Upgrading Confluence fails. The following appears in the atlassian-confluence.log
:
1
2014-07-16 12:06:40,841 ERROR [main] [atlassian.confluence.upgrade.UpgradeLauncherServletContextListener] contextInitialized 1: StatementCallback; SQL [alter table user_mapping drop constraint user_mapping_unq_lwr_username]; 'user_mapping_unq_lwr_username' is not a constraint.; nested exception is java.sql.SQLException: 'user_mapping_unq_lwr_username' is not a constraint.
Cause
A previous upgrade failed and the database was not rolled back properly to its pre-upgrade state, which caused some inconsistency on the user_mapping
table.
This behaviour affects users that are under Confluence version 5.3 and try to upgrade to 5.3 or later.
Resolution
We recommend testing this resolution in a staging/development instance before applying it in production. And before applying in production, be sure to backup your database.
Upgrade Confluence to the latest version.
If you still see the same error, shutdown Confluence and run the following SQL query to add the constraint to your Confluence database:
1 2 3 4 5
ALTER TABLE [dbo].[user_mapping] ADD CONSTRAINT [unq_lwr_username] UNIQUE NONCLUSTERED ( [lower_username] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO
Start Confluence again to see if that addresses the problem.
If the issue persists rollback your Confluence database to its previous state one more time.
Download a new Confluence archive on the same version as your pre-upgraded version.
Install Confluence using the same database.
Now compare the
user_mapping
table of both databasesAdd or remove any missing constraints from your Confluence database so that the
user_mapping
table is exactly the same as the vanilla installation.Try the upgrade again.
Was this helpful?