Skip to content

Commit

Permalink
wl12360: Use new --validate-config option for 8.0
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ltangvald committed Mar 13, 2019
1 parent df21f5c commit bdf762a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions gen_dockerfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ DEFAULT_LOG["5.6"]=""
DEFAULT_LOG["5.7"]=""
DEFAULT_LOG["8.0"]="console"

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

for VERSION in "${!MYSQL_SERVER_VERSIONS[@]}"
do
Expand Down Expand Up @@ -119,6 +125,7 @@ do
sed -i 's#%%STARTUP_WAIT%%#'"${STARTUP_WAIT[${VERSION}]}"'#g' tmpfile
sed -i 's#%%FULL_SERVER_VERSION%%#'"${FULL_SERVER_VERSIONS[${VERSION}]}"'#g' tmpfile
sed -i 's#%%DEFAULT_LOG%%#'"${DEFAULT_LOG[${VERSION}]}"'#g' tmpfile
sed -i 's#%%VALIDATE_CONFIG%%#'"${VALIDATE_CONFIG[${VERSION}]}"'#g' tmpfile
mv tmpfile ${VERSION}/docker-entrypoint.sh
chmod +x ${VERSION}/docker-entrypoint.sh

Expand Down
2 changes: 1 addition & 1 deletion template/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if [ "$1" = 'mysqld' ]; then
# Test that the server can start. We redirect stdout to /dev/null so
# only the error messages are left.
result=0
output=$("$@" --verbose --help 2>&1 > /dev/null) || result=$?
%%VALIDATE_CONFIG%%
if [ ! "$result" = "0" ]; then
echo >&2 '[Entrypoint] ERROR: Unable to start MySQL. Please check your configuration.'
echo >&2 "[Entrypoint] $output"
Expand Down

0 comments on commit bdf762a

Please sign in to comment.