Question

Recently, a query has started failing. It is a query in the Magento software core (not a module) that Reindexes Catalog Search. I have receive the following error.

Catalog Search Index index process unknown error: exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 1785 When @@GLOBAL.ENFORCE_GTID_CONSISTENCY = 1, updates to non-transactional tables can only be done in either autocommitted statements or single-statement transactions, and never in the same statement as updates to transactional tables.' in /var/www/magento-20171012/mage-webroot/lib/Zend/Db/Statement/Pdo.php:228

I am running MySQL 5.6.35 according to SELECT VERSION();.

This documentation claims _ was introduced in MySQL 5.6.9.

This MySQL documentation claims "All servers in your topology must use MySQL 5.7.6 or later. You cannot disable GTID transactions online on any single server unless all servers which are in the topology are using this version."

I don't see gtid_mode in the my.cnf and SELECT @@GLOBAL.GTID_MODE; gives me ON.

I am not sure based on the documentation what GTID exactly is. It sounds like it's used for replication or Master/Slave setups. I don't have a Master/Slave set up and I don't replicate except a backup to a sql file which I don't think is what they mean by replicate.

Running SELECT @@GLOBAL.GTID_MODE; gives me ON. Is running SET @@GLOBAL.GTID_MODE = OFF; all that I need to do to disable GTID and fix this issue? I've done this in my dev (which is not exhibiting the issue) and don't have any issues, but I want to get advice before I apply this to production without understanding the consequences.

What would it mean to disable GTID? Would it resolve this error I'm receiving from the database?

Was it helpful?

Solution

Short answer: Yes, you can disable GTID without risk if you're not replicating from that Server.

Long answer:

The GTID is "a unique identifier created and associated with each transaction committed on the server of origin (master)." This helps when you have some slaves; so you can always track how is your slave (which statements have replicated, from which Server, and some further information; but if you're using the server as a Standalone, shouldn't have problems, you won't use your binlogs.

You should lookup for all the cnf files, (maybe in /usr...), there should be one configuring gtid, since it's disabled by default (https://dev.mysql.com/doc/refman/5.6/en/replication-options-gtids.html#sysvar_enforce_gtid_consistency); it's important to find it so you don't have problems if someday your DB restars; otherwise it'll be ON again.

For disabling it, you'll need to restart; the link you found for disabling it without restart applies for MySQL 5.7 and further.

Finally, what it'll mean for you to disable it, you'll have your binlogs without a clear "identifier", but you'll still have your binlogs in case you need them.

OTHER TIPS

I am also facing the same issue on the server.

GTID is always-on server, please use below MySQL command to disable GTID.

SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY = OFF; 
SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE;
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top