Skip to content

GTID: Extra transaction on slave before replication setup #240

@akuzminsky

Description

@akuzminsky

Problem

When setting up Percona replication with GTID, slaves end up with an extra transaction that the master doesn't have.

Slave shows:

mysql> show master status\G
Executed_Gtid_Set: 1c75ba85-f4df-11f0-ae97-02ffd8f80c5d:1,
bf30f9b7-f4de-11f0-8310-06ed89e4c4bd:1-13

Master shows:

mysql> show master status\G
Executed_Gtid_Set: bf30f9b7-f4de-11f0-8310-06ed89e4c4bd:1-13

The extra GTID (1c75ba85-f4df-11f0-ae97-02ffd8f80c5d:1) is the slave's own server UUID with transaction :1.

Analysis

The binlog on the slave shows this transaction in Previous-GTIDs, meaning it happened before replication was configured. Something wrote to MySQL on the slave before CHANGE MASTER TO was executed.

The user creation and other operations ARE replicating correctly from master - this is not the issue.

Impact

With GTID replication, any write on a slave creates a local transaction that the master doesn't have. This can cause issues during failover scenarios.

Proposed Fix

Run RESET MASTER on fresh replicas before configuring replication to clear local GTID history:

RESET MASTER;  -- Clear local GTIDs
CHANGE MASTER TO MASTER_HOST=..., MASTER_AUTO_POSITION=1;
START SLAVE;

In Puppet, ensure the order is:

  1. Install MySQL
  2. RESET MASTER (if this is a new replica)
  3. Configure CHANGE MASTER TO
  4. START SLAVE

Need to investigate what's causing the write before replication setup and either:

  • Prevent it from happening, or
  • Add RESET MASTER before replication configuration

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpercona

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions