[MDEV-4688] gtid_current_pos and gtid_slave_pos have empty values most of the time when slave is replicating Created: 2013-06-20  Updated: 2013-06-21  Resolved: 2013-06-21

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: 10.0.5

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Kristian Nielsen
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-26 Global transaction ID Closed

 Description   

I'm not sure if it's a bug, maybe it's supposed to work this way, but it surely looks strange, so I'll file it and leave it to you to decide

When a slave is actively replicating, most of the time @@gtid_current_pos and @@gtid_slave_pos appear to be empty. No special flow seems to be necessary, just regular DML would suffice. For example, the test below performs a thousand of inserts on master while checking the values on the slave at the same time. Here is a typical extract from the output:

Variable_name   Value
gtid_binlog_pos 0-1-513
gtid_current_pos        
gtid_slave_pos  
Variable_name   Value
gtid_binlog_pos 0-1-523
gtid_current_pos        
gtid_slave_pos  
Variable_name   Value
gtid_binlog_pos 0-1-530
gtid_current_pos        0-1-530
gtid_slave_pos  0-1-530
Variable_name   Value
gtid_binlog_pos 0-1-540
gtid_current_pos        
gtid_slave_pos  
Variable_name   Value
gtid_binlog_pos 0-1-548
gtid_current_pos        
gtid_slave_pos  
Variable_name   Value
gtid_binlog_pos 0-1-559
gtid_current_pos        
gtid_slave_pos  

If instead of a number of small statements I execute one very big statement, the effect can still be observed, but the empty values only appear during a small fraction of time. So, I presume the "empty phase" has somewhat flat duration per an event group, regardless its size.

Test case:

--source include/master-slave.inc
--source include/have_innodb.inc
--source include/have_binlog_format_row.inc
 
--connection slave
--source include/stop_slave.inc
change master to master_use_gtid=current_pos;
--source include/start_slave.inc
 
--connection master
create table t1 (i int, c varchar(8)) engine=InnoDB;
 
--delimiter |
create procedure p(n int)
begin
	while n > 0 do
		insert into t1 values (1,'test1'),(2,'test2'),(3,'test3'),(4,'test4');
		set n = n - 1;
	end while;
end|
--delimiter ;
 
send call p(1000);
 
--connection slave
 
let $run = 100;
 
--disable_query_log
while ($run)
{
	SHOW VARIABLES LIKE 'gtid%pos';
	--sleep 1
	dec $run;
}
 
--connection master
--reap
drop table t1;
drop procedure p;
 
--sync_slave_with_master
 
--connection master
--source include/rpl_end.inc

bzr version-info

revision-id: sergii@pisem.net-20130610064025-makoe3xkewwwky8j
revno: 3761
branch-nick: 10.0



 Comments   
Comment by Kristian Nielsen [ 2013-06-21 ]

Yeah, it's certainly a bug, good catch!

The window for seeing this is in-between the start and the end of the COMMIT
event when it is executed by the slave SQL thread. The function record_gtid()
deletes too much from the internal in-memory hash, it must keep around at
least one entry.

Will fix.

Comment by Kristian Nielsen [ 2013-06-21 ]

Pushed to 10.0-base

Generated at Thu Feb 08 06:58:22 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.