Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
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.
- Loading branch information
1 parent
ae8ff3a
commit 80075ba
Showing
3 changed files
with
125 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| include/master-slave.inc | ||
| [connection master] | ||
| connection slave; | ||
| ############### | ||
| # If Using_Gtid != 'No', backup gtid_slave_pos | ||
| ######################## | ||
| include/stop_slave.inc | ||
| change master to master_use_gtid=slave_pos; | ||
| include/start_slave.inc | ||
| connection master; | ||
| CREATE TABLE t(i INT); | ||
| connection slave; | ||
| "using_gtid: Slave_Pos" | ||
| FOUND 1 /gtid_slave_pos/ in xtrabackup_slave_info | ||
| NOT FOUND /MASTER_LOG_FILE/ in xtrabackup_slave_info | ||
| ############### | ||
| # If Using_Gtid != 'No' and !gtid_slave_pos, backup master position | ||
| ######################## | ||
| include/stop_slave.inc | ||
| SET GLOBAL gtid_slave_pos=""; | ||
| NOT FOUND /gtid_slave_pos/ in xtrabackup_slave_info | ||
| FOUND 1 /MASTER_LOG_FILE/ in xtrabackup_slave_info | ||
| ############### | ||
| # If Using_Gtid == 'No', backup Exec_Master_Log_Pos | ||
| ######################## | ||
| change master to master_use_gtid=no; | ||
| include/start_slave.inc | ||
| connection master; | ||
| INSERT INTO t VALUES(1); | ||
| connection slave; | ||
| "using_gtid: No" | ||
| NOT FOUND /gtid_slave_pos/ in xtrabackup_slave_info | ||
| FOUND 1 /MASTER_LOG_FILE/ in xtrabackup_slave_info | ||
| connection master; | ||
| DROP TABLE t; | ||
| connection slave; | ||
| include/rpl_end.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| --source include/master-slave.inc | ||
|
|
||
| --connection slave | ||
|
|
||
| --echo ############### | ||
| --echo # If Using_Gtid != 'No', backup gtid_slave_pos | ||
| --echo ######################## | ||
|
|
||
| --source include/stop_slave.inc | ||
| change master to master_use_gtid=slave_pos; | ||
| --source include/start_slave.inc | ||
|
|
||
| --connection master | ||
| CREATE TABLE t(i INT); | ||
| --sync_slave_with_master | ||
|
|
||
| --let $using_gtid=query_get_value(SHOW SLAVE STATUS,Using_Gtid,1) | ||
| --echo "using_gtid: $using_gtid" | ||
|
|
||
| --let $targetdir=$MYSQLTEST_VARDIR/tmp/backup | ||
| --disable_result_log | ||
| exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --target-dir=$targetdir; | ||
| --enable_result_log | ||
|
|
||
| --let SEARCH_FILE=$targetdir/xtrabackup_slave_info | ||
| --let SEARCH_PATTERN=gtid_slave_pos | ||
| --source include/search_pattern_in_file.inc | ||
| --let SEARCH_PATTERN=MASTER_LOG_FILE | ||
| --source include/search_pattern_in_file.inc | ||
|
|
||
| rmdir $targetdir; | ||
|
|
||
| --echo ############### | ||
| --echo # If Using_Gtid != 'No' and !gtid_slave_pos, backup master position | ||
| --echo ######################## | ||
|
|
||
| --source include/stop_slave.inc | ||
| SET GLOBAL gtid_slave_pos=""; | ||
|
|
||
| --let $targetdir=$MYSQLTEST_VARDIR/tmp/backup | ||
| --disable_result_log | ||
| exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --target-dir=$targetdir; | ||
| --enable_result_log | ||
|
|
||
| --let SEARCH_FILE=$targetdir/xtrabackup_slave_info | ||
| --let SEARCH_PATTERN=gtid_slave_pos | ||
| --source include/search_pattern_in_file.inc | ||
| --let SEARCH_PATTERN=MASTER_LOG_FILE | ||
| --source include/search_pattern_in_file.inc | ||
|
|
||
| rmdir $targetdir; | ||
|
|
||
| --echo ############### | ||
| --echo # If Using_Gtid == 'No', backup Exec_Master_Log_Pos | ||
| --echo ######################## | ||
|
|
||
| change master to master_use_gtid=no; | ||
| --source include/start_slave.inc | ||
|
|
||
| --connection master | ||
| INSERT INTO t VALUES(1); | ||
| --sync_slave_with_master | ||
|
|
||
| --let $using_gtid=query_get_value(SHOW SLAVE STATUS,Using_Gtid,1) | ||
| --echo "using_gtid: $using_gtid" | ||
|
|
||
| --let $targetdir=$MYSQLTEST_VARDIR/tmp/backup | ||
| --disable_result_log | ||
| exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --target-dir=$targetdir; | ||
| --enable_result_log | ||
|
|
||
| --let SEARCH_FILE=$targetdir/xtrabackup_slave_info | ||
| --let SEARCH_PATTERN=gtid_slave_pos | ||
| --source include/search_pattern_in_file.inc | ||
| --let SEARCH_PATTERN=MASTER_LOG_FILE | ||
| --source include/search_pattern_in_file.inc | ||
|
|
||
| rmdir $targetdir; | ||
|
|
||
| # Cleanup | ||
| --connection master | ||
| DROP TABLE t; | ||
| --sync_slave_with_master | ||
| --source include/rpl_end.inc |