mirror of
https://github.com/MariaDB/server.git
synced 2026-02-09 12:18:41 +01:00
In the new binlog implementation, GTID is the only method available to identify binlog positions, and the old-style filename/offset is not 100% meaningful, as a transaction or even single event can span multiple binlog files. However, having at least a filename available on the slave is still useful eg. for debugging purposes if the slave halts with an error; for example to know which file to run mariadb-binlog on. This patch makes the binlog dump thread send fake rotate events containing approximate file name for GTID events. This provides the file name to the slave. The offset is always sent as 0. Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
42 lines
1.1 KiB
Text
42 lines
1.1 KiB
Text
--source include/master-slave.inc
|
|
--source include/have_binlog_format_row.inc
|
|
--source include/have_innodb_binlog.inc
|
|
|
|
--connection slave
|
|
--source include/stop_slave.inc
|
|
--connection master
|
|
--source include/reset_master.inc
|
|
--connection slave
|
|
--source include/start_slave.inc
|
|
--connection master
|
|
|
|
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(4096)) ENGINE=InnoDB;
|
|
|
|
# Cycle through a few binlog files and see the position updated on the slave.
|
|
--connection master
|
|
--let $i= 0
|
|
while ($i < 10) {
|
|
--let $j= 0
|
|
--disable_query_log
|
|
while ($j < 30) {
|
|
eval INSERT INTO t1 VALUES ($i*100+$j, repeat('.', 4000));
|
|
inc $j;
|
|
}
|
|
--enable_query_log
|
|
--source include/save_master_gtid.inc
|
|
--connection slave
|
|
--source include/sync_with_master_gtid.inc
|
|
--let $i_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1)
|
|
--let $s_file= query_get_value(SHOW SLAVE STATUS, Relay_Master_Log_File, 1)
|
|
--connection master
|
|
--echo Slave current file: $i_file / $s_file
|
|
inc $i;
|
|
}
|
|
|
|
SELECT COUNT(*) FROM t1;
|
|
--connection slave
|
|
SELECT COUNT(*) FROM t1;
|
|
|
|
--connection master
|
|
DROP TABLE t1;
|
|
--source include/rpl_end.inc
|