From 88b84094ec1e2a18b6edba91f510cae53bc9c821 Mon Sep 17 00:00:00 2001 From: Roman Podoliaka Date: Tue, 7 Feb 2017 13:34:12 +0200 Subject: [PATCH] mysql: set default sql_mode to TRADITIONAL We currently use a more permisive STRICT_ALL_TABLES mode, but that's not what modern MySQL versions default to (i.e. TRADITIONAL): https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sql-mode-changes (non-Devstack deployments will most likely use TRADITIONAL as well) Due to the fact that we default to TRADITIONAL in oslo.db, this produces annoying warnings on MySQL 5.7 versions we use in the gate: Warning: (3090, u"Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.") https://git.openstack.org/cgit/openstack/oslo.db/tree/oslo_db/options.py#n49 Unlike STRICT_ALL_TABLES, TRADITIONAL mode includes NO_AUTO_CREATE_USER, and MySQL emits this warning on switching it on: https://dev.mysql.com/worklog/task/?id=8326 So we have two options here: 1) make oslo.db default to STRICT_ALL_TABLES 2) make Devstack default to TRADITIONAL The latter seems to be more appropriate as: 1) it's what modern MySQL versions default to 2) it's what people are actually using, if they do not override the oslo.db default 3) it's more strict Closes-Bug: #1652452 Change-Id: Ie6d823c9f8465ac9f2ce4825929d1a50438fab45 --- lib/databases/mysql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/databases/mysql b/lib/databases/mysql index 89ae082c81..7bbcace399 100644 --- a/lib/databases/mysql +++ b/lib/databases/mysql @@ -94,7 +94,7 @@ function configure_database_mysql { # Change bind-address from localhost (127.0.0.1) to any (::) and # set default db type to InnoDB iniset -sudo $my_conf mysqld bind-address "$SERVICE_LISTEN_ADDRESS" - iniset -sudo $my_conf mysqld sql_mode STRICT_ALL_TABLES + iniset -sudo $my_conf mysqld sql_mode TRADITIONAL iniset -sudo $my_conf mysqld default-storage-engine InnoDB iniset -sudo $my_conf mysqld max_connections 1024 iniset -sudo $my_conf mysqld query_cache_type OFF