puppetlabs / puppetlabs-mysql

MySQL Puppet Module / Manifests + Types & Providers
Apache License 2.0
380 stars 792 forks source link

Detect MariaDB's 10.6 utf8mb3 as an alias of utf8 #1507

Open NITEMAN opened 1 year ago

NITEMAN commented 1 year ago

Use Case

Coming form 10.x series, we have several db resources (some of them created by 3rd party modules) which defaulted to mariadb system's charset&collation (in our case utf8mb3 and utf8mb3_general_ci from vendors MariaDB 10.6.10 over Bullseye). That charset seems to be current MariaDB's alias for utf8.

Updating to 13.x series causes a lot of module's action trying to fix charset&collation but resulting in no changes, for example:

Notice: /Stage[main]/Keycloak::Db::Mysql/Mysql::Db[keycloak]/Mysql_database[keycloak]/charset: charset changed 'utf8mb3' to 'utf8'
Notice: /Stage[main]/Keycloak::Db::Mysql/Mysql::Db[keycloak]/Mysql_database[keycloak]/collate: collate changed 'utf8mb3_general_ci' to 'utf8_general_ci' (corrective)
Info: Class[Keycloak::Db::Mariadb]: Scheduling refresh of Class[Keycloak::Service]
Info: Class[Keycloak::Service]: Scheduling refresh of Systemd::Unit_file[keycloak.service]
Info: Class[Keycloak::Service]: Scheduling refresh of Service[keycloak]

BTW, I'll open an issue on that module to allow setting db collation

Describe the Solution You Would Like

The module detects utf8mb3 as an alias of utf8 and utf8mb3_general_ci as an alias of utf8_general_ci

Describe Alternatives You've Considered

Right now we have setted a resource default:

Mysql::Db {
  charset => lookup('_mysql::defaults::db.charset', String, undef, 'utf8'),
  collate => lookup('_mysql::defaults::db.collate', String, undef, 'utf8_general_ci'),
}

Additional Context

None