summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@vps-18a7a2b7.vps.ovh.ca>2024-02-14 13:32:10 -0500
committerroot <root@vps-18a7a2b7.vps.ovh.ca>2024-02-14 13:32:10 -0500
commitd7900be223fedb139be73cd6691449993d71bd47 (patch)
tree70ce2f8cd1380d6fb654b0317f952ae31539ecb0
parentb7e0ee04a75958ece3deb1d9577812286391c9cb (diff)
tweak output
-rwxr-xr-xsrc/mariadb-push-replica.sh16
1 files 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()
526 #run_primary mariadb <<< 'show master status\G' 526 #run_primary mariadb <<< 'show master status\G'
527 #run_replica showvars 527 #run_replica showvars
528 #run_replica mariadb <<< 'show slave status\G' 528 #run_replica mariadb <<< 'show slave status\G'
529 gtid=$(run_primary mariadb --skip-reconnect -sssB <<< \ 529 gtid=$(run_primary mariadb_get_primary_gtid)
530 'select @@gtid_binlog_pos;')
531 [ "$gtid" ] && run_replica wait_on_gtid "$gtid" 530 [ "$gtid" ] && run_replica wait_on_gtid "$gtid"
532} 531}
533 532
533mariadb_get_primary_gtid()
534{
535 mariadb --skip-reconnect -sssB <<.
536select
537 @@gtid_binlog_pos;
538.
539}
540
534wait_on_gtid() 541wait_on_gtid()
535{ 542{
536 local gtid="$1" 543 local gtid="$1"
537 mariadb -t <<. 544 mariadb -t <<.
538select 545select
539 @@hostname 546 @@hostname
540, @@gtid_slave_pos as 'slave gtid' 547, @@gtid_slave_pos as 'replica gtid'
541, '$gtid' as 'master gtid' 548, '$gtid' as 'primary gtid'
542; 549;
543stop slave ; 550stop slave ;
544stop slave io_thread ; 551stop slave io_thread ;
@@ -548,6 +555,7 @@ start slave io_thread ;
548 mariadb -t -v <<. 555 mariadb -t -v <<.
549select 556select
550 master_gtid_wait('$gtid') 557 master_gtid_wait('$gtid')
558 as \`primary_gtid_wait('$gtid')\`
551; 559;
552. 560.
553} 561}