3115
MariaDBERRORNotableReplicationHIGH confidence
Cannot set gtid_purged when gtid_executed is not empty
Production Risk
High — RESET MASTER on a replication master breaks all replicas.
What this means
gtid_purged can only be set when gtid_executed is empty (i.e., no GTIDs have been executed on this server since the last RESET MASTER).
Why it happens
- 1Setting gtid_purged on a server that has already executed transactions with GTIDs.
How to reproduce
trigger — this will error
trigger — this will error
SET @@GLOBAL.gtid_purged = 'server-uuid:1-100'; -- after transactions have run
expected output
ERROR 3115 (HY000): Cannot set gtid_purged when gtid_executed is not empty.
Fix
Run RESET MASTER to clear gtid_executed, then set gtid_purged
Run RESET MASTER to clear gtid_executed, then set gtid_purged
RESET MASTER; SET @@GLOBAL.gtid_purged = 'server-uuid:1-100';
Why this works
RESET MASTER clears gtid_executed, allowing gtid_purged to be set.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3115 ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY2
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev