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

MySQL 8 JSON data replication is stopping further replication

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6.21
    • 10.6
    • Replication
    • None

    Description

      As per the doc we don't support JSON types from MySQL to MariaDB in ROW format which is fine. But if a user does it unknowingly we should handle it more gracefully. That is, the MySQL-8.0 integration patch for MDEV-35643 mentions that

      If PARTIAL_UPDATE_ROWS_EVENT or TRANSACTION_PAYLOAD_EVENT is found, the server will stop with an error message of how to disable the MySQL server to generate such events.

      However, no such error message is provided upon seeing such events. SHOW SLAVE STATUS doesn't show any error at all (however does show that the SQL thread no longer runs), and the error log just mentions that there was a unknown field type.

      Repro
      ------
      Primary = MySQL 8.0.35
      Replica = 10.6.21

      @Primary>

      SET GLOBAL server_id = 100;
      CREATE USER 'repl_user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'repl_pass';
      GRANT REPLICATION SLAVE ON *.* TO 'repl_user'@'localhost';
      

      @Replica>

      SET GLOBAL server_id = 101;
      STOP SLAVE;
      CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=11463, MASTER_USER='repl_user', MASTER_PASSWORD='repl_pass', MASTER_LOG_FILE='binlog.000002', MASTER_LOG_POS=347;
      START SLAVE;
      

      @Primary>

      SET NAMES 'utf8';
      SET SESSION collation_server= 'utf8_general_ci';
      CREATE DATABASE db1;
      USE db1;
      SELECT @@binlog_format;
      +-----------------+
      | @@binlog_format |
      +-----------------+
      | ROW             |
      +-----------------+
      1 row in set, 1 warning (0.00 sec)
       
      SELECT @@binlog_row_value_options;
      +----------------------------+
      | @@binlog_row_value_options |
      +----------------------------+
      |                            |
      +----------------------------+
      1 row in set (0.00 sec)
       
      CREATE TABLE j4 (`id` INT UNSIGNED NOT NULL AUTO_INCREMENT , `attributes` JSON NOT NULL, PRIMARY KEY(`id`));
      Query OK, 0 rows affected (0.03 sec)
       
      INSERT INTO j4 (attributes) VALUES ('{"screen": "50 inch", "resolution": "2048 x 1152 pixels", "ports": {"hdmi": 1, "usb": 3}, "speakers": {"left": "10 watt", "right": "10 watt"}}');
      Query OK, 1 row affected (0.01 sec)
      

      @Replica>

      10.6.21-opt>SHOW SLAVE STATUS\G
      *************************** 1. row ***************************
                      Slave_IO_State: Waiting for master to send event
                         Master_Host: localhost
                         Master_User: repl_user
                         Master_Port: 11463
                       Connect_Retry: 60
                     Master_Log_File: binlog.000002
                 Read_Master_Log_Pos: 7156
                      Relay_Log_File: qa-susil-1-relay-bin.000002
                       Relay_Log_Pos: 615
               Relay_Master_Log_File: binlog.000002
                    Slave_IO_Running: Yes
                   Slave_SQL_Running: No
                     Replicate_Do_DB: 
                 Replicate_Ignore_DB: 
                  Replicate_Do_Table: 
              Replicate_Ignore_Table: 
             Replicate_Wild_Do_Table: 
         Replicate_Wild_Ignore_Table: 
                          Last_Errno: 0
                          Last_Error: 
                        Skip_Counter: 0
                 Exec_Master_Log_Pos: 6801
                     Relay_Log_Space: 1284
                     Until_Condition: None
                      Until_Log_File: 
                       Until_Log_Pos: 0
                  Master_SSL_Allowed: No
                  Master_SSL_CA_File: 
                  Master_SSL_CA_Path: 
                     Master_SSL_Cert: 
                   Master_SSL_Cipher: 
                      Master_SSL_Key: 
               Seconds_Behind_Master: NULL
       Master_SSL_Verify_Server_Cert: No
                       Last_IO_Errno: 0
                       Last_IO_Error: 
                      Last_SQL_Errno: 0
                      Last_SQL_Error: 
         Replicate_Ignore_Server_Ids: 
                    Master_Server_Id: 100
                      Master_SSL_Crl: 
                  Master_SSL_Crlpath: 
                          Using_Gtid: No
                         Gtid_IO_Pos: 
             Replicate_Do_Domain_Ids: 
         Replicate_Ignore_Domain_Ids: 
                       Parallel_Mode: optimistic
                           SQL_Delay: 0
                 SQL_Remaining_Delay: NULL
             Slave_SQL_Running_State: 
                    Slave_DDL_Groups: 0
      Slave_Non_Transactional_Groups: 0
          Slave_Transactional_Groups: 0
      1 row in set (0.000 sec)
      

      log:

      2025-01-06 23:22:33 7 [ERROR] In RBR mode, Slave received unknown field type field 245  for column Name: db1.j4.attributes.
      2025-01-06 23:22:33 7 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'binlog.000002' position 6801
      2025-01-06 23:22:33 7 [Note] Slave SQL thread exiting, replication stopped in log 'binlog.000002' at position 6801, master: localhost:11463
      

      As per the log message I performed SLAVE STOP (this is missing in the log message though) followed by SLAVE START but it is not fixing the above problem.

      10.6.21-opt>START SLAVE SQL_THREAD;
      Query OK, 0 rows affected (0.000 sec)
       
      10.6.21-opt>SHOW SLAVE STATUS\G
      *************************** 1. row ***************************
                      Slave_IO_State: Waiting for master to send event
                         Master_Host: localhost
                         Master_User: repl_user
                         Master_Port: 11463
                       Connect_Retry: 60
                     Master_Log_File: binlog.000002
                 Read_Master_Log_Pos: 7351
                      Relay_Log_File: qa-susil-1-relay-bin.000002
                       Relay_Log_Pos: 615
               Relay_Master_Log_File: binlog.000002
                    Slave_IO_Running: Yes
                   Slave_SQL_Running: No
                     Replicate_Do_DB: 
                 Replicate_Ignore_DB: 
                  Replicate_Do_Table: 
              Replicate_Ignore_Table: 
             Replicate_Wild_Do_Table: 
         Replicate_Wild_Ignore_Table: 
                          Last_Errno: 0
                          Last_Error: 
                        Skip_Counter: 0
                 Exec_Master_Log_Pos: 6801
                     Relay_Log_Space: 1882
                     Until_Condition: None
                      Until_Log_File: 
                       Until_Log_Pos: 0
                  Master_SSL_Allowed: No
                  Master_SSL_CA_File: 
                  Master_SSL_CA_Path: 
                     Master_SSL_Cert: 
                   Master_SSL_Cipher: 
                      Master_SSL_Key: 
               Seconds_Behind_Master: NULL
       Master_SSL_Verify_Server_Cert: No
                       Last_IO_Errno: 0
                       Last_IO_Error: 
                      Last_SQL_Errno: 0
                      Last_SQL_Error: 
         Replicate_Ignore_Server_Ids: 
                    Master_Server_Id: 100
                      Master_SSL_Crl: 
                  Master_SSL_Crlpath: 
                          Using_Gtid: No
                         Gtid_IO_Pos: 
             Replicate_Do_Domain_Ids: 
         Replicate_Ignore_Domain_Ids: 
                       Parallel_Mode: optimistic
                           SQL_Delay: 0
                 SQL_Remaining_Delay: NULL
             Slave_SQL_Running_State: 
                    Slave_DDL_Groups: 0
      Slave_Non_Transactional_Groups: 0
          Slave_Transactional_Groups: 0
      1 row in set (0.000 sec)
      

      log:

      2025-01-07  0:11:18 10 [Note] Slave SQL thread initialized, starting replication in log 'binlog.000002' at position 6801, relay log './qa-susil-1-relay-bin.000002' position: 615
      2025-01-07  0:11:18 10 [ERROR] In RBR mode, Slave received unknown field type field 245  for column Name: db1.j4.attributes.
      2025-01-07  0:11:18 10 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'binlog.000002' position 6801
      2025-01-07  0:11:18 10 [Note] Slave SQL thread exiting, replication stopped in log 'binlog.000002' at position 6801, master: localhost:11463
      

      The real bad thing happens now! Further replication is not reflected on the replica and there is no error/waring message logged.

      @Primary>

      CREATE TABLE normal_tbl (id INT);
      Query OK, 0 rows affected (0.03 sec)
      

      @Replica>

      10.6.21-opt>SHOW SLAVE STATUS\G
      *************************** 1. row ***************************
                      Slave_IO_State: Waiting for master to send event
                         Master_Host: localhost
                         Master_User: repl_user
                         Master_Port: 11463
                       Connect_Retry: 60
                     Master_Log_File: binlog.000002
                 Read_Master_Log_Pos: 7351
                      Relay_Log_File: qa-susil-1-relay-bin.000002
                       Relay_Log_Pos: 615
               Relay_Master_Log_File: binlog.000002
                    Slave_IO_Running: Yes
                   Slave_SQL_Running: No
                     Replicate_Do_DB: 
                 Replicate_Ignore_DB: 
                  Replicate_Do_Table: 
              Replicate_Ignore_Table: 
             Replicate_Wild_Do_Table: 
         Replicate_Wild_Ignore_Table: 
                          Last_Errno: 0
                          Last_Error: 
                        Skip_Counter: 0
                 Exec_Master_Log_Pos: 6801
                     Relay_Log_Space: 1882
                     Until_Condition: None
                      Until_Log_File: 
                       Until_Log_Pos: 0
                  Master_SSL_Allowed: No
                  Master_SSL_CA_File: 
                  Master_SSL_CA_Path: 
                     Master_SSL_Cert: 
                   Master_SSL_Cipher: 
                      Master_SSL_Key: 
               Seconds_Behind_Master: NULL
       Master_SSL_Verify_Server_Cert: No
                       Last_IO_Errno: 0
                       Last_IO_Error: 
                      Last_SQL_Errno: 0
                      Last_SQL_Error: 
         Replicate_Ignore_Server_Ids: 
                    Master_Server_Id: 100
                      Master_SSL_Crl: 
                  Master_SSL_Crlpath: 
                          Using_Gtid: No
                         Gtid_IO_Pos: 
             Replicate_Do_Domain_Ids: 
         Replicate_Ignore_Domain_Ids: 
                       Parallel_Mode: optimistic
                           SQL_Delay: 0
                 SQL_Remaining_Delay: NULL
             Slave_SQL_Running_State: 
                    Slave_DDL_Groups: 0
      Slave_Non_Transactional_Groups: 0
          Slave_Transactional_Groups: 0
      1 row in set (0.000 sec)
      

      Attachments

        Issue Links

          Activity

            People

              bnestere Brandon Nesterenko
              susil.behera Susil Behera
              Votes:
              0 Vote for this issue
              Watchers:
              6 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.