3116
MySQLERRORNotableReplicationHIGH confidence

Cannot set gtid_purged when there are owned GTIDs

Production Risk

High — requires disrupting ongoing transactions to apply.

What this means

The gtid_purged variable cannot be set while there are active transactions that own GTIDs (i.e., ongoing transactions).

Why it happens
  1. 1Attempting to set gtid_purged while uncommitted transactions with GTIDs are in progress.
How to reproduce
trigger — this will error
trigger — this will error
-- Session 1 has an open GTID transaction
-- Session 2: SET @@GLOBAL.gtid_purged = '...';

expected output

ERROR 3116 (HY000): Cannot set gtid_purged when there are ongoing transactions owning GTIDs.

Fix

Ensure all transactions are committed or rolled back before setting gtid_purged

Ensure all transactions are committed or rolled back before setting gtid_purged
-- Check for open transactions: SHOW ENGINE INNODB STATUS;
-- Commit or kill open transactions, then:
SET @@GLOBAL.gtid_purged = 'server-uuid:1-100';

Why this works

No active GTID owners allows gtid_purged to be safely set.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3116 ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY2

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors