Skip to content

PS-11054 fix: cannot replicate because the source purged required binary logs#118

Merged
percona-ysorokin merged 1 commit into0.2from
gtid_purged
Apr 21, 2026
Merged

PS-11054 fix: cannot replicate because the source purged required binary logs#118
percona-ysorokin merged 1 commit into0.2from
gtid_purged

Conversation

@percona-ysorokin
Copy link
Copy Markdown
Collaborator

https://perconadev.atlassian.net/browse/PS-11054

It is now possible to start replication from MySQL servers that have non-empty purged GTID set ('@@global.gtid_purged').
Internally, if we identify that the specified storage is empty, we try to extract the set of GTIDs that were purged on the server side via 'SELECT '@@global.gtid_purged' and pass this info to the storage object. This helps to make sure that the very first binlog will have this purged GTID set stored in the 'previous_gtids' field of its metadata file (before this change, the 'previous_gtids' in the very first metadata file was always empty). Because of this change when we switch the connection to the replication mode we also pass this purged GTID set as the initial GTID state to the 'mysql_binlog_open()' client API call and don't get the
'Cannot replicate because the source purged required binary logs' errors anymore.

'easymysql::connection' class extended with the new 'execute_select_query_string_result()' method that can be used for executing single-value (single row + single column) queries returning a string value.

'binsrv::storage' class extended with new 'purged_gtids_' member that is used to store information about purged GTIDs identified when storage was initialized for the first time.

Raised log message severity from 'info' to 'error' for some connection exceptions.

Added new MTR test case 'binlog_streaming.gtid_purged' that checks if PBS can start replicating from a server that has the very first binlog file purged.

Fixed README.md - the correct JSON filed name in the 'result' section of the query responses is 'previous_gtids' (not 'initial_gtids').

…ary logs

https://perconadev.atlassian.net/browse/PS-11054

It is now possible to start replication from MySQL servers that have non-empty
purged GTID set ('@@global.gtid_purged').
Internally, if we identify that the specified storage is empty, we try to extract the
set of GTIDs that were purged on the server side via
'SELECT '@@global.gtid_purged' and pass this info to the storage object. This
helps to make sure that the very first binlog will have this purged GTID set
stored in the 'previous_gtids' field of its metadata file (before this change, the
'previous_gtids' in the very first metadata file was always empty).  Because of
this change when we switch the connection to the replication mode we also
pass this purged GTID set as the initial GTID state to the 'mysql_binlog_open()'
client API call and don't get the
'Cannot replicate because the source purged required binary logs'
errors anymore.

'easymysql::connection' class extended with the new
'execute_select_query_string_result()' method that can be used for executing
single-value (single row + single column) queries returning a string value.

'binsrv::storage' class extended with new 'purged_gtids_' member that is used to
store information about purged GTIDs identified when storage was initialized for
the first time.

Raised log message severity from  'info' to 'error' for some connection exceptions.

Added new MTR test case 'binlog_streaming.gtid_purged' that checks if PBS can
start replicating from a server that has the very first binlog file purged.

Fixed README.md - the correct JSON filed name in the 'result' section of the
query responses is 'previous_gtids' (not 'initial_gtids').
@percona-ysorokin percona-ysorokin merged commit ec557f3 into 0.2 Apr 21, 2026
7 checks passed
@percona-ysorokin percona-ysorokin deleted the gtid_purged branch April 21, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant