diff options
author | root <root@vps-18a7a2b7.vps.ovh.ca> | 2024-02-14 13:32:10 -0500 |
---|---|---|
committer | root <root@vps-18a7a2b7.vps.ovh.ca> | 2024-02-14 13:32:10 -0500 |
commit | d7900be223fedb139be73cd6691449993d71bd47 (patch) | |
tree | 70ce2f8cd1380d6fb654b0317f952ae31539ecb0 | |
parent | b7e0ee04a75958ece3deb1d9577812286391c9cb (diff) |
tweak output
-rwxr-xr-x | src/mariadb-push-replica.sh | 16 |
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 | ||
533 | mariadb_get_primary_gtid() | ||
534 | { | ||
535 | mariadb --skip-reconnect -sssB <<. | ||
536 | select | ||
537 | @@gtid_binlog_pos; | ||
538 | . | ||
539 | } | ||
540 | |||
534 | wait_on_gtid() | 541 | wait_on_gtid() |
535 | { | 542 | { |
536 | local gtid="$1" | 543 | local gtid="$1" |
537 | mariadb -t <<. | 544 | mariadb -t <<. |
538 | select | 545 | select |
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 | ; |
543 | stop slave ; | 550 | stop slave ; |
544 | stop slave io_thread ; | 551 | stop slave io_thread ; |
@@ -548,6 +555,7 @@ start slave io_thread ; | |||
548 | mariadb -t -v <<. | 555 | mariadb -t -v <<. |
549 | select | 556 | select |
550 | master_gtid_wait('$gtid') | 557 | master_gtid_wait('$gtid') |
558 | as \`primary_gtid_wait('$gtid')\` | ||
551 | ; | 559 | ; |
552 | . | 560 | . |
553 | } | 561 | } |