You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Config value for copydb ReplicatedMasterPositionQuery with vanilla MysQL replication #348
Hello, I am trying to use the ReplicatedMasterPositionQuery config when setting the source as replica.
The example in the config is showing a query using pt-heartbeat
// SELECT file, position FROM meta.ptheartbeat WHERE server_id = master_server_id
When using vanilla MySQL replication ( using 8.0.34 ), what query should I be using?
It seems SHOW REPLICA STATUS; contains the adequate information ( Relay_Source_Log_Pos, Relay_Source_Log_File ), however I am not able to extract them through a SELECT query. Am I missing a config to use?
The information in the Performance Schema replication tables differs somewhat from the information available from SHOW REPLICA STATUS because the tables are oriented toward use of global transaction identifiers (GTIDs), not file names and positions, and they represent server UUID values, not server ID values. Due to these differences, several SHOW REPLICA STATUS columns are not preserved in the Performance Schema replication tables, or are represented a different way:
The following fields refer to file names and positions and are not preserved:
Master_Log_File
Read_Master_Log_Pos
Relay_Log_File
Relay_Log_Pos
Relay_Master_Log_File
Exec_Master_Log_Pos
Until_Condition
Until_Log_File
Until_Log_Pos
For vanilla replication, run in GTID mode (BinlogCoordinateMode: "gtid") and set ReplicatedMasterGTIDQuery (copydb/config.go) to a query returning the master's executed GTID set as seen by the replica. If the replica takes no local writes and replicates from a single source, SELECT @@GLOBAL.gtid_executed works. In file/position mode the custom query must return a single (file, position) row, so SHOW REPLICA STATUS can't be used directly. Closing as answered.
Activity
driv3r commentedon Oct 14, 2026
For vanilla replication, run in GTID mode (
BinlogCoordinateMode: "gtid") and setReplicatedMasterGTIDQuery(copydb/config.go) to a query returning the master's executed GTID set as seen by the replica. If the replica takes no local writes and replicates from a single source,SELECT @@GLOBAL.gtid_executedworks. In file/position mode the custom query must return a single(file, position)row, soSHOW REPLICA STATUScan't be used directly. Closing as answered.