Problème de Collation 'utf8_general_ci'

Request description

Bonjour,

Je fais face à un problème de collation dans ma base de données qui semble être apparu sans raison apparente. Je n’ai pas utilisé de caractères spéciaux ni effectué de modifications récentes qui pourraient expliquer ce problème. Cependant, des erreurs liées à la collation commencent à apparaître : COLLATION ‘utf8_general_ci’ is not valid for CHARACTER SET ‘utf8mb4’

Je pense qu’il pourrait être judicieux de réappliquer les paramètres de collation par défaut pour résoudre ce problème. Cependant, avant de procéder à cette opération, j’aimerais faire un dump de ma base de données. Malheureusement, je n’ai pas accès à la console SQL pour faire tout ça proprement.

Auriez-vous une solution à me proposer à ce niveau là ?

Je suis également curieux de savoir pourquoi ce problème se produit et s’il existe des meilleures pratiques ou des mesures de prévention que je pourrais suivre pour éviter de rencontrer ce problème à l’avenir.

Merci d’avance pour vos éclaircissements et vos conseils.

Cordialement,
Elyass

Technical information

[Platform]
Status=OK
Version=5.3.12
BuiltOn=2023-08-25 09:44
Git=5.3/e2cd9f0ea850e3845169840790a1a6ef043fed16
Encoding=UTF-8
EndpointIP=149.202.171.75
EndpointURL=http://renault.simplicite.io:10488
TimeZone=Europe/Paris
SystemDate=2023-08-28 12:09:55

Bonjour,

Votre problème n’est pas récent :

Pour faire des tests d’égalité “unicode étendu”, il faut que les collations soient homogènes entre vos colonnes : utf8mb4.
Il faut regarder dans le support MySQL comment faire cet ALTER.
Pour avoir un accès SQL pour faire un dump et changer la collation globalement, voyez avec votre support technique / DBA, car nous n’hébergeons pas vos applications.

Bonjour François,

oui en effet le pb est connu mais cette fois il s’agit d’une instance montée sur l’environnement SIM renault.simplicite.io. Du coup on essaye de solliciter le support :wink:

A priori, aucune opération n’a été réalisée sur la couche BD de notre côté; l’instance a été mise en ligne en juillet.

Pour poser un peu de contexte : Il s’agit d’une instance de démo montée spécialement “à part” pour faire quelques POC sur la couche “processus/activités” dans le cadre d’un chantier majeur de refonte de notre process “privacy by design” (GDPR). Elyass est chargé du sujet côté produit. Si le POC est concluant, cela orientera la décision de conserver l’UI/UX sur Simplicité et de ne pas (faire) redévelopper un front dédié hors Simplicité.

1 Like

Ok, si ça peut patienter, je vois ça lundi prochain au retour de David qui s’occupe de vos instances.
Je ne suis pas sûr d’y avoir accès en ssh.

Il se peut que nos templates “mysql” héritent d’un legacy qui mixe les collations depuis longtemps.

Pour migrer, je n’ai pas trouvé meilleur option que de faire un dump, d’y changer la collation globale, et de recréer la base.

@david

1 Like

Bonjour François,

Merci beaucoup pour ce retour.

Je comprends que cela puisse attendre le retour de David lundi prochain.

Merci encore.

Cordialement,
Elyass

@bmo On parle de quelles instances SIM exactement ?

Bonjour David,

il s’agit de l’instance de “poc gdpr” utilisée par Elyass (https://bcsigdpr.renault.simplicite.io).

Merci pour ton support.

OK je regarderai ça demain.

Ce sujet d’encoding/collation UTF8 est récurrent avec MySQL/MariaDB (ex: cf. Erreur d'enregistrement contenu HTML avec emoticon).

Les templates d’instance et images Docker à jour sont depuis quelques mois livrés en utf8mb4 par défaut pour MySQL/MariaDB, mais la version de MariaDB livrée en standard sur l’OS des serveurs SIM est désormais ancienne ce qui pose peut être des pbs à ce niveau…

PS: s’il s’agit d’une instance crée avant ce changement d’encoding par défaut, les tables doivent être modifiées manuellement via des alter.

La base est par défaut en utf8:

MariaDB [bcsigdpr]> show variables like 'character_set_database';
+------------------------+-------+
| Variable_name          | Value |
+------------------------+-------+
| character_set_database | utf8  |
+------------------------+-------+
1 row in set (0.00 sec)

Le résultat est que dans la base il y a un mix de tables en charset utf8 (vos tables métier crées dans le charset de la base) et utf8mb4 (tables système Simplicité crées par défaut en utf8mb4):

+-------------------------------------------+--------------------+
| table_name                                | character_set_name |
+-------------------------------------------+--------------------+
| bcsi_abbreviation                         | utf8               |
| bcsi_abbreviation_semantic_domain         | utf8               |
| bcsi_act                                  | utf8               |
| bcsi_app                                  | utf8               |
| bcsi_app_abbreviation                     | utf8               |
| bcsi_app_contractor                       | utf8               |
| bcsi_app_datacateg                        | utf8               |
| bcsi_app_datacateg_datasource             | utf8               |
| bcsi_app_external_content                 | utf8               |
| bcsi_app_function                         | utf8               |
| bcsi_app_hist                             | utf8               |
| bcsi_app_lic                              | utf8               |
| bcsi_app_person                           | utf8               |
| bcsi_app_person_hist                      | utf8               |
| bcsi_app_scope                            | utf8               |
| bcsi_app_software                         | utf8               |
| bcsi_app_web_svc                          | utf8               |
| bcsi_busn_chara_datasource                | utf8               |
| bcsi_busn_datamap_major_domain            | utf8               |
| bcsi_busn_datamap_object                  | utf8               |
| bcsi_busn_object                          | utf8               |
| bcsi_busn_object_busn_object              | utf8               |
| bcsi_charac                               | utf8               |
| bcsi_charac_link                          | utf8               |
| bcsi_charac_person_dp                     | utf8               |
| bcsi_charac_person_ds                     | utf8               |
| bcsi_cloud_provider                       | utf8               |
| bcsi_comp_app                             | utf8               |
| bcsi_country                              | utf8               |
| bcsi_data_map                             | utf8               |
| bcsi_datamap_person                       | utf8               |
| bcsi_dataprocess                          | utf8               |
| bcsi_dataprocess_abbreviation             | utf8               |
| bcsi_dataprocess_compliance               | utf8               |
| bcsi_dataprocess_compliance_hist          | utf8               |
| bcsi_dataprocess_contractor               | utf8               |
| bcsi_dataprocess_coun_app_cont            | utf8               |
| bcsi_dataprocess_coun_dataprocess_cont    | utf8               |
| bcsi_dataprocess_country                  | utf8               |
| bcsi_dataprocess_datacateg                | utf8               |
| bcsi_dataprocess_datacateg_app            | utf8               |
| bcsi_dataprocess_datacateg_hist           | utf8               |
| bcsi_dataprocess_dataprocess              | utf8               |
| bcsi_dataprocess_dp_actors_legal_entities | utf8               |
| bcsi_dataprocess_dp_relay                 | utf8               |
| bcsi_dataprocess_hist                     | utf8               |
| bcsi_dataprocess_legal_entity_dep         | utf8               |
| bcsi_dataprocess_notification             | utf8               |
| bcsi_dataprocess_pwo_relay                | utf8               |
| bcsi_dataprocess_step1                    | utf8               |
| bcsi_dataprocess_subfinlov                | utf8               |
| bcsi_dataprocess_subfinlov_app            | utf8               |
| bcsi_dataprocess_subfinlov_hist           | utf8               |
| bcsi_deployment                           | utf8               |
| bcsi_deployment_environment               | utf8               |
| bcsi_deployment_environment_hist          | utf8               |
| bcsi_deployment_hist                      | utf8               |
| bcsi_diagram                              | utf8               |
| bcsi_document                             | utf8               |
| bcsi_document_application                 | utf8               |
| bcsi_document_dataprocess                 | utf8               |
| bcsi_domain_person_dp                     | utf8               |
| bcsi_domain_person_ds                     | utf8               |
| bcsi_enterprise                           | utf8               |
| bcsi_flow                                 | utf8               |
| bcsi_function                             | utf8               |
| bcsi_gen_busn_domain                      | utf8               |
| bcsi_generic_actor                        | utf8               |
| bcsi_legal_entity                         | utf8               |
| bcsi_legal_entity_dep                     | utf8               |
| bcsi_legal_entity_dep_dp_relay            | utf8               |
| bcsi_legal_form                           | utf8               |
| bcsi_lic_chg                              | utf8               |
| bcsi_lic_dem                              | utf8               |
| bcsi_lic_dem_sve                          | utf8               |
| bcsi_license                              | utf8               |
| bcsi_maintenance                          | utf8               |
| bcsi_major_domain                         | utf8               |
| bcsi_major_domain_community               | utf8               |
| bcsi_network                              | utf8               |
| bcsi_network_hist                         | utf8               |
| bcsi_opt_out_decision                     | utf8               |
| bcsi_opt_out_missive                      | utf8               |
| bcsi_org_entity                           | utf8               |
| bcsi_publ_chg                             | utf8               |
| bcsi_publisher                            | utf8               |
| bcsi_region                               | utf8               |
| bcsi_runtime_contract                     | utf8               |
| bcsi_scope                                | utf8               |
| bcsi_sec_assess_req                       | utf8               |
| bcsi_sec_assessment                       | utf8               |
| bcsi_sec_cara                             | utf8               |
| bcsi_sec_cara_req                         | utf8               |
| bcsi_sec_requirement                      | utf8               |
| bcsi_semantic_domain                      | utf8               |
| bcsi_software                             | utf8               |
| bcsi_software_version                     | utf8               |
| bcsi_spec_busn_domain                     | utf8               |
| bcsi_spec_busn_domain_object              | utf8               |
| bcsi_spec_busn_domain_person              | utf8               |
| bcsi_srv_swsign                           | utf8               |
| bcsi_storage                              | utf8               |
| bcsi_storage_hist                         | utf8               |
| bcsi_supplier                             | utf8               |
| bcsi_sw_chg                               | utf8               |
| bcsi_swsign                               | utf8               |
| bcsi_web_svc                              | utf8               |
| bpm_statetran                             | utf8               |
| bsci_soft_compo                           | utf8               |
| it4it_function                            | utf8               |
| m_user_hist                               | utf8               |
| m_user_token                              | utf8               |
| rest_api_dual_row_id                      | utf8               |
| rest_api_single_row_id                    | utf8               |
| rest_api_triple_row_id                    | utf8               |
| snow_app                                  | utf8               |
| snow_app_person                           | utf8               |
| snow_material                             | utf8               |
| snow_server                               | utf8               |
| social_post                               | utf8               |
| alm_activity                              | utf8mb4            |
| alm_activity_link                         | utf8mb4            |
| alm_actor                                 | utf8mb4            |
| alm_actor_group                           | utf8mb4            |
| alm_app_event                             | utf8mb4            |
| alm_app_event_p                           | utf8mb4            |
| alm_app_module                            | utf8mb4            |
| alm_application                           | utf8mb4            |
| alm_assign                                | utf8mb4            |
| alm_assign_almts                          | utf8mb4            |
| alm_assign_stat                           | utf8mb4            |
| alm_document                              | utf8mb4            |
| alm_implement                             | utf8mb4            |
| alm_participate                           | utf8mb4            |
| alm_platform                              | utf8mb4            |
| alm_platform_version                      | utf8mb4            |
| alm_requirement                           | utf8mb4            |
| alm_requirement_hist                      | utf8mb4            |
| alm_test_case                             | utf8mb4            |
| alm_test_case_run                         | utf8mb4            |
| alm_test_step                             | utf8mb4            |
| alm_test_step_run                         | utf8mb4            |
| alm_ticket                                | utf8mb4            |
| alm_ticket_doc                            | utf8mb4            |
| alm_ticket_hist                           | utf8mb4            |
| alm_ticket_post                           | utf8mb4            |
| alm_use_case                              | utf8mb4            |
| alm_version                               | utf8mb4            |
| bpm_activity                              | utf8mb4            |
| bpm_activity_file                         | utf8mb4            |
| bpm_alert                                 | utf8mb4            |
| bpm_alert_content                         | utf8mb4            |
| bpm_alert_file                            | utf8mb4            |
| bpm_data                                  | utf8mb4            |
| bpm_data_file                             | utf8mb4            |
| bpm_grant_act                             | utf8mb4            |
| bpm_grant_pcs                             | utf8mb4            |
| bpm_help                                  | utf8mb4            |
| bpm_process                               | utf8mb4            |
| bpm_process_file                          | utf8mb4            |
| bpm_recipient                             | utf8mb4            |
| bpm_state                                 | utf8mb4            |
| bpm_statetran_grp                         | utf8mb4            |
| bpm_transition                            | utf8mb4            |
| cht_chat                                  | utf8mb4            |
| cht_chatroom                              | utf8mb4            |
| m_act_field                               | utf8mb4            |
| m_action                                  | utf8mb4            |
| m_adapter                                 | utf8mb4            |
| m_agenda                                  | utf8mb4            |
| m_async_job                               | utf8mb4            |
| m_cache_info                              | utf8mb4            |
| m_const_group                             | utf8mb4            |
| m_const_impact                            | utf8mb4            |
| m_constraint                              | utf8mb4            |
| m_crontab                                 | utf8mb4            |
| m_crosstab                                | utf8mb4            |
| m_crosstab_axis                           | utf8mb4            |
| m_crosstab_group                          | utf8mb4            |
| m_datalink                                | utf8mb4            |
| m_datalink_host                           | utf8mb4            |
| m_datalink_hosts                          | utf8mb4            |
| m_datalink_obj                            | utf8mb4            |
| m_datamap                                 | utf8mb4            |
| m_dataset                                 | utf8mb4            |
| m_disp_sysparam                           | utf8mb4            |
| m_disposition                             | utf8mb4            |
| m_doc_legal                               | utf8mb4            |
| m_doc_legal_signer                        | utf8mb4            |
| m_docfield                                | utf8mb4            |
| m_docgroup                                | utf8mb4            |
| m_docindex                                | utf8mb4            |
| m_docindex_mime                           | utf8mb4            |
| m_docmime                                 | utf8mb4            |
| m_document                                | utf8mb4            |
| m_feedback                                | utf8mb4            |
| m_field                                   | utf8mb4            |
| m_field_hist                              | utf8mb4            |
| m_field_type                              | utf8mb4            |
| m_function                                | utf8mb4            |
| m_function_vis                            | utf8mb4            |
| m_grant                                   | utf8mb4            |
| m_group                                   | utf8mb4            |
| m_index                                   | utf8mb4            |
| m_licensekey                              | utf8mb4            |
| m_link_map                                | utf8mb4            |
| m_list                                    | utf8mb4            |
| m_list_code                               | utf8mb4            |
| m_list_link                               | utf8mb4            |
| m_list_value                              | utf8mb4            |
| m_log                                     | utf8mb4            |
| m_log_event                               | utf8mb4            |
| m_lov                                     | utf8mb4            |
| m_map                                     | utf8mb4            |
| m_model                                   | utf8mb4            |
| m_model_item                              | utf8mb4            |
| m_model_tpl                               | utf8mb4            |
| m_model_tplcon                            | utf8mb4            |
| m_model_tplgrp                            | utf8mb4            |
| m_model_tpllnk                            | utf8mb4            |
| m_model_tplobj                            | utf8mb4            |
| m_module                                  | utf8mb4            |
| m_module_hist                             | utf8mb4            |
| m_module_link                             | utf8mb4            |
| m_object                                  | utf8mb4            |
| m_object_hist                             | utf8mb4            |
| m_object_usage                            | utf8mb4            |
| m_objectctxhelp                           | utf8mb4            |
| m_objfield                                | utf8mb4            |
| m_objfield_area                           | utf8mb4            |
| m_pf_node                                 | utf8mb4            |
| m_placemap                                | utf8mb4            |
| m_position                                | utf8mb4            |
| m_printtemplate                           | utf8mb4            |
| m_printtemplate_group                     | utf8mb4            |
| m_profile                                 | utf8mb4            |
| m_redolog                                 | utf8mb4            |
| m_research                                | utf8mb4            |
| m_resource                                | utf8mb4            |
| m_resp                                    | utf8mb4            |
| m_resp_delegate                           | utf8mb4            |
| m_rowid                                   | utf8mb4            |
| m_script                                  | utf8mb4            |
| m_script_usage                            | utf8mb4            |
| m_session                                 | utf8mb4            |
| m_shortcut                                | utf8mb4            |
| m_shortcut_group                          | utf8mb4            |
| m_style                                   | utf8mb4            |
| m_system                                  | utf8mb4            |
| m_template                                | utf8mb4            |
| m_theme                                   | utf8mb4            |
| m_timesheet                               | utf8mb4            |
| m_translate                               | utf8mb4            |
| m_treeview                                | utf8mb4            |
| m_treeviewobj                             | utf8mb4            |
| m_user                                    | utf8mb4            |
| m_user_filters                            | utf8mb4            |
| m_user_sysparam                           | utf8mb4            |
| m_view                                    | utf8mb4            |
| m_view_group                              | utf8mb4            |
| m_view_item                               | utf8mb4            |
| m_xml                                     | utf8mb4            |
| md_document                               | utf8mb4            |
| md_document_hist                          | utf8mb4            |
| md_image                                  | utf8mb4            |
| noti_conf_chan                            | utf8mb4            |
| noti_config                               | utf8mb4            |
| noti_config_content                       | utf8mb4            |
| noti_config_dest                          | utf8mb4            |
| noti_event                                | utf8mb4            |
| noti_evt_msg                              | utf8mb4            |
| noti_evt_user                             | utf8mb4            |
| noti_group_channels                       | utf8mb4            |
| noti_ref_channel                          | utf8mb4            |
| noti_usr_noti_config                      | utf8mb4            |
| rss_channel                               | utf8mb4            |
| rss_item                                  | utf8mb4            |
| social_follow                             | utf8mb4            |
| social_follow_hist                        | utf8mb4            |
| social_like                               | utf8mb4            |
| web_news                                  | utf8mb4            |
| web_news_group                            | utf8mb4            |
+-------------------------------------------+--------------------+
282 rows in set (0.02 sec)

Je propose de tout aligner en utf8mb4, dites moi quand je peux le faire car il faut éviter de faire ça “à chaud” = il vaut mieux arrêter l’instance avant de le faire puis la redémarrer ensuite.

1 Like

Bonsoir David,

je pense que si Elyass n’est pas connecté dessus, tu peux le faire asap (surtout si la manip est rapide).
C’est bien ce problème que nous avions rencontré précédemment, j’avais été amené à réaligner manuellement les tables en utf8mb4 sur notre serveur.

OK je fais la manip ASAP et je vous tiens au courant.

Le SIM (v6.5+) va désormais créer des bases MySQL/MariaDB par défaut en utf8mb4, comme le setup des tables système Simplicité est désormais livré en utf8mb4 ça devrait être cohérent.

1 Like

Bonjour David,

Merci beaucoup pour ce retour !

Il y a 4 tables sur lesquelles l’ALTER ne marche pas:

ALTER TABLE bcsi_legal_entity_dep CONVERT TO CHARACTER SET utf8mb4;
ALTER TABLE bcsi_major_domain CONVERT TO CHARACTER SET utf8mb4;
ALTER TABLE bcsi_semantic_domain CONVERT TO CHARACTER SET utf8mb4;
ALTER TABLE bcsi_swsign CONVERT TO CHARACTER SET utf8mb4;

Ca dit: “Specified key was too long; max key length is 767 bytes”.

Ca vous dit quelque chose ?
Sur ces 4 tables je vois des colonnes à 255 caractère…

Merci encore pour votre réponse rapide.

J’ai effectivement effectué des vérifications sur l’environnement de développement ainsi que celui de recette et j’ai constaté également que plusieurs colonnes dans les tables, y compris celles que vous avez mentionnées (bcsi_legal_entity_dep, bcsi_major_domain, bcsi_semantic_domain, bcsi_swsign), ont une longueur maximale de 255 caractères.

Cela dit, je comprends pourquoi l’ALTER TABLE ne fonctionne pas en raison de la limite de la longueur maximale de l’index de 767 bytes dans MySQL. Je voulais avoir votre avis sur la meilleure façon de gérer cette situation ?

Je me demandais aussi est-ce qu’une mise à jour de MySQL pourrait résoudre ce problème ? Si l’on peut imaginer qu’une version plus récente aurait une limite d’index plus élevée par exemple ? Si oui, quelles seraient les implications potentielles de cette mise à jour ?

Nous n’avons pas d’expertise particulière sur MySQL/MariaDB pour savoir ce qui se cache derrière cette limite ni si une version plus à jour résoudrait le pb. Sur les SIM on utilise la version de MariaDB fournie par la distribution, or sur ce SIM renault.simplicite.io créé il y a longtemps c’est une distribution CentOS 7 c’est donc une MariaDB désormais assez ancienne : 5.5.68.

Il faudrait donc envisager un déploiement autre que sur ce SIM (ex: un déploiement Docker avec une image MySQL à jour ou un nouveau SIM car les SIMs plus récents sont sous Almalinux 8)

En tout cas sur ces 4 tables il y avait un index portant sur des colonnes à 255 caractères:

  • swsign_id pour bcsi_swsign
  • dep_name pour bcsi_legal_entity_dep
  • name et short_name pour bcsi_major_domain
  • semantic_domain_name pour bcsi_semantic_domain

En supprimant ces indexes les ALTERs ont pu passer.

Il vous faudra surement revoir la taille de ces attributs à la baisse pour qu’il n’y ait pas de pb à la recréation de ces indexes.

J’ai redémarré l’instance

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.