Browse code

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

Roman Podoliaka authored on 2017/02/07 20:34:12
Showing 1 changed files
... ...
@@ -94,7 +94,7 @@ function configure_database_mysql {
94 94
     # Change bind-address from localhost (127.0.0.1) to any (::) and
95 95
     # set default db type to InnoDB
96 96
     iniset -sudo $my_conf mysqld bind-address "$SERVICE_LISTEN_ADDRESS"
97
-    iniset -sudo $my_conf mysqld sql_mode STRICT_ALL_TABLES
97
+    iniset -sudo $my_conf mysqld sql_mode TRADITIONAL
98 98
     iniset -sudo $my_conf mysqld default-storage-engine InnoDB
99 99
     iniset -sudo $my_conf mysqld max_connections 1024
100 100
     iniset -sudo $my_conf mysqld query_cache_type OFF