Upgrade Fails with User_Mapping Constraint Error

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Upgrading Confluence fails. The following appears in the atlassian-confluence.log:

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.

  1. Upgrade Confluence to the latest version.
  2. If you still see the same error, shutdown Confluence and run the following SQL query to add the constraint to your Confluence database:

    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
    
  3. Start Confluence again to see if that addresses the problem.
  4. If the issue persists rollback your Confluence database to its previous state one more time.
  5. Download a new Confluence archive on the same version as your pre-upgraded version.
  6. Install Confluence using the same database.
  7. Now compare the user_mapping table of both databases
  8. Add or remove any missing constraints from your Confluence database so that the user_mapping table is exactly the same as the vanilla installation.
  9. Try the upgrade again.
Last modified on Feb 19, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.