From 80075ba011fb1b90aaf349a17a6f94145c5c8864 Mon Sep 17 00:00:00 2001 From: Vlad Lesin Date: Mon, 7 Sep 2020 19:43:23 +0300 Subject: MDEV-19264 Better support MariaDB GTID for Mariabackup's --slave-info option Parse SHOW SLAVE STATUS output for the "Using_Gtid" column. If the value is "No", then old log file and position is backed up, otherwise gtid_slave_pos is backed up. --- extra/mariabackup/backup_mysql.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'extra') diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index 171c4407ed5..1d7242c5c75 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -1199,6 +1199,7 @@ write_slave_info(MYSQL *connection) char *master = NULL; char *filename = NULL; char *gtid_executed = NULL; + char *using_gtid = NULL; char *position = NULL; char *gtid_slave_pos = NULL; char *ptr; @@ -1209,6 +1210,7 @@ write_slave_info(MYSQL *connection) {"Relay_Master_Log_File", &filename}, {"Exec_Master_Log_Pos", &position}, {"Executed_Gtid_Set", >id_executed}, + {"Using_Gtid", &using_gtid}, {NULL, NULL} }; @@ -1249,7 +1251,8 @@ write_slave_info(MYSQL *connection) ut_a(asprintf(&mysql_slave_position, "master host '%s', purge list '%s'", master, gtid_executed) != -1); - } else if (gtid_slave_pos && *gtid_slave_pos) { + } else if (gtid_slave_pos && *gtid_slave_pos && + !(using_gtid && !strncmp(using_gtid, "No", 2))) { /* MariaDB >= 10.0 with GTID enabled */ result = backup_file_printf(XTRABACKUP_SLAVE_INFO, "SET GLOBAL gtid_slave_pos = '%s';\n" -- cgit v1.2.1