Skip to content

Commit 1b3781e

Browse files
committed
chore: rework post-start
1 parent f8ab819 commit 1b3781e

1 file changed

Lines changed: 17 additions & 4 deletions

File tree

jobs/pxc-replicator/templates/bin/post-start

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,25 @@
55
#it's a bash feature.
66
#https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html#index-SECONDS
77
SECONDS=0
8+
PATH="${PATH}:/var/vcap/packages/percona-xtradb-cluster-<%= p('mysql_version') -%>/bin"
89

9-
while [[ $SECONDS -lt <%= p('monit_startup_timeout') %> ]]; do
10+
log "starting post-start, checking replication"
11+
while [[ $SECONDS -lt 300 ]]; do
12+
if mysql --defaults-file=/var/vcap/jobs/pxc-mysql/config/mylogin.cnf <<< "SHOW REPLICA STATUS\G" | grep 'Replica_IO_Running: Yes'; then
13+
log "IO thread is running"
14+
else
15+
log "IO thread is running"
16+
continue
17+
fi
18+
19+
if mysql --defaults-file=/var/vcap/jobs/pxc-mysql/config/mylogin.cnf <<< "SHOW REPLICA STATUS\G" | grep 'Replica_SQL_Running: Yes'; then
20+
log "SQL thread is running"
21+
exit 0
22+
else
23+
log "SQL thread not running" && continue
24+
continue
25+
fi
1026
sleep 5
11-
mysql --defaults-file=/var/vcap/jobs/pxc-mysql/config/mylogin.cnf <<< "SHOW REPLICA STATUS\G" | grep 'Replica_IO_Running: Yes' || continue
12-
mysql --defaults-file=/var/vcap/jobs/pxc-mysql/config/mylogin.cnf <<< "SHOW REPLICA STATUS\G" | grep 'Replica_SQL_Running: Yes' || continue
13-
break
1427
done
1528

1629
log "timed out waiting for replication to report healthy"

0 commit comments

Comments
 (0)