1774
MySQLERRORNotableReplicationHIGH confidence

Cannot set gtid_purged while transactions are in-flight

Production Risk

Medium — GTID state corruption risk.

What this means

SET GLOBAL gtid_purged was attempted while there are active in-flight transactions (owned GTIDs), which would cause GTID inconsistency.

Why it happens
  1. 1Active transactions are currently holding GTIDs on the server.
How to reproduce
trigger — this will error
trigger — this will error
-- Attempted SET GLOBAL gtid_purged while another session has an open transaction

expected output

ERROR 1774 (HY000): Cannot set GTID_PURGED when there are ongoing transactions.

Fix

Ensure no active transactions before setting gtid_purged

Ensure no active transactions before setting gtid_purged
SHOW STATUS LIKE 'Innodb_trx_active_transactions';
-- Wait for all transactions to complete
SET GLOBAL gtid_purged = 'xxxxxxxx:1-50';

Why this works

Setting gtid_purged is only safe when no transactions are in progress.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 1774 ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY

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

← All MySQL errors