From 3c687896f91e53e4b3eb1942f150d9abc2b437d3 Mon Sep 17 00:00:00 2001 From: Bitnami Bot Date: Thu, 7 Apr 2022 19:13:32 +0000 Subject: [PATCH] 8.0.28-debian-10-r62 release --- .../debian-10/rootfs/opt/bitnami/scripts/libmysql.sh | 5 +++++ .../debian-10/rootfs/opt/bitnami/scripts/mysql-env.sh | 10 ++++++++++ bitnami/mysql/README.md | 9 ++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/bitnami/mysql/8.0/debian-10/rootfs/opt/bitnami/scripts/libmysql.sh b/bitnami/mysql/8.0/debian-10/rootfs/opt/bitnami/scripts/libmysql.sh index ad6ca69bc80a..acb4a8f1aa50 100644 --- a/bitnami/mysql/8.0/debian-10/rootfs/opt/bitnami/scripts/libmysql.sh +++ b/bitnami/mysql/8.0/debian-10/rootfs/opt/bitnami/scripts/libmysql.sh @@ -154,6 +154,9 @@ pid_file=${DB_PID_FILE} max_allowed_packet=16M bind_address=${DB_DEFAULT_BIND_ADDRESS} log_error=${DB_LOGS_DIR}/mysqld.log +slow_query_log=${DB_ENABLE_SLOW_QUERY} +slow_query_log_file=${DB_LOGS_DIR}/mysqld.log +long_query_time=${DB_LONG_QUERY_TIME} character_set_server=${DB_DEFAULT_CHARACTER_SET} collation_server=${DB_DEFAULT_COLLATE} plugin_dir=${DB_BASE_DIR}/lib/plugin @@ -1249,6 +1252,8 @@ mysql_update_custom_config() { ! is_empty_value "$DB_BIND_ADDRESS" && mysql_conf_set "bind_address" "$DB_BIND_ADDRESS" ! is_empty_value "$DB_AUTHENTICATION_PLUGIN" && mysql_conf_set "default_authentication_plugin" "$DB_AUTHENTICATION_PLUGIN" ! is_empty_value "$DB_SQL_MODE" && mysql_conf_set "sql_mode" "$DB_SQL_MODE" + ! is_empty_value "$DB_ENABLE_SLOW_QUERY" && mysql_conf_set "slow_query_log" "$DB_ENABLE_SLOW_QUERY" + ! is_empty_value "$DB_LONG_QUERY_TIME" && mysql_conf_set "long_query_time" "$DB_LONG_QUERY_TIME" # Avoid exit code of previous commands to affect the result of this function true diff --git a/bitnami/mysql/8.0/debian-10/rootfs/opt/bitnami/scripts/mysql-env.sh b/bitnami/mysql/8.0/debian-10/rootfs/opt/bitnami/scripts/mysql-env.sh index c49c5a053591..ad4c913ab5aa 100644 --- a/bitnami/mysql/8.0/debian-10/rootfs/opt/bitnami/scripts/mysql-env.sh +++ b/bitnami/mysql/8.0/debian-10/rootfs/opt/bitnami/scripts/mysql-env.sh @@ -51,6 +51,10 @@ mysql_env_vars=( MYSQL_CLIENT_EXTRA_FLAGS MYSQL_STARTUP_WAIT_RETRIES MYSQL_STARTUP_WAIT_SLEEP_TIME + MYSQL_ENABLE_SLOW_QUERY + MYSQL_LONG_QUERY_TIME + DB_ENABLE_SLOW_QUERY + DB_LONG_QUERY_TIME ) for env_var in "${mysql_env_vars[@]}"; do file_env_var="${env_var}_FILE" @@ -156,5 +160,11 @@ export MYSQL_STARTUP_WAIT_RETRIES="${MYSQL_STARTUP_WAIT_RETRIES:-300}" export DB_STARTUP_WAIT_RETRIES="$MYSQL_STARTUP_WAIT_RETRIES" export MYSQL_STARTUP_WAIT_SLEEP_TIME="${MYSQL_STARTUP_WAIT_SLEEP_TIME:-2}" export DB_STARTUP_WAIT_SLEEP_TIME="$MYSQL_STARTUP_WAIT_SLEEP_TIME" +MYSQL_ENABLE_SLOW_QUERY="${MYSQL_ENABLE_SLOW_QUERY:-"${DB_ENABLE_SLOW_QUERY:-}"}" +export MYSQL_ENABLE_SLOW_QUERY="${MYSQL_ENABLE_SLOW_QUERY:-0}" +export DB_ENABLE_SLOW_QUERY="$MYSQL_ENABLE_SLOW_QUERY" +MYSQL_LONG_QUERY_TIME="${MYSQL_LONG_QUERY_TIME:-"${DB_LONG_QUERY_TIME:-}"}" +export MYSQL_LONG_QUERY_TIME="${MYSQL_LONG_QUERY_TIME:-10.0}" +export DB_LONG_QUERY_TIME="$MYSQL_LONG_QUERY_TIME" # Custom environment variables may be defined below diff --git a/bitnami/mysql/README.md b/bitnami/mysql/README.md index f8259e9ff1c1..25733a84e7f2 100644 --- a/bitnami/mysql/README.md +++ b/bitnami/mysql/README.md @@ -50,7 +50,7 @@ Non-root container images add an extra layer of security and are generally recom Learn more about the Bitnami tagging policy and the difference between rolling tags and immutable tags [in our documentation page](https://docs.bitnami.com/tutorials/understand-rolling-tags-containers/). -* [`8.0`, `8.0-debian-10`, `8.0.28`, `8.0.28-debian-10-r61`, `latest` (8.0/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-mysql/blob/8.0.28-debian-10-r61/8.0/debian-10/Dockerfile) +* [`8.0`, `8.0-debian-10`, `8.0.28`, `8.0.28-debian-10-r62`, `latest` (8.0/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-mysql/blob/8.0.28-debian-10-r62/8.0/debian-10/Dockerfile) * [`5.7`, `5.7-debian-10`, `5.7.37`, `5.7.37-debian-10-r77` (5.7/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-mysql/blob/5.7.37-debian-10-r77/5.7/debian-10/Dockerfile) Subscribe to project updates by watching the [bitnami/mysql GitHub repo](https://github.com/bitnami/bitnami-docker-mysql). @@ -521,6 +521,13 @@ $ docker-compose logs mysql You can configure the containers [logging driver](https://docs.docker.com/engine/admin/logging/overview/) using the `--log-driver` option if you wish to consume the container logs differently. In the default configuration docker uses the `json-file` driver. +### Slow query logs + +By default MySQL doesn't enable [slow query log](https://dev.mysql.com/doc/refman/8.0/en/slow-query-log.html) to record the SQL queries that take a long time to perform. You can modify these settings using the following environment variables: + +- `MYSQL_ENABLE_SLOW_QUERY`: Whether to enable slow query logs. Default: `0` +- `MYSQL_LONG_QUERY_TIME`: How much time, in seconds, defines a slow query. Default: `10.0` + ### Slow filesystems In some platforms, the filesystem used for persistence could be slow. That could cause the database to take extra time to be ready. If that's the case, you can configure the `MYSQL_INIT_SLEEP_TIME` environment variable to make the initialization script to wait extra time (in seconds) before proceeding with the configuration operations.