Cannot Delete a Bitbucket Server Repository when using Global Transaction ID in MySQL

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Delete repository action, in a Bitbucket Server instance integrated with MySQL, fails with a similar exception in the Bitbucket Server logs:

 

2015-07-07 17:06:16,123 WARN  [http-bio-7990-exec-15] <username> @1Q5I8BYx1026x359x1 1wn1yo6 10.179.145.126,127.0.0.1 "DELETE /projects/project/repos/repository HTTP/1.1" o.h.h.s.TemporaryTableBulkIdStrategy unable to drop temporary id table after use [When @@GLOBAL.ENFORCE_GTID_CONSISTENCY = 1, the statements CREATE TEMPORARY TABLE and DROP TEMPORARY TABLE can be executed in a non-transactional context only, and require that AUTOCOMMIT = 1.]


Cause 

The reason you are seeing this issue is because of ENFORCE_GTID_CONSISTENCY = 1. You can read more about it here.
Unfortunately, if you require Global Transaction ID consistency, you will keep experiencing this problem with Bitbucket Server as running Bitbucket Server with enforce GTID consistency is not supported. You can vote towards this feature request:
https://jira.atlassian.com/browse/BSERV-4964
for it to be implemented in future.
Tables starting with HT_ are hibernate temporary tables and are created automatically by Hibernate (the ORM we use in Bitbucket Server).
Hibernate creates these temporary tables for bulk operations, such as a bulk delete, but MySQL will not allow the creation of temporary tables within transactions when enforce GTID consistency is on.

From the MySQL documentation:

When set, this option allows execution of only those statements that can be logged in a transactionally safe manner. 
This means that the following operations CANNOT be used when this option is enabled:
CREATE TABLE ... SELECT statements
CREATE TEMPORARY TABLE statements inside transactions
Transactions or statements that update both transactional and nontransactional tables.

 

Last modified on Feb 19, 2016

Was this helpful?

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