Skip to content
/ server Public
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions client/mysqlbinlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1131,11 +1131,32 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
goto end;
}

if (!gtid_event_filter->exclude(&ev_gtid))
print_event_info->activate_current_event_group();
else
print_event_info->deactivate_current_event_group();
/* MDEV-28278: ensure server_id also matches when evaluating GTID start position */
if (!gtid_event_filter->exclude(&ev_gtid))
{

if (position_gtid_filter && position_gtid_filter->get_num_start_gtids() > 0)
{
Comment on lines +1134 to +1139
Copy link
Contributor

@ParadoxV5 ParadoxV5 Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach is incorrect.

  • It’s a manual loop next to and overriding a method call with a very similar purpose.
  • It even works by bypassing the gtid_state_validator section.

The fix to the check should most likely be a part of (that is, inside) exclude() – why should --stop-position not respect server_id, only --start-position?

rpl_gtid *start_gtids = position_gtid_filter->get_start_gtids();
size_t n_start_gtids = position_gtid_filter->get_num_start_gtids();

for (size_t i = 0; i < n_start_gtids; i++)
{
if (start_gtids[i].domain_id == ev_gtid.domain_id)
{
if (start_gtids[i].server_id != ev_gtid.server_id ||
ev_gtid.seq_no <= start_gtids[i].seq_no)
{
goto end_skip_count;
}
}
}
}

print_event_info->activate_current_event_group();
}
else
print_event_info->deactivate_current_event_group();

/*
Where we always ensure the initial binlog state is valid, we only
Expand Down