enforce_gtid_consistency
Refuse transactions that cannot be logged safely with a GTID.
- デフォルト
OFF- Range
- OFF, WARN, ON
- Restart needed
- いいえ
- Default checked on
- MySQL 8.4 LTS
何ができるか
It must be ON before gtid_mode can reach ON. With it on, a transaction may not update both transactional and nontransactional tables, and CREATE TEMPORARY TABLE or DROP TEMPORARY TABLE inside a transaction is refused. WARN allows everything but logs a warning, so you can measure what would break before enforcing it.
デフォルト値
OFF. OFF (MySQL 8.4).
Check the current value
SHOW GLOBAL VARIABLES LIKE 'enforce_gtid_consistency'; SELECT VARIABLE_NAME, VARIABLE_SOURCE, MIN_VALUE, MAX_VALUE, SET_TIME FROM performance_schema.variables_info WHERE VARIABLE_NAME = 'enforce_gtid_consistency';
Change it
SET GLOBAL enforce_gtid_consistency = WARN; -- until the next restart SET PERSIST enforce_gtid_consistency = WARN; -- now and after restarts
No restart. SET GLOBAL or SET PERSIST takes effect immediately; SET PERSIST also writes mysqld-auto.cnf so the value survives restarts.
When to change it
Run WARN on every server for a while before a GTID migration to find application transactions that would be refused, then ON across the whole topology before stepping gtid_mode up.
What can go wrong
Only logged statements are checked: a statement removed by a replication filter skips the check entirely. The refused transactions fail at runtime, so an application that mixes InnoDB with MyISAM writes or uses temporary tables inside transactions needs fixing before ON.
Questions about enforce_gtid_consistency
What is the default value of enforce_gtid_consistency in MySQL?
OFF. OFF (MySQL 8.4).
Does changing enforce_gtid_consistency require a restart?
No. No restart. SET GLOBAL or SET PERSIST takes effect immediately; SET PERSIST also writes mysqld-auto.cnf so the value survives restarts.
When should I change enforce_gtid_consistency?
Run WARN on every server for a while before a GTID migration to find application transactions that would be refused, then ON across the whole topology before stepping gtid_mode up.
Back to all MySQL settings, or check the MySQL manual for every option.
Check enforce_gtid_consistency on your own server
SQLly runs the query above against MySQL and the other engines in this reference, from one desktop app on macOS, Windows and Linux.
このページのテキストとデータ: CC BY 4.0、出典は SQLly (sqlly.app) と明記してください。 コードと SQL スニペット: MIT. ライセンスの詳細