Cannot Delete a Stash Repository when using Global Transaction ID in MySQL
Delete repository action, in a Stash instance integrated with MySQL, fails with a similar exception in the Stash 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.]
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 Stash as running Stash with enforce GTID consistency is not supported. You can vote towards this feature request:
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 Stash).
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.