summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tupitsyn <michael.tupitsyn@suse.com>2017-07-03 11:51:21 -0700
committerMichael Tupitsyn <michael.tupitsyn@suse.com>2017-07-17 15:55:23 +0000
commita98c687cf08c4cae382606a89e0e62fdbbaf77a8 (patch)
treece6c815864f2c8fbf477ed7911e5c84cb8e7eb3e
parentd7574ac1fd1a2113f2e463956a458a255ffcc948 (diff)
downloadironic-a98c687cf08c4cae382606a89e0e62fdbbaf77a8.tar.gz
Force InnoDB engine on interfaces table
If the system is set to use MyISAM engine as default, during upgrade a new conductor_hardware_interfaces table will be created with MyISAM engine. This will cause a mix of InnoDB and MyISAM tables in single database, and obsolete a foreign key to conductors table. This bug in particular fails test_models_sync unit test, when it is executed on a system, where MyISAM is set as default option for local MySQL server. Change-Id: Ic47426b1a12eda5728e9971a27ad3767c0245d50 Closes-Bug: 1702158 (cherry picked from commit 1a0c7091a6bb5ab8ca83ad6a7244fcb84c7f99b4)
-rw-r--r--ironic/db/sqlalchemy/alembic/versions/2353895ecfae_add_conductor_hardware_interfaces_table.py4
-rw-r--r--releasenotes/notes/bug-1702158-79bf57bd4d8087b6.yaml22
2 files changed, 25 insertions, 1 deletions
diff --git a/ironic/db/sqlalchemy/alembic/versions/2353895ecfae_add_conductor_hardware_interfaces_table.py b/ironic/db/sqlalchemy/alembic/versions/2353895ecfae_add_conductor_hardware_interfaces_table.py
index a8a792292..8880401a2 100644
--- a/ironic/db/sqlalchemy/alembic/versions/2353895ecfae_add_conductor_hardware_interfaces_table.py
+++ b/ironic/db/sqlalchemy/alembic/versions/2353895ecfae_add_conductor_hardware_interfaces_table.py
@@ -44,4 +44,6 @@ def upgrade():
sa.UniqueConstraint(
'conductor_id', 'hardware_type',
'interface_type', 'interface_name',
- name='uniq_conductorhardwareinterfaces0'))
+ name='uniq_conductorhardwareinterfaces0'),
+ mysql_charset='utf8',
+ mysql_engine='InnoDB')
diff --git a/releasenotes/notes/bug-1702158-79bf57bd4d8087b6.yaml b/releasenotes/notes/bug-1702158-79bf57bd4d8087b6.yaml
new file mode 100644
index 000000000..fe7ba44c6
--- /dev/null
+++ b/releasenotes/notes/bug-1702158-79bf57bd4d8087b6.yaml
@@ -0,0 +1,22 @@
+---
+fixes:
+ - |
+ Fixes a bug 1702158, where the wrong database engine is used for the
+ conductor_hardware_interfaces table, if the system is using MySQL prior to
+ version 5.5 (or the default_storage_engine option is set explicitly to
+ 'MyISAM' in my.cnf). In this case, a table could be created with MyISAM
+ engine and foreign key constraint conductor_id(conductors.id) ignored.
+upgrade:
+ - |
+ Due to a bug 1702158, conductor_hardware_interfaces table could be created
+ with MyISAM database engine, while all other tables in ironic database are
+ using InnoDB engine. This could happen during initial installation, or
+ upgrade to ocata release, if the system is using MySQL prior to version 5.5
+ (or the default_storage_engine option is set explicitly to 'MyISAM' in
+ my.cnf). If this is the case, conductor_hardware_interfaces needs to be
+ manually migrated to InnoDB, and foreign key constraint re-created::
+
+ alter table conductor_hardware_interfaces engine='InnoDB';
+ alter table conductor_hardware_interfaces
+ add constraint conductor_hardware_interfaces_ibfk_1
+ foreign key (conductor_id) references conductors(id); \ No newline at end of file