mySQL Database Migration fails due to "null" character in Bitbucket Server table

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

The following appears in Bitbucket Server 2.7.1 Migration Setup UI:


Bitbucket Server could not be migrated to the new database. Some data may have already been written to the new database leaving it in an inconsistent state. You will need to empty or recreate the new database before trying again.
	com.atlassian.bitbucket.internal.maintenance.migration.DatabaseMigrationTask.run(DatabaseMigrationTask.java:44)
	com.atlassian.bitbucket.internal.maintenance.DefaultMaintenanceTaskMonitor.run(DefaultMaintenanceTaskMonitor.java:172)
	java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	...
Failed to execute change: Insert Row; nested exception is org.postgresql.util.PSQLException: ERROR: null value in column "from_branch_name" violates not-null constraint
  Detail: Failing row contains (1, 0, 1, 0, 2014-12-29 22:36:48.817+08, 2014-12-29 22:36:48.817+08, 1, 1, refs/heads/null, refs/heads/master, null, master, 8e33651530fffc4fa06bd912396b7e118af02df3, d88a6550790e4aff0538508675565be6ec9e97e0, null, 2).
	com.atlassian.bitbucket.internal.backup.liquibase.DefaultLiquibaseDao.insert(DefaultLiquibaseDao.java:281)
	com.atlassian.bitbucket.internal.backup.liquibase.DatabaseUpdater.endElement(DatabaseUpdater.java:81)
	org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
	...
ERROR: null value in column "from_branch_name" violates not-null constraint
  Detail: Failing row contains (1, 0, 1, 0, 2014-12-29 22:36:48.817+08, 2014-12-29 22:36:48.817+08, 1, 1, refs/heads/null, refs/heads/master, null, master, 8e33651530fffc4fa06bd912396b7e118af02df3, d88a6550790e4aff0538508675565be6ec9e97e0, null, 2).
	org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
	org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
	org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
	...


Diagnosis

Migrating to a clean mySQL database on Bitbucket Server 2.7.1 with the presence of the character "null" in sta_pull_request table will result in a failure of the migration that will return the error on the screenshot above. 

tip/resting Created with Sketch.

This only have been tested on Bitbucket Server 2.7.1

Direct update to the database may cause database corruption

Resolution

  • Update to at least Bitbucket Server 2.7.6, then only perform the migration.

Last modified on Nov 6, 2018

Was this helpful?

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