Skip to content

Commit e11411f

Browse files
committed
fix(infra): use 'mysql -E -e STATEMENT' instead of 'mysql -e STATEMENT\G'
MySQL 9.5.0 client (no longer?) accepts '\G' as a statement terminator when the statement is passed via '-e': $ mysql -e 'SHOW REPLICA STATUS\G' ERROR at line 1: Unknown command '\G'. '\G' still works interactively, and still works in -e on 8.4 and 9.0.1. This is a silent behavior change in the 9.5 client binary. (The 9.0.1 client in the same tarball tree handles '\G' fine.) docker-mysql-post.bash uses this to query replication status after container startup. Under 9.5, the mysql command exits non-zero, the captured output is empty, the subsequent grep in a pipeline returns 1, and set -e + pipefail kill docker-mysql-post.bash. That in turn kills docker-compose-init.bash which kills ensure-infras.bash. Net effect: every mysql95 / mysql95-binlog group fails before running a single test, logging just: Verifying MySQL on ...:3308... OK Checking replication on port 3307... (stops here) Fix: switch from '-e "SHOW REPLICA STATUS\G"' to '-E -e "SHOW REPLICA STATUS"'. '-E' (a.k.a. --vertical) has been supported by mysql(1) since 3.x, works identically on MariaDB 10, MySQL 5.7 / 8.4 / 9.0 / 9.5. The grep/awk that extracts Replica_IO_Running and Replica_SQL_Running keeps working unchanged since the vertical output format is the same. Applied to all 10 docker-mysql-post.bash files under test/infra/infra-dbdeployer-*. No change needed to the ci-infra Docker images — docker-mysql-post.bash runs on the host after the container starts.
1 parent bee37b2 commit e11411f

10 files changed

Lines changed: 10 additions & 10 deletions

File tree

test/infra/infra-dbdeployer-mariadb10/bin/docker-mysql-post.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ done
3131
# Verify replication is working on nodes 2 and 3
3232
for PORT in 3307 3308; do
3333
echo -n "Checking replication on port ${PORT}..."
34-
SLAVE_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -e "SHOW SLAVE STATUS\G" 2>/dev/null)
34+
SLAVE_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -E -e "SHOW SLAVE STATUS" 2>/dev/null)
3535
IO_RUNNING=$(echo "${SLAVE_STATUS}" | grep "Slave_IO_Running:" | awk '{print $2}')
3636
SQL_RUNNING=$(echo "${SLAVE_STATUS}" | grep "Slave_SQL_Running:" | awk '{print $2}')
3737
if [ "${IO_RUNNING}" = "Yes" ] && [ "${SQL_RUNNING}" = "Yes" ]; then

test/infra/infra-dbdeployer-mysql57-binlog/bin/docker-mysql-post.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ done
3434
# Verify replication is working on nodes 2 and 3
3535
for PORT in 3307 3308; do
3636
echo -n "Checking replication on port ${PORT}..."
37-
SLAVE_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -e "SHOW SLAVE STATUS\G" 2>/dev/null)
37+
SLAVE_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -E -e "SHOW SLAVE STATUS" 2>/dev/null)
3838
IO_RUNNING=$(echo "${SLAVE_STATUS}" | grep "Slave_IO_Running:" | awk '{print $2}')
3939
SQL_RUNNING=$(echo "${SLAVE_STATUS}" | grep "Slave_SQL_Running:" | awk '{print $2}')
4040
if [ "${IO_RUNNING}" = "Yes" ] && [ "${SQL_RUNNING}" = "Yes" ]; then

test/infra/infra-dbdeployer-mysql57/bin/docker-mysql-post.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ done
3434
# Verify replication is working on nodes 2 and 3
3535
for PORT in 3307 3308; do
3636
echo -n "Checking replication on port ${PORT}..."
37-
SLAVE_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -e "SHOW SLAVE STATUS\G" 2>/dev/null)
37+
SLAVE_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -E -e "SHOW SLAVE STATUS" 2>/dev/null)
3838
IO_RUNNING=$(echo "${SLAVE_STATUS}" | grep "Slave_IO_Running:" | awk '{print $2}')
3939
SQL_RUNNING=$(echo "${SLAVE_STATUS}" | grep "Slave_SQL_Running:" | awk '{print $2}')
4040
if [ "${IO_RUNNING}" = "Yes" ] && [ "${SQL_RUNNING}" = "Yes" ]; then

test/infra/infra-dbdeployer-mysql84-binlog/bin/docker-mysql-post.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ done
3434
# Verify replication is working on nodes 2 and 3
3535
for PORT in 3307 3308; do
3636
echo -n "Checking replication on port ${PORT}..."
37-
SLAVE_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -e "SHOW REPLICA STATUS\G" 2>/dev/null)
37+
SLAVE_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -E -e "SHOW REPLICA STATUS" 2>/dev/null)
3838
IO_RUNNING=$(echo "${SLAVE_STATUS}" | grep "Replica_IO_Running:" | awk '{print $2}')
3939
SQL_RUNNING=$(echo "${SLAVE_STATUS}" | grep "Replica_SQL_Running:" | awk '{print $2}')
4040
if [ "${IO_RUNNING}" = "Yes" ] && [ "${SQL_RUNNING}" = "Yes" ]; then

test/infra/infra-dbdeployer-mysql84/bin/docker-mysql-post.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ done
3434
# Verify replication is working on nodes 2 and 3
3535
for PORT in 3307 3308; do
3636
echo -n "Checking replication on port ${PORT}..."
37-
REPLICA_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -e "SHOW REPLICA STATUS\G" 2>/dev/null)
37+
REPLICA_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -E -e "SHOW REPLICA STATUS" 2>/dev/null)
3838
IO_RUNNING=$(echo "${REPLICA_STATUS}" | grep "Replica_IO_Running:" | awk '{print $2}')
3939
SQL_RUNNING=$(echo "${REPLICA_STATUS}" | grep "Replica_SQL_Running:" | awk '{print $2}')
4040
if [ "${IO_RUNNING}" = "Yes" ] && [ "${SQL_RUNNING}" = "Yes" ]; then

test/infra/infra-dbdeployer-mysql90-binlog/bin/docker-mysql-post.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ done
3434
# Verify replication is working on nodes 2 and 3
3535
for PORT in 3307 3308; do
3636
echo -n "Checking replication on port ${PORT}..."
37-
SLAVE_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -e "SHOW REPLICA STATUS\G" 2>/dev/null)
37+
SLAVE_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -E -e "SHOW REPLICA STATUS" 2>/dev/null)
3838
IO_RUNNING=$(echo "${SLAVE_STATUS}" | grep "Replica_IO_Running:" | awk '{print $2}')
3939
SQL_RUNNING=$(echo "${SLAVE_STATUS}" | grep "Replica_SQL_Running:" | awk '{print $2}')
4040
if [ "${IO_RUNNING}" = "Yes" ] && [ "${SQL_RUNNING}" = "Yes" ]; then

test/infra/infra-dbdeployer-mysql90/bin/docker-mysql-post.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ done
3434
# Verify replication is working on nodes 2 and 3
3535
for PORT in 3307 3308; do
3636
echo -n "Checking replication on port ${PORT}..."
37-
REPLICA_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -e "SHOW REPLICA STATUS\G" 2>/dev/null)
37+
REPLICA_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -E -e "SHOW REPLICA STATUS" 2>/dev/null)
3838
IO_RUNNING=$(echo "${REPLICA_STATUS}" | grep "Replica_IO_Running:" | awk '{print $2}')
3939
SQL_RUNNING=$(echo "${REPLICA_STATUS}" | grep "Replica_SQL_Running:" | awk '{print $2}')
4040
if [ "${IO_RUNNING}" = "Yes" ] && [ "${SQL_RUNNING}" = "Yes" ]; then

test/infra/infra-dbdeployer-mysql93/bin/docker-mysql-post.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ done
3434
# Verify replication is working on nodes 2 and 3
3535
for PORT in 3307 3308; do
3636
echo -n "Checking replication on port ${PORT}..."
37-
REPLICA_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -e "SHOW REPLICA STATUS\G" 2>/dev/null)
37+
REPLICA_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -E -e "SHOW REPLICA STATUS" 2>/dev/null)
3838
IO_RUNNING=$(echo "${REPLICA_STATUS}" | grep "Replica_IO_Running:" | awk '{print $2}')
3939
SQL_RUNNING=$(echo "${REPLICA_STATUS}" | grep "Replica_SQL_Running:" | awk '{print $2}')
4040
if [ "${IO_RUNNING}" = "Yes" ] && [ "${SQL_RUNNING}" = "Yes" ]; then

test/infra/infra-dbdeployer-mysql95-binlog/bin/docker-mysql-post.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ done
3434
# Verify replication is working on nodes 2 and 3
3535
for PORT in 3307 3308; do
3636
echo -n "Checking replication on port ${PORT}..."
37-
SLAVE_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -e "SHOW REPLICA STATUS\G" 2>/dev/null)
37+
SLAVE_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -E -e "SHOW REPLICA STATUS" 2>/dev/null)
3838
IO_RUNNING=$(echo "${SLAVE_STATUS}" | grep "Replica_IO_Running:" | awk '{print $2}')
3939
SQL_RUNNING=$(echo "${SLAVE_STATUS}" | grep "Replica_SQL_Running:" | awk '{print $2}')
4040
if [ "${IO_RUNNING}" = "Yes" ] && [ "${SQL_RUNNING}" = "Yes" ]; then

test/infra/infra-dbdeployer-mysql95/bin/docker-mysql-post.bash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ done
3434
# Verify replication is working on nodes 2 and 3
3535
for PORT in 3307 3308; do
3636
echo -n "Checking replication on port ${PORT}..."
37-
REPLICA_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -e "SHOW REPLICA STATUS\G" 2>/dev/null)
37+
REPLICA_STATUS=$(docker exec "${CONTAINER}" mysql -h127.0.0.1 -P${PORT} -uroot -p"${ROOT_PASSWORD}" -E -e "SHOW REPLICA STATUS" 2>/dev/null)
3838
IO_RUNNING=$(echo "${REPLICA_STATUS}" | grep "Replica_IO_Running:" | awk '{print $2}')
3939
SQL_RUNNING=$(echo "${REPLICA_STATUS}" | grep "Replica_SQL_Running:" | awk '{print $2}')
4040
if [ "${IO_RUNNING}" = "Yes" ] && [ "${SQL_RUNNING}" = "Yes" ]; then

0 commit comments

Comments
 (0)