File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,6 @@ server-id=1
33log-bin =mysql-bin
44binlog-format =ROW
55log-slave-updates =ON
6- gtid_strict_mode =ON
6+ gtid_strict_mode =OFF
77binlog-row-image =MINIMAL
88report-host =mysql1
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ server-id=2
33log-bin =mysql-bin
44binlog-format =ROW
55log-slave-updates =ON
6- gtid_strict_mode =ON
6+ gtid_strict_mode =OFF
77binlog-row-image =MINIMAL
88read_only =ON
99report-host =mysql2
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ server-id=3
33log-bin =mysql-bin
44binlog-format =ROW
55log-slave-updates =ON
6- gtid_strict_mode =ON
6+ gtid_strict_mode =OFF
77binlog-row-image =MINIMAL
88read_only =ON
99report-host =mysql3
Original file line number Diff line number Diff line change @@ -40,10 +40,12 @@ echo "Verifying replication..."
4040for REPLICA in mysql2 mysql3; do
4141 for i in $( seq 1 60) ; do
4242 if echo " $MYSQL_FULL_VERSION " | grep -qi mariadb; then
43- STATUS=$( $COMPOSE exec -T " $REPLICA " mysql -uroot -ptestpass -e \
44- " SHOW SLAVE STATUS\G" 2> /dev/null | awk ' /Slave_IO_Running:/{print $2; exit}' | tr -d ' [:space:]' )
45- if [ " $STATUS " = " Yes" ]; then
46- echo " $REPLICA : replication OK (IO thread Yes)"
43+ IO=$( $COMPOSE exec -T " $REPLICA " mysql -uroot -ptestpass -e \
44+ " SHOW SLAVE STATUS\G" 2> /dev/null | awk -F' : *' ' /Slave_IO_Running:/{print $2; exit}' | tr -d ' [:space:]' )
45+ SQL=$( $COMPOSE exec -T " $REPLICA " mysql -uroot -ptestpass -e \
46+ " SHOW SLAVE STATUS\G" 2> /dev/null | awk -F' : *' ' /Slave_SQL_Running:/{print $2; exit}' | tr -d ' [:space:]' )
47+ if [ " $IO " = " Yes" ] && [ " $SQL " = " Yes" ]; then
48+ echo " $REPLICA : replication OK (IO+SQL Yes)"
4749 break
4850 fi
4951 else
Original file line number Diff line number Diff line change @@ -79,21 +79,17 @@ nudge_replica_threads() {
7979repoint_replica_to_mysql1 () {
8080 local r=" $1 "
8181 $COMPOSE exec -T " $r " mysql -uroot -ptestpass -e " STOP REPLICA; STOP SLAVE;" 2> /dev/null || true
82- # Skip RESET when possible — RESET wipes GTID state and often leaves SQL=No on MariaDB
83- # until positions are re-established. Prefer CHANGE + START first.
84- if ! $COMPOSE exec -T " $r " mysql -uroot -ptestpass -e "
82+ # RESET drops errant/local GTID history from prior failover tests.
83+ # MariaDB errno 1950: out-of-order GTID when gtid_slave_pos / strict mode conflict.
84+ $COMPOSE exec -T " $r " mysql -uroot -ptestpass -e " $RESET_REPLICA " 2> /dev/null || true
85+ if mysql_is_mariadb; then
86+ $COMPOSE exec -T " $r " mysql -uroot -ptestpass -e " SET GLOBAL gtid_slave_pos=''; SET GLOBAL gtid_strict_mode=OFF;" 2> /dev/null || true
87+ fi
88+ $COMPOSE exec -T " $r " mysql -uroot -ptestpass -e "
8589 $CHANGE_TO_MYSQL1
8690 SET GLOBAL read_only=1;
8791 $START_REPLICA
88- " 2> /dev/null; then
89- $COMPOSE exec -T " $r " mysql -uroot -ptestpass -e "
90- $STOP_REPLICA
91- $RESET_REPLICA
92- $CHANGE_TO_MYSQL1
93- SET GLOBAL read_only=1;
94- $START_REPLICA
95- " 2> /dev/null || true
96- fi
92+ " 2> /dev/null || true
9793 nudge_replica_threads " $r "
9894}
9995
You can’t perform that action at this time.
0 commit comments