The Database Constraint Checker

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

During a Confluence upgrade, Hibernate attempts to update the database schema to meet its requirements. However, its approach is very conservative—it will only add new elements, such as columns, constraints, or indexes, without removing or altering existing ones. If an index or constraint with the same name already exists, Hibernate will leave it unchanged rather than trying to redefine it.

While this allows for customization, it can cause the schema to drift over time, leading to issues like incorrect column settings, missing indexes, or constraints, resulting in bugs or poor performance.

To address this, Confluence runs the SchemaComparisonService at startup. This service generates a report highlighting differences between the actual database schema (tables, indexes, constraints, etc.) and Hibernate's expected schema. The report is logged in the atlassian-confluence.log and serves as an advisory notice, as no automatic action is taken.

Although this is an improvement, it remains conservative and doesn't warn about unrecognized indexes or constraints. This avoids false positives from database-specific internal structures.

Here is an example report:

2014-12-14 19:07:49,320 WARN [main] [core.persistence.schema.StartupSchemaChecker] handleWarnings Database schema is inconsistent with expectations - %s warnings, see below 2014-12-14 19:07:49,320 WARN [main] [core.persistence.schema.StartupSchemaChecker] handleWarnings Index [sp_comp_idx] of table [spacepermissions] has mismatched definitions for expected [Index spacepermissions.sp_comp_idx on [permtype, permgroupname] non-unique] and actual [Index spacepermissions.sp_comp_idx on [permtype, permgroupname, permusername] non-unique] 2014-12-14 19:07:49,320 WARN [main] [core.persistence.schema.StartupSchemaChecker] handleWarnings Column [labelid] of table [content_label] has mismatched definitions for expected [Column content_label.labelid int8 non-nullable] and actual [Column content_label.labelid int8(19) nullable] 2014-12-14 19:07:49,321 WARN [main] [core.persistence.schema.StartupSchemaChecker] handleWarnings Column [username] of table [logininfo] has mismatched definitions for expected [Column logininfo.username varchar(255) non-nullable] and actual [Column logininfo.username varchar(255) nullable] 2014-12-14 19:07:49,321 WARN [main] [core.persistence.schema.StartupSchemaChecker] handleWarnings Column [buildnumber] of table [confversion] has mismatched definitions for expected [Column confversion.buildnumber int4 non-nullable] and actual [Column confversion.buildnumber int4(10) nullable] 2014-12-14 19:07:49,321 WARN [main] [core.persistence.schema.StartupSchemaChecker] handleWarnings Column [cp_type] of table [content_perm] has mismatched definitions for expected [Column content_perm.cp_type varchar(10) non-nullable] and actual [Column content_perm.cp_type varchar(10) nullable] 2014-12-14 19:07:49,321 WARN [main] [core.persistence.schema.StartupSchemaChecker] handleWarnings Column [follower] of table [follow_connections] has mismatched definitions for expected [Column follow_connections.follower varchar(255) nullable] and actual [Column follow_connections.follower varchar(255) non-nullable] 2014-12-14 19:07:49,322 WARN [main] [core.persistence.schema.StartupSchemaChecker] handleWarnings Column [followee] of table [follow_connections] has mismatched definitions for expected [Column follow_connections.followee varchar(255) nullable] and actual [Column follow_connections.followee varchar(255) non-nullable] 2014-12-14 19:07:49,364 WARN [main] [core.persistence.schema.StartupSchemaChecker] handleWarnings Column [public_key_id] of table [trustedapp] has mismatched definitions for expected [Column trustedapp.public_key_id int8 non-nullable] and actual [Column trustedapp.public_key_id int8(19) nullable]

Solution

Resolution

Each warning indicates a different condition. Some may need to be treated, whereas others can be safely ignored. Because each will have a different workaround, and will need to be fixed in a different way, we have elected to create individual bug reports for each warning. Please see the bugs below to find your warnings and the mitigation steps for each. If you do not see the warning you are receiving below, please feel free to contact Support. We can advise you on the suggested course of action, and raise a bug report.

CONFSERVER-42929 - Database Constraint Checker has mismatched definitions for expected non-nullable - Fixed in 6.0.2 and later

CONFSERVER-36971 - Database Constraint Checker has mismatched definitions for expected index definitions - Fixed in 6.0.5 and later

CONFSERVER-36970 - Database Constraint Checker has mismatched definitions for expected nullable and actual non-nullable - See bug report for workaround

CONFSERVER-36946 - Database Constraint Checker has mismatched definitions for expected non-nullable and actual nullable - - See bug report for workaround

Updated on May 22, 2025

Still need help?

The Atlassian Community is here for you.