Common SQL Errors

MySQL Error 3117: ER_SET_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS - How to Fix and Prevent

Galaxy Team
August 8, 2025

The server warns that enforce_gtid_consistency cannot be enabled because transactions that break GTID consistency are still running.

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error 3117 ER_SET_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS?

MySQL error 3117 ER_SET_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS appears when you try to turn on enforce_gtid_consistency while non-GTID-safe transactions are active. Commit or roll back those transactions, then retry the SET statement to resolve the warning.

Error Highlights

Typical Error Message

ER_SET_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS

Error Type

Replication Configuration Error

Language

MySQL

Symbol

consistency. ER_SET_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS is renamed to ER_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TX in MySQL 8.0. ER_SET_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS was added in 5.7.6.

Error Code

3117

SQL State

HY000

Explanation

Table of Contents

What is ER_SET_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS?

Error 3117 signals that MySQL cannot immediately switch the global enforce_gtid_consistency flag to ON because one or more open transactions perform operations that are not GTID-safe, such as creating or dropping temporary tables.

MySQL first issued this warning in version 5.7.6 and renamed it to ER_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TX in MySQL 8.0. The SQLSTATE is HY000, indicating a general error.

Why does the warning appear?

The server checks all active sessions when you run SET GLOBAL enforce_gtid_consistency = ON. If any session holds a transaction that breaks GTID rules, MySQL emits error 3117 instead of applying the change. This prevents replication problems caused by unsafe statements.

Why is it important to fix quickly?

GTID-consistent transactions are mandatory before enabling GLOBAL gtid_mode = ON. Failing to resolve error 3117 blocks the transition to GTID-based replication, delaying topology changes, failover automation, and point-in-time recovery workflows.

What Causes This Error?

The most common cause is an application connection that began a transaction, executed a non-GTID-safe statement like CREATE TEMPORARY TABLE, and has not yet committed or rolled back.

Long-running administrative scripts, interactive sessions, or idle connections in autocommit = 0 may also leave transactions open for hours, triggering the warning when you attempt the configuration change.

How to Fix Error 3117

First, locate sessions with ongoing GTID-violating transactions using Performance Schema or SHOW ENGINE INNODB STATUS. Commit or roll back each offending transaction, then reissue the SET statement.

If you cannot safely close a session, kill the connection to release the transaction. After all unsafe transactions disappear, MySQL allows enforce_gtid_consistency to be enabled.

Common Scenarios and Solutions

An online schema change tool left a temporary table inside a transaction. Commit the tool's session or kill the process to clear the violation.

A data-loading script opened multiple sessions with autocommit disabled. Issue COMMIT on each connection or wait until the load completes before retrying.

Best Practices to Avoid This Error

Use autocommit for short statements and avoid temporary tables inside explicit transactions. Enforce a connection timeout policy that closes idle sessions automatically.

Enable SESSION enforce_gtid_consistency at application startup so developers catch unsafe statements early, long before you switch the GLOBAL setting.

Related Errors and Solutions

Error 3170 ER_CANT_SET_GTID_MODE_WITH_GTID_TABLE_ENCRYPTION_ON occurs when encryption prevents GTID changes. Turn off encryption or upgrade.

Error 1840 ER_GTID_MODE_REQUIRED_PERMISSIVE mode appears if enforce_gtid_consistency is OFF when enabling GTID mode. Fix by enabling enforce_gtid_consistency first.

Common Causes

Active transaction with CREATE TEMPORARY TABLE

Temporary tables inside a transaction break GTID rules and block the configuration change.

Long-running bulk insert with autocommit disabled

Bulk operations that keep the transaction open hold unsafe statements in memory.

Interactive session holding locks

DBAs sometimes forget to commit after maintenance, leaving a violating transaction open.

Misbehaving application connection pool

Pooled connections may linger in an open transaction state due to coding errors.

Related Errors

ER_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TX (3117)

Same condition but renamed from MySQL 8.0 onward.

ER_GTID_MODE_REQUIRED_PERMISSIVE (1840)

Occurs when gtid_mode is changed without first enabling enforce_gtid_consistency.

ER_CANT_SET_GTID_MODE (1782)

Raised if other replication settings make gtid_mode change impossible.

FAQs

Does error 3117 stop replication?

No, replication continues but you cannot enable enforce_gtid_consistency until the warning is cleared.

Can I ignore the warning?

Ignoring it leaves the server in a non-GTID-safe state and blocks future GTID replication changes.

Will restarting MySQL fix the error?

A restart closes all sessions, so the warning disappears, but it causes downtime. Commit or kill sessions instead.

How does Galaxy help?

Galaxy highlights long-running transactions in its session panel, letting you commit or terminate them before applying GTID settings.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo