Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-11519

gtid_current_pos on Galera Cluster




      The `gtid_current_pos` variable on galera node does not get updated for writes from other nodes. This behavior is technically correct based on the documentation:

      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.

      Thus, @@gtid_current_pos contains the most recent GTID executed on the server, whether this was done as a master or as a slave. This value is used as the starting point of replication when a slave is configured with CHANGE MASTER TO master_use_gtid=current_pos.

      Since each galera node is not a traditional slave, `gtid_slave_pos` is not updated for galera writes so if the latest write in a galera cluster is not on this node, `gtid_current_pos` will be empty for the galera replication domain. I think there should be some special handling for galera nodes so the `gtid_current_pos` variable will be accurate for a galera replication domain on all nodes.

      When performing backups with xtrabackup, the gtid it logs as the backup position can only be used if the backup is made against the node with the latest write. In our case, we send all writes to one node so we can only use the gtid from an xtrabackup to set up an async slave if the backup was made from our master node. We can still use the backups from the other nodes to set up an async slave, but we first need to use the binlog coordinates and then switch to gtid.

      Here are the variables from our servers. The values were pulled at slightly different times, but the point should be clear. The local replication domain is 0 and the galera replication domain is 100.

      variable db1(master, id 11) db2(id 12) db3(id 13)
      gtid_binlog_pos 0-13-7004404,100-11-1721013992 0-13-7004404,100-11-1721013017 0-13-7004404,100-11-1721013060
      gtid_current_pos 100-11-1721013992    




            jplindst Jan Lindström (Inactive)
            bradjorgensen Brad Jorgensen
            2 Vote for this issue
            3 Start watching this issue



              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.