This issue has been created
There are 4 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-1a132e46-b911-40cc-b275-161432add97e XWIKI-25441 In Progress

Make sure all MySQL/MariaDB tables use the collation configured on the database

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-66a68f12-82b7-4ed9-a6c2-975249222a59 Thomas Mortagne created this issue on 21/Oct/26 17:16
 
Summary: Make sure all MySQL/MariaDB tables use the collation configured on the database
Issue Type: cid:jira-generated-image-avatar-1a132e46-b911-40cc-b275-161432add97e Improvement
Affects Versions: 17.10.14
Assignee: Unassigned
Components: Storage
Created: 21/Oct/26 17:16
Priority: cid:jira-generated-image-static-major-7e4950a5-f388-47cf-88a0-73a7296301eb Major
Reporter: Thomas Mortagne
Description:

Problem

On MySQL and MariaDB, a table takes the default collation of its database at the moment it is created (Hibernate does not set any). An instance which went through upgrades, dump/restore cycles or extension installs often ends up with a mix of collations: most tables use the collation configured on the database (e.g. utf8mb4_bin) but a few still use an older one (e.g. utf8_general_ci, utf8mb4_general_ci).

Such tables cause subtle problems: case-insensitive collisions between references which differ only in case, characters that cannot be stored when the table is still on a 3-byte charset, joins and foreign keys between columns with different collations, etc. Fixing it by hand is not trivial, since MariaDB refuses to convert a column used in a foreign key, even with FOREIGN_KEY_CHECKS=0.

Proposal

Add a Hibernate data migration, for MySQL and MariaDB only, which converts each table of the Hibernate mapping whose default collation or one of its columns does not match the collation configured on the database (CONVERT TO CHARACTER SET ... COLLATE ...):

  • the conversion is done before the Hibernate schema update, after dropping the foreign keys involving string columns of the tables to convert, so that the schema update re-creates them
  • the tables linked by such a foreign key are converted together and a failure is fatal, since the foreign key could not be re-created between columns with different collations
  • a failure on any other table (e.g. a custom index too long for the new charset) does not prevent XWiki from starting: the table is left as it was and a warning lists the tables which could not be converted
 
 

4 updates

 
cid:jira-generated-image-avatar-66a68f12-82b7-4ed9-a6c2-975249222a59 Changes by Thomas Mortagne on 21/Oct/26 17:16
 
Fix Version: 18.10.0-rc-1
Fix Version: 18.10.0-rc-1
Assignee: Thomas Mortagne
Status: Open In Progress