Bitbucket Server 2.7 fails to start with MySQL when binary logging is enabled
問題
When the user tries to connect an external MySQL database, this error will appear in the atlassian-bitbucket.log
:
The schema could not be created.
com.atlassian.bitbucket.internal.db.DefaultDatabaseManager.createSchema(DefaultDatabaseManager.java:313)
com.atlassian.bitbucket.internal.db.DefaultDatabaseManager.prepareDatabase(DefaultDatabaseManager.java:154)
com.atlassian.bitbucket.internal.maintenance.SpringMaintenanceTaskFactory.setupTask(SpringMaintenanceTaskFactory.java:139)
...
liquibase.exception.DatabaseException: Error executing SQL UPDATE `bitbucket`.`DATABASECHANGELOGLOCK` SET `LOCKED` = 1, `LOCKEDBY` = 'secondary-1.versioning.infra-all-versioning-001.eqx (10.22.49.12)', `LOCKGRANTED` = '2013-09-09 10:04:53.844' WHERE `ID` = 1 AND `LOCKED` = 0: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
liquibase.lockservice.LockService.acquireLock(LockService.java:121)
liquibase.lockservice.LockService.waitForLock(LockService.java:61)
liquibase.Liquibase.update(Liquibase.java:102)
...
Error executing SQL UPDATE `bitbucket`.`DATABASECHANGELOGLOCK` SET `LOCKED` = 1, `LOCKEDBY` = 'secondary-1.versioning.infra-all-versioning-001.eqx (10.22.49.12)', `LOCKGRANTED` = '2013-09-09 10:04:53.844' WHERE `ID` = 1 AND `LOCKED` = 0: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:62)
liquibase.executor.jvm.JdbcExecutor.update(JdbcExecutor.java:229)
liquibase.executor.jvm.JdbcExecutor.update(JdbcExecutor.java:206)
...
Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. InnoDB is limited to row-logging when transaction isolation level is READ COMMITTED or READ UNCOMMITTED.
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4190)
com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4122)
原因
Bitbucket Server 2.7 uses READ_COMMITTED instead of relying on the MySQL default isolation level (REPEATABLE_READ) as Bitbucket Server 2.6 and earlier. MySQL does not support binary logging in the STATEMENT mode.
ソリューション
You will need to set the binary logging information in MySQL configuration by following the steps below.
- As per what is stated on our official documentation:
If MySQL is using binary logging, configure the database to use a binary logging format of either
MIXED
orROW
.
- Open MySQL configuration file in your favourite file editor.
- Below you see the two possibilities for configuring your MySQL server. Add either one of the following lines:
Configuring db server as MIXED
[mysqld]
binlog_format = 'MIXED'
または
Configuring db server as ROW
[mysqld]
binlog_format = 'ROW'
- Restart MySQL server.
- Restart Bitbucket Server
最終更新日 2018 年 11 月 2 日
Powered by Confluence and Scroll Viewport.