-
Type:
Suggestion
-
Resolution: Unresolved
-
None
-
Component/s: Database - Migration
Hello,
I'm currently in the process of using the Bitbucket Server Backup Client to migrate our server instance onto a new host with a new backend database, per the documentation here: https://confluence.atlassian.com/bitbucketserver/bitbucket-server-backup-client-776640064.html#BitbucketServerBackupClient-RestoringBitbucketServertouseanewlycreatedDB
However, there's a bit of a workflow issue with the way the Client performs validation - it only seems to validate the database setup after unpacking the *.tar file from the previous backup process into the Bitbucket home directory.
This wouldn't be a problem if I only had a small backup, but my .tar file is over 120Gb which takes about 2 hours to decompress before it reports a simple configuration issue with my MS SQL Server database. (The issues are legitimate, and I'm happy it tells me what I need to do to fix it, but I'd rather get told *before the 2 hour wait for the decompress step).
So far I've had to wait about to 2 hours hours each time (see timestamps) before I'm told the following:
----------------
2021-11-10 10:52:58,244 INFO Initializing
2021-11-10 10:52:59,611 INFO Unpacking bitbucket-08-11-2021.tar to /data02/app/bitbucket-home
2021-11-10 12:45:57,054 INFO Validating database before restore
2021-11-10 12:46:11,939 WARN UTF8 support cannot be checked for the connected database
2021-11-10 12:46:12,621 ERROR bitbucket-08-11-2021.tar could not be restored
com.atlassian.bitbucket.internal.backup.client.RestoreException: The target database contains tables whose names collide with Bitbucket's tables. Please migrate to a clean, empty database. For more information about creating a database for use with Bitbucket, please refer to the Bitbucket documentation.
----------------
2021-11-10 13:39:27,713 INFO Initializing
2021-11-10 13:39:29,052 INFO Unpacking bitbucket-08-11-2021.tar to /data02/app/bitbucket-home
2021-11-10 15:32:56,216 INFO Validating database before restore
2021-11-10 15:33:12,403 WARN UTF8 support cannot be checked for the connected database
2021-11-10 15:33:12,707 ERROR bitbucket-08-11-2021.tar could not be restored
com.atlassian.bitbucket.internal.backup.client.RestoreException: Bitbucket requires a case-sensitive database, but the target database is case-insensitive. For information about creating a database for use with Bitbucket, please refer to the Bitbucket documentation.
at com.atlassian.bitbucket.internal.backup.client.DefaultRestoreClient.validateDataSource(DefaultRestoreClient.groovy:211)
at com.atlassian.bitbucket.internal.backup.client.DefaultRestoreClient.withDataSource(DefaultRestoreClient.groovy:218)
... 7 more frames available in the log file
----------------
The requirements for both are actually specified in the documentation so it's my fault it's misconfigured, but it would be good if the validation steps were performed before the decompress so I'd get told much sooner. The final indignity here is that I have to delete the home directory again (which takes about 15-20 minutes due to the size) before running the restore again, otherwise I get this error:
----------------
2021-11-10 10:27:23,811 INFO Initializing
2021-11-10 10:27:25,507 ERROR bitbucket-08-11-2021.tar could not be restored
com.atlassian.bitbucket.internal.backup.client.RestoreException: The configured BITBUCKET_HOME /data02/app/bitbucket-home is not empty. It contains:
... snip ...
Restoring a backup requires a new, empty directory to unpack files to. (Alternatively, if you know what you're doing, you can ignore the existence of certain files with the bitbucket.home.restore.whitelist property.) Restoring directly over an existing home directory is not supported.
----------------
The fix seems pretty simple - just swap the order of these instructions:
----------------
2021-11-10 13:39:29,052 INFO Unpacking bitbucket-08-11-2021.tar to /data02/app/bitbucket-home
2021-11-10 15:32:56,216 INFO Validating database before restore
----------------
so they run as:
----------------
2021-11-10 15:32:56,216 INFO Validating database before restore
2021-11-10 13:39:29,052 INFO Unpacking bitbucket-08-11-2021.tar to /data02/app/bitbucket-home
----------------
which won't really make much difference for small databases, but for my scenario it would massively improve the user experience as I'd get much faster feedback on problems with my database config.
Hope this helps,
Mike