'Error: connecting slave requested to start from GTID 0-1-1, which is not in the master's binlog

'Error: connecting slave requested to start from GTID 0-1-1, which is not in the master's binlog

我已将 MariaDB 从 10.1.38 版本升级到 10.1.41 版本,并在另一个分支中并行升级到 10.2.18 到 10.2.26,这导致在数据库复制启动期间出现以下问题。没有对 MariaDB 安装进行其他更改

Last_IO_Errno: 1236 Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Error: connecting slave requested to start from GTID 0-1-1, which is not in the master's binlog. Since the master's binlog contains GTIDs with higher sequence numbers, it probably means that the slave has diverged due to executing extra erroneous transactions'

在早期版本中,它可以正常工作。是否有任何与复制相关的更改我们需要在安装期间明确调整?

MariaDB [(none)]> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State:
                  Master_Host: 10.99.32.8
                  Master_User: repl
                  Master_Port: 3307
                Connect_Retry: 60
              Master_Log_File:
          Read_Master_Log_Pos: 4
               Relay_Log_File: mysql-1-relay-bin.000001
                Relay_Log_Pos: 4
        Relay_Master_Log_File:
             Slave_IO_Running: No
            Slave_SQL_Running: Yes
              Replicate_Do_DB:
          Replicate_Ignore_DB: mysql
           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: 4
              Relay_Log_Space: 256
              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: 1236
                Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Error: connecting slave requested to start from GTID 0-1-1, which is not in the master's binlog. Since the master's binlog contains GTIDs with higher sequence numbers, it probably means that the slave has diverged due to executing extra erroneous transactions'
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 2
               Master_SSL_Crl:
           Master_SSL_Crlpath:
                   Using_Gtid: Current_Pos
                  Gtid_IO_Pos: 0-1-1
      Replicate_Do_Domain_Ids:
  Replicate_Ignore_Domain_Ids:
                Parallel_Mode: optimistic
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it

二进制日志详细信息

MariaDB [(none)]> show binlog events in 'binary-log.000001';
Log_name        Pos     Event_type      Server_id       End_log_pos     Info
binary-log.000001       4       Format_desc     1       256     Server ver: 10.2.26-MariaDB-log, Binlog ver: 4
binary-log.000001       256     Gtid_list       1       285     []
binary-log.000001       285     Binlog_checkpoint       1       329     binary-log.000001
binary-log.000001       329     Gtid    1       371     GTID 0-1-1
binary-log.000001       371     Query   1       473     create database if not exists test;
binary-log.000001       473     Stop    1       496
MariaDB [(none)]> show binlog events in 'binary-log.000002';
Log_name        Pos     Event_type      Server_id       End_log_pos     Info
binary-log.000002       4       Format_desc     1       256     Server ver: 10.2.26-MariaDB-log, Binlog ver: 4
binary-log.000002       256     Gtid_list       1       299     [0-1-1]
binary-log.000002       299     Binlog_checkpoint       1       343     binary-log.000002
binary-log.000002       343     Stop    1       366
MariaDB [(none)]> show binlog events in 'binary-log.000003';
Log_name        Pos     Event_type      Server_id       End_log_pos     Info
binary-log.000003       4       Format_desc     1       256     Server ver: 10.2.26-MariaDB-log, Binlog ver: 4
binary-log.000003       256     Gtid_list       1       299     [0-1-1]
binary-log.000003       299     Binlog_checkpoint       1       343     binary-log.000003

经分析,能够发现上述问题是由于主从之间的GTID差异导致创建以下查询。

MariaDB:https://jira.mariadb.org/browse/MDEV-20990

计算器溢出:

根据 MariaDB 的注释,我们可以看到 GTID 位置 0-1-1 已被安装期间发生的 DDL 事务更改。

已解决:在my.cnf文件

中添加了复制忽略以下属性的测试数据库
***binlog-ignore-db = test***