diff --git a/mariadb/CHANGELOG.md b/mariadb/CHANGELOG.md index 8ab5abb00dc..803fa242323 100644 --- a/mariadb/CHANGELOG.md +++ b/mariadb/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2.7.2 + +- Add option to configure MariaDB server parameters (see also [home-assistant/addons#3754](https://github.com/home-assistant/addons/issues/3754)) + ## 2.7.1 **Note:** Restart the add-on before upgrade if the current version is lower diff --git a/mariadb/DOCS.md b/mariadb/DOCS.md index 39c9912700a..f2b49c7176c 100644 --- a/mariadb/DOCS.md +++ b/mariadb/DOCS.md @@ -74,6 +74,13 @@ If omitted, grants `ALL PRIVILEGES` to the user. Restricting privileges of the u that Home Assistant uses is not recommended but if you want to allow other applications to view recorder data should create a user limited to read-only access on the database. +### Option: `mariadb_server_args` (optional) + +Some users have experienced [errors][migration-issues] during Home Assistant schema updates on large databases. +Defining the recommended parameters can help if there is RAM available. + +Example: `--innodb_buffer_pool_size=512M` + ## Home Assistant Configuration MariaDB will be used by the `recorder` and `history` components within Home Assistant. For more information about setting this up, see the [recorder integration][mariadb-ha-recorder] documentation for Home Assistant. @@ -101,6 +108,7 @@ In case you've found a bug, please [open an issue on our GitHub][issue]. [username]: https://mariadb.com/kb/en/create-user/#user-name-component [hostname]: https://mariadb.com/kb/en/create-user/#host-name-component [grant]: https://mariadb.com/kb/en/grant/ +[migration-issues]: https://github.com/home-assistant/core/issues/125339 [mariadb-ha-recorder]: https://www.home-assistant.io/integrations/recorder/ [discord]: https://discord.gg/c5DvZ4e [forum]: https://community.home-assistant.io diff --git a/mariadb/config.yaml b/mariadb/config.yaml index 14688a86655..828018ecd71 100644 --- a/mariadb/config.yaml +++ b/mariadb/config.yaml @@ -1,5 +1,5 @@ --- -version: 2.7.1 +version: 2.7.2 slug: mariadb name: MariaDB description: A SQL database server @@ -38,6 +38,8 @@ schema: CREATE VIEW|DELETE|DELETE HISTORY|DROP|EVENT|GRANT OPTION|INDEX|\ INSERT|LOCK TABLES|SELECT|SHOW VIEW|TRIGGER|UPDATE)?" username: str + mariadb_server_args: + - str? services: - mysql:provide startup: system diff --git a/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/run b/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/run index e486c2bf296..ddab749c6f8 100755 --- a/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/run +++ b/mariadb/rootfs/etc/s6-overlay/s6-rc.d/mariadb-core/run @@ -4,7 +4,18 @@ # Start MariaDB service # ============================================================================== +if bashio::config.has_value "mariadb_server_args"; then + readarray -t extra_args <<< "$(bashio::config 'mariadb_server_args')" + bashio::log.info "Starting MariaDB with command line parameters: ${extra_args[*]}" +else + bashio::log.info "Starting MariaDB" +fi + # Start mariadb -bashio::log.info "Starting MariaDB" mkdir -p /run/mysqld -exec mysqld --datadir="${MARIADB_DATA}" --user=root < /dev/null + +if [ -z "${extra_args+x}" ] || [ ${#extra_args[@]} -eq 0 ]; then + exec mysqld --datadir="${MARIADB_DATA}" --user=root < /dev/null +else + exec mysqld --datadir="${MARIADB_DATA}" --user=root "${extra_args[@]}" < /dev/null +fi