Stop declaring a MySQL character set on magnum's tables.
Some tables declare mysql_DEFAULT_CHARSET='UTF8' (or, via models.table_args(), mysql_charset), others declare no charset at all and inherit the database's own default. From MariaDB 11.5 a bare CHARACTER SET clause stopped resolving to the same collation as the database default (MDEV-25829), so declared and undeclared tables can end up on different collations. nodegroup (undeclared) lands on utf8mb3_general_ci while cluster (declared) lands on utf8mb3_uca1400_ai_ci, and the join between them in nodegroups_v2 aborts every new deployment. Remove the charset declaration everywhere instead of adding it to the tables missing it, so every table consistently defers to the magnum database's own default character set and collation, which deployment tools already set consistently. This removes the per-statement resolution that MDEV-25829 changed, rather than relying on it resolving the same way for every declared table. Existing deployments are unaffected: the migrations that create these tables have already run for them, and this only changes the statement used to create a table for the first time. Related-Bug: #2121797 Change-Id: Ibc7fe2507b75653c79d09f6306a4c8df0b94bd35 Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
This commit is contained in:
1 parent
f902fbb59f
commit
ca853f5984
6 files changed
+28
-22
No files matched your search
@@ -45,8 +45,7 @@ def upgrade():
|
||||
sa.Column('minions_address', sa.Text(), nullable=True),
|
||||
sa.Column('stack_id', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_ENGINE='InnoDB',
|
||||
mysql_DEFAULT_CHARSET='UTF8'
|
||||
mysql_ENGINE='InnoDB'
|
||||
)
|
||||
op.create_table(
|
||||
'baymodel',
|
||||
@@ -62,8 +61,7 @@ def upgrade():
|
||||
sa.Column('dns_nameserver', String(255), nullable=True),
|
||||
sa.Column('apiserver_port', sa.Integer(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_ENGINE='InnoDB',
|
||||
mysql_DEFAULT_CHARSET='UTF8'
|
||||
mysql_ENGINE='InnoDB'
|
||||
)
|
||||
op.create_table(
|
||||
'container',
|
||||
@@ -74,8 +72,7 @@ def upgrade():
|
||||
sa.Column('name', sa.String(length=255), nullable=True),
|
||||
sa.Column('image_id', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_ENGINE='InnoDB',
|
||||
mysql_DEFAULT_CHARSET='UTF8'
|
||||
mysql_ENGINE='InnoDB'
|
||||
)
|
||||
op.create_table(
|
||||
'node',
|
||||
@@ -87,8 +84,7 @@ def upgrade():
|
||||
sa.Column('image_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('ironic_node_id', sa.String(length=36), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_ENGINE='InnoDB',
|
||||
mysql_DEFAULT_CHARSET='UTF8'
|
||||
mysql_ENGINE='InnoDB'
|
||||
)
|
||||
op.create_table(
|
||||
'pod',
|
||||
@@ -103,8 +99,7 @@ def upgrade():
|
||||
sa.Column('labels', sa.Text(), nullable=True),
|
||||
sa.Column('status', sa.String(length=255), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_ENGINE='InnoDB',
|
||||
mysql_DEFAULT_CHARSET='UTF8'
|
||||
mysql_ENGINE='InnoDB'
|
||||
)
|
||||
op.create_table(
|
||||
'service',
|
||||
@@ -119,8 +114,7 @@ def upgrade():
|
||||
sa.Column('ip', sa.String(length=36), nullable=True),
|
||||
sa.Column('port', sa.Integer(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_ENGINE='InnoDB',
|
||||
mysql_DEFAULT_CHARSET='UTF8'
|
||||
mysql_ENGINE='InnoDB'
|
||||
)
|
||||
op.create_table(
|
||||
'replicationcontroller',
|
||||
@@ -134,7 +128,6 @@ def upgrade():
|
||||
sa.Column('labels', sa.Text(), nullable=True),
|
||||
sa.Column('replicas', sa.Integer(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_ENGINE='InnoDB',
|
||||
mysql_DEFAULT_CHARSET='UTF8'
|
||||
mysql_ENGINE='InnoDB'
|
||||
)
|
||||
# end Alembic commands
|
||||
@@ -43,8 +43,7 @@ def upgrade():
|
||||
sa.Column('project_id', sa.String(length=255), nullable=True),
|
||||
sa.Column('user_id', sa.String(length=255), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_ENGINE='InnoDB',
|
||||
mysql_DEFAULT_CHARSET='UTF8'
|
||||
mysql_ENGINE='InnoDB'
|
||||
)
|
||||
op.create_unique_constraint("uniq_x509keypair0uuid",
|
||||
"x509keypair", ["uuid"])
|
||||
@@ -35,6 +35,5 @@ def upgrade():
|
||||
sa.Column('bay_uuid', sa.String(length=36), nullable=True),
|
||||
sa.Column('conductor_id', sa.String(length=64), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_ENGINE='InnoDB',
|
||||
mysql_DEFAULT_CHARSET='UTF8'
|
||||
mysql_ENGINE='InnoDB'
|
||||
)
|
||||
@@ -38,8 +38,7 @@ def upgrade():
|
||||
sa.Column('resource', sa.String(length=255), nullable=True),
|
||||
sa.Column('hard_limit', sa.Integer(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
mysql_ENGINE='InnoDB',
|
||||
mysql_DEFAULT_CHARSET='UTF8'
|
||||
mysql_ENGINE='InnoDB'
|
||||
)
|
||||
op.create_unique_constraint(
|
||||
"uniq_quotas0project_id0resource",
|
||||
|
||||
@@ -36,8 +36,7 @@ CONF = magnum.conf.CONF
|
||||
def table_args():
|
||||
engine_name = urlparse.urlparse(CONF.database.connection).scheme
|
||||
if engine_name == 'mysql':
|
||||
return {'mysql_engine': CONF.database.mysql_engine,
|
||||
'mysql_charset': "utf8"}
|
||||
return {'mysql_engine': CONF.database.mysql_engine}
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Magnum's tables no longer declare an explicit ``UTF8`` character set in
|
||||
their creation migrations, and ``models.table_args()`` no longer passes
|
||||
``mysql_charset``. All tables now defer to the ``magnum`` database's own
|
||||
default character set and collation, as deployment tools already create
|
||||
it consistently. Previously, some tables declared a bare ``CHARACTER
|
||||
SET`` and others declared none at all. From MariaDB 11.5 a bare
|
||||
``CHARACTER SET`` stopped resolving to the same collation as the
|
||||
database default (MDEV-25829), so a table that declared the charset and
|
||||
one that did not could end up with different collations. This broke new
|
||||
deployments in the ``nodegroups_v2`` migration, which joins the
|
||||
``nodegroup`` and ``cluster`` tables, with ``Illegal mix of collations
|
||||
(utf8mb3_general_ci,IMPLICIT) and (utf8mb3_uca1400_ai_ci,IMPLICIT) for
|
||||
operation '='``. Existing deployments are unaffected, because the
|
||||
migrations that create these tables have already run for them.
|
||||
Reference in new issue
Block a user