From d7900be223fedb139be73cd6691449993d71bd47 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 14 Feb 2024 13:32:10 -0500 Subject: tweak output --- src/mariadb-push-replica.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/mariadb-push-replica.sh b/src/mariadb-push-replica.sh index d0c87b7..074fcbd 100755 --- a/src/mariadb-push-replica.sh +++ b/src/mariadb-push-replica.sh @@ -526,19 +526,26 @@ main() #run_primary mariadb <<< 'show master status\G' #run_replica showvars #run_replica mariadb <<< 'show slave status\G' - gtid=$(run_primary mariadb --skip-reconnect -sssB <<< \ - 'select @@gtid_binlog_pos;') + gtid=$(run_primary mariadb_get_primary_gtid) [ "$gtid" ] && run_replica wait_on_gtid "$gtid" } +mariadb_get_primary_gtid() +{ + mariadb --skip-reconnect -sssB <<. +select + @@gtid_binlog_pos; +. +} + wait_on_gtid() { local gtid="$1" mariadb -t <<. select @@hostname -, @@gtid_slave_pos as 'slave gtid' -, '$gtid' as 'master gtid' +, @@gtid_slave_pos as 'replica gtid' +, '$gtid' as 'primary gtid' ; stop slave ; stop slave io_thread ; @@ -548,6 +555,7 @@ start slave io_thread ; mariadb -t -v <<. select master_gtid_wait('$gtid') + as \`primary_gtid_wait('$gtid')\` ; . } -- cgit v1.2.3