Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-37744

Table Charset Mismatch (Primary/Replica) via Event

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.11.13
    • None
    • Replication, Server
    • None

    Description

      In version 10.11.13, when a table is created from an event without specifying the character set or collation,
      it appears that the collation_server is used on the master,
      while the binlog reports the collation_database.
      This creates a character set discrepancy between the primary and the replica,
      causing the replica to break after an INSERT statement.
      This didn't happen in 10.6.22, and it assigns the correct collation belonging to the schema.

      Reproduction Steps:

      create schema andre default charset utf8mb4 collate utf8mb4_general_ci;
       
      use andre
       
      DELIMITER $$
       
      CREATE OR REPLACE EVENT daily_table_creation
      ON SCHEDULE EVERY 1 DAY
      STARTS NOW() + interval 5 second
      DO
      BEGIN
          
       DROP TABLE IF EXISTS `andre_table`;
       
       CREATE TABLE andre_table (
         id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
         col_1 VARCHAR(50) NOT NULL
         );
      END$$
      DELIMITER ;
      

      Once the EVENT is completed:

       
      MariaDB [andre]> show variables like 'collation%';
      +----------------------+--------------------+
      | Variable_name        | Value              |
      +----------------------+--------------------+
      | collation_connection | utf8mb3_general_ci |
      | collation_database   | utf8mb4_general_ci |
      | collation_server     | utf8mb3_general_ci |
      +----------------------+--------------------+
       
       
       
       
       
      PRIMARY:
      MariaDB [andre]> show create table andre_table\G
      *************************** 1. row ***************************
             Table: andre_table
      Create Table: CREATE TABLE `andre_table` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `col_1` varchar(50) NOT NULL,
        PRIMARY KEY (`id`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci
      1 row in set (0.000 sec)
       
       
       
       
      REPLICA:
       
      MariaDB [andre]> show create table andre_table\G
      *************************** 1. row ***************************
             Table: andre_table
      Create Table: CREATE TABLE `andre_table` (
        `id` int(11) NOT NULL AUTO_INCREMENT,
        `col_1` varchar(50) NOT NULL,
        PRIMARY KEY (`id`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci
      1 row in set (0.000 sec)
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            andrea.ponzo Andrea Ponzo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.