Skip to content

BUG#34930969: Previous_gtids miss gtid when binlog_order_commits off #94

@xyw0537

Description

@xyw0537

Problem

When binlog_order_commits is turned off, binlog rotate will wait for m_prep_xids to decrease to zero. However, m_prep_xids was decreased before updating the thread GTID to gtid_executed in MYSQL_BIN_LOG::finish_commit, causing GTIDs to be missed in the next binlog file Previous_gtids event.

Fix

The core fix moves dec_prep_xids to be called after gtid_state->update_on_commit in MYSQL_BIN_LOG::finish_commit. This ensures that when binlog rotate waits for m_prep_xids to reach zero, all GTIDs have already been registered in gtid_executed.

Additionally:

  • Added DEBUG_SYNC point after_dec_prep_xids to enable deterministic testing
  • Added MTR test case rpl_previous_gtids to verify the fix

Commit

xyw0537@ae7de225c2a

Branch: bugfix/previous_gtids_miss_gtid_binlog_order_commits_off

Upstream Reference

mysql/mysql-server@a3faa6f

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions