Skip to content

Commit bdf762a

Browse files
committed
wl12360: Use new --validate-config option for 8.0
Using --verbose --help to check if the server config is valid no longer has any effect for 8.0, but the new --validate-config option has been added to explicitly check the server config
1 parent df21f5c commit bdf762a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

gen_dockerfiles.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ DEFAULT_LOG["5.6"]=""
7878
DEFAULT_LOG["5.7"]=""
7979
DEFAULT_LOG["8.0"]="console"
8080

81+
# MySQL 8.0 supports a call to validate the config, while older versions have it as a side
82+
# effect of running --verbose --help
83+
declare -A VALIDATE_CONFIG
84+
VALIDATE_CONFIG["5.6"]="output=$(\"$@\" --verbose --help 2>&1 > /dev/null) || result=$?"
85+
VALIDATE_CONFIG["5.7"]="output=$(\"$@\" --verbose --help 2>&1 > /dev/null) || result=$?"
86+
VALIDATE_CONFIG["8.0"]="output=$(\"$@\" --validate-config) || result=$?"
8187

8288
for VERSION in "${!MYSQL_SERVER_VERSIONS[@]}"
8389
do
@@ -119,6 +125,7 @@ do
119125
sed -i 's#%%STARTUP_WAIT%%#'"${STARTUP_WAIT[${VERSION}]}"'#g' tmpfile
120126
sed -i 's#%%FULL_SERVER_VERSION%%#'"${FULL_SERVER_VERSIONS[${VERSION}]}"'#g' tmpfile
121127
sed -i 's#%%DEFAULT_LOG%%#'"${DEFAULT_LOG[${VERSION}]}"'#g' tmpfile
128+
sed -i 's#%%VALIDATE_CONFIG%%#'"${VALIDATE_CONFIG[${VERSION}]}"'#g' tmpfile
122129
mv tmpfile ${VERSION}/docker-entrypoint.sh
123130
chmod +x ${VERSION}/docker-entrypoint.sh
124131

template/docker-entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if [ "$1" = 'mysqld' ]; then
3535
# Test that the server can start. We redirect stdout to /dev/null so
3636
# only the error messages are left.
3737
result=0
38-
output=$("$@" --verbose --help 2>&1 > /dev/null) || result=$?
38+
%%VALIDATE_CONFIG%%
3939
if [ ! "$result" = "0" ]; then
4040
echo >&2 '[Entrypoint] ERROR: Unable to start MySQL. Please check your configuration.'
4141
echo >&2 "[Entrypoint] $output"

0 commit comments

Comments
 (0)