[MDEV-26176] gtid_current_pos on Galera Cluster is not updating Created: 2021-07-19  Updated: 2021-09-14  Resolved: 2021-08-30

Status: Closed
Project: MariaDB Server
Component/s: Galera, Replication
Affects Version/s: 10.5.10
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Pon Suresh Pandian (Inactive) Assignee: Ramesh Sivaraman
Resolution: Not a Bug Votes: 1
Labels: None
Environment:

CentOS Linux release 7.7.1908 (Core)


Attachments: HTML File Node-1     HTML File Node-2    

 Description   

The gtid_current_pos variable on galera node does not get updated on other nodes.

I have 2 node galera cluster along with maxscale.

From maxscale :

[root@ip-172-31-12-219 centos]# maxctrl list servers
┌─────────┬──────────────┬──────┬─────────────┬─────────────────────────┬────────┐
│ Server │ Address │ Port │ Connections │ State │ GTID │
├─────────┼──────────────┼──────┼─────────────┼─────────────────────────┼────────┤
│ server1 │ 18.207.3.40 │ 3333 │ 0 │ Master, Synced, Running │ 1-1-15 │
├─────────┼──────────────┼──────┼─────────────┼─────────────────────────┼────────┤
│ server2 │ 54.237.3.158 │ 3333 │ 0 │ Slave, Synced, Running │ │
└─────────┴──────────────┴──────┴─────────────┴─────────────────────────┴────────┘

As per the maxscale, server1 is a master and it's showing gtid_current_pos "1-1-15".

Server 1:

MariaDB [(none)]> show global variables like '%gtid%';
-------------------------------+

Variable_name Value

-------------------------------+

gtid_binlog_pos 1-1-15
gtid_binlog_state 1-1-15
gtid_cleanup_batch_size 64
gtid_current_pos 1-1-15
gtid_domain_id 201
gtid_ignore_duplicates OFF
gtid_pos_auto_engines  
gtid_slave_pos  
gtid_strict_mode OFF
wsrep_gtid_domain_id 1
wsrep_gtid_mode ON

-------------------------------+
11 rows in set (0.001 sec)

Server 2 :

MariaDB [(none)]> show global variables like 'gtid%';
-------------------------------+

Variable_name Value

-------------------------------+

gtid_binlog_pos 1-1-15
gtid_binlog_state 1-1-15
gtid_cleanup_batch_size 64
gtid_current_pos  
gtid_domain_id 202
gtid_ignore_duplicates OFF
gtid_pos_auto_engines  
gtid_slave_pos  
gtid_strict_mode OFF

-------------------------------+
9 rows in set (0.001 sec)

In server2 the gtid_current_pos is empty. Now I have stopped the mariadb service in server1.
Now server2 is my master.

[root@ip-172-31-12-219 centos]# maxctrl list servers
┌─────────┬──────────────┬──────┬─────────────┬─────────────────────────┬──────┐
│ Server │ Address │ Port │ Connections │ State │ GTID │
├─────────┼──────────────┼──────┼─────────────┼─────────────────────────┼──────┤
│ server1 │ 18.207.3.40 │ 3333 │ 0 │ Down │ │
├─────────┼──────────────┼──────┼─────────────┼─────────────────────────┼──────┤
│ server2 │ 54.237.3.158 │ 3333 │ 0 │ Master, Synced, Running │ │
└─────────┴──────────────┴──────┴─────────────┴─────────────────────────┴──────┘
Now I have inserted some data on server2 , and checked the gtid_current_pos still it's showing empty value.

MariaDB [test]> create table t1 (id int,name varchar(20));
Query OK, 0 rows affected (0.010 sec)

MariaDB [test]> insert into t1 values(1,'kjsdlad');
Query OK, 1 row affected (0.002 sec)

MariaDB [test]> insert into t1 values(2,'mmznb');
Query OK, 1 row affected (0.001 sec)

MariaDB [test]> insert into t1 values(3,'rock');
Query OK, 1 row affected (0.002 sec)

MariaDB [test]> insert into t1 values(4,'khlcsk');
Query OK, 1 row affected (0.002 sec)

MariaDB [test]> insert into t1 values(5,'lcsk');
Query OK, 1 row affected (0.004 sec)

MariaDB [test]> show global variables like 'gtid%';
-------------------------------+

Variable_name Value

-------------------------------+

gtid_binlog_pos 1-1-20
gtid_binlog_state 1-1-20
gtid_cleanup_batch_size 64
gtid_current_pos  
gtid_domain_id 202
gtid_ignore_duplicates OFF
gtid_pos_auto_engines  
gtid_slave_pos  
gtid_strict_mode OFF

-------------------------------+
9 rows in set (0.001 sec)

why we are not seeing gtid_current_pos for other slave servers ?

If I switch the master server still it's showing empty.



 Comments   
Comment by Ramesh Sivaraman [ 2021-08-27 ]

ponsuresh.pandians Could not reproduce the issue on version 10.5.10. The gtid_current_pos in Node 2 is updated with each transaction in Node 1.. Could you please share the configuration files from both nodes?
Node1

MariaDB [(none)]> show global variables like '%gtid%';
+-------------------------+-------+
| Variable_name           | Value |
+-------------------------+-------+
| gtid_binlog_pos         | 1-1-4 |
| gtid_binlog_state       | 1-1-4 |
| gtid_cleanup_batch_size | 64    |
| gtid_current_pos        | 1-1-4 |
| gtid_domain_id          | 201   |
| gtid_ignore_duplicates  | OFF   |
| gtid_pos_auto_engines   |       |
| gtid_slave_pos          |       |
| gtid_strict_mode        | OFF   |
| wsrep_gtid_domain_id    | 1     |
| wsrep_gtid_mode         | ON    |
+-------------------------+-------+
11 rows in set (0.001 sec)
 
MariaDB [(none)]> create database test_one;
Query OK, 1 row affected (0.010 sec)
 
MariaDB [(none)]> show global variables like '%gtid%';
+-------------------------+-------+
| Variable_name           | Value |
+-------------------------+-------+
| gtid_binlog_pos         | 1-1-5 |
| gtid_binlog_state       | 1-1-5 |
| gtid_cleanup_batch_size | 64    |
| gtid_current_pos        | 1-1-5 |
| gtid_domain_id          | 201   |
| gtid_ignore_duplicates  | OFF   |
| gtid_pos_auto_engines   |       |
| gtid_slave_pos          |       |
| gtid_strict_mode        | OFF   |
| wsrep_gtid_domain_id    | 1     |
| wsrep_gtid_mode         | ON    |
+-------------------------+-------+
11 rows in set (0.001 sec)
 
MariaDB [(none)]> select @@version;
+---------------------+
| @@version           |
+---------------------+
| 10.5.10-MariaDB-log |
+---------------------+
1 row in set (0.001 sec)
 
MariaDB [(none)]> 
 
 
Node2
{code:sql}
MariaDB [(none)]> show global variables like '%gtid%';
+-------------------------+-------+
| Variable_name           | Value |
+-------------------------+-------+
| gtid_binlog_pos         | 1-1-5 |
| gtid_binlog_state       | 1-1-5 |
| gtid_cleanup_batch_size | 64    |
| gtid_current_pos        | 1-1-5 |
| gtid_domain_id          | 202   |
| gtid_ignore_duplicates  | OFF   |
| gtid_pos_auto_engines   |       |
| gtid_slave_pos          |       |
| gtid_strict_mode        | OFF   |
| wsrep_gtid_domain_id    | 1     |
| wsrep_gtid_mode         | ON    |
+-------------------------+-------+
11 rows in set (0.001 sec)
 
MariaDB [(none)]> 

Comment by Pon Suresh Pandian (Inactive) [ 2021-08-27 ]

Hi Ramesh,

Here I have attached the my.cnf for both nodes. Please check it.

It's not working..

MariaDB [(none)]> create database tt;
Query OK, 1 row affected (0.005 sec)
 
MariaDB [(none)]> show global variables like 'gtid%';
+-------------------------+-------+
| Variable_name           | Value |
+-------------------------+-------+
| gtid_binlog_pos         | 1-1-5 |
| gtid_binlog_state       | 1-1-5 |
| gtid_cleanup_batch_size | 64    |
| gtid_current_pos        |       |
| gtid_domain_id          | 202   |
| gtid_ignore_duplicates  | OFF   |
| gtid_pos_auto_engines   |       |
| gtid_slave_pos          |       |
| gtid_strict_mode        | OFF   |
+-------------------------+-------+
9 rows in set (0.001 sec)

Comment by Ramesh Sivaraman [ 2021-08-27 ]

ponsuresh.pandians Reproduced this with different server ids. This is an expected behavior, gtid_current_pos will be empty if GTID's server_id is not equal to the server's own server_id. gtid_current_pos will be updated if we use the same server ID on all nodes.

http://mariadb.com/kb/en/gtid/#gtid_current_pos

For each replication domain, if the server_id of the corresponding GTID in gtid_binlog_pos is equal to the servers own server_id, and the sequence number is higher than the corresponding GTID in gtid_slave_pos, then the GTID from gtid_binlog_pos will be used. Otherwise the GTID from gtid_slave_pos will be used for that domain.

GTIDs from gtid_binlog_pos in which the server_id of the GTID is not equal to the server's own server_id are effectively ignored. If gtid_binlog_pos contains a GTID for a given replication domain, but the server_id of the GTID is not equal to the server's own server_id, and gtid_slave_pos does not contain a GTID for that given replication domain, then gtid_current_pos will not contain any GTID for that replication domain.

Thus, gtid_current_pos contains the most recent GTID executed on the server, whether this was done as a primary or as a replica.

Generated at Thu Feb 08 09:43:19 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.