[MDEV-8496] gtid_ignore_duplicates treats gtid_seq_no as 32-bit Created: 2015-07-17  Updated: 2015-07-19  Resolved: 2015-07-19

Status: Closed
Project: MariaDB Server
Component/s: Replication
Affects Version/s: 10.0.20, 10.1
Fix Version/s: 10.0.21, 10.1.6

Type: Bug Priority: Major
Reporter: Geoff Montee (Inactive) Assignee: Kristian Nielsen
Resolution: Fixed Votes: 0
Labels: replication


 Description   

gtid_ignore_duplicates treats gtid_seq_no as 32-bit.

On the master, let's insert some data:

MariaDB [(none)]> SET SESSION gtid_domain_id=102;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> SET SESSION gtid_seq_no=4294967294;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> INSERT INTO db1.test_table VALUES (1, 'str');
Query OK, 1 row affected (0.00 sec)
 
MariaDB [(none)]> SET SESSION gtid_domain_id=102;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> SET SESSION gtid_seq_no=4294967295;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> INSERT INTO db1.test_table VALUES (2, 'str');
Query OK, 1 row affected (0.00 sec)
 
MariaDB [(none)]> SET SESSION gtid_domain_id=102;
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [(none)]> SET SESSION gtid_seq_no=4294967296;
Query OK, 0 rows affected (0.01 sec)
 
MariaDB [(none)]> INSERT INTO db1.test_table VALUES (3, 'str');
Query OK, 1 row affected (0.00 sec)

On the slave, the last insert was ignored:

MariaDB [(none)]> SELECT * FROM db1.test_table;
+----+------+
| id | str  |
+----+------+
|  1 | str  |
|  2 | str  |
+----+------+
2 rows in set (0.00 sec)
 
MariaDB [(none)]> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.1.33
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mariadb-bin.000005
          Read_Master_Log_Pos: 3192
               Relay_Log_File: master-relay-bin.000002
                Relay_Log_Pos: 1367
        Relay_Master_Log_File: mariadb-bin.000005
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              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: 3192
              Relay_Log_Space: 1665
              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: 0
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: 2
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
                   Using_Gtid: Slave_Pos
                  Gtid_IO_Pos: 101-2-4294967296,100-2-1000000000003,22-2-24,102-2-4294967296,1-2-10001
1 row in set (0.00 sec)

The source code appears to cast gtid_seq_no as uint32 here:

https://github.com/MariaDB/server/blob/d258f5ff0435cbd8b000226dc7dc3ec4e9b79cbc/sql/rpl_gtid.cc#L120



 Comments   
Comment by Kristian Nielsen [ 2015-07-19 ]

Ouch, that is quite bad
Thanks for tracking this down.

I have pushed this fix to 10.0 and 10.1:

http://lists.askmonty.org/pipermail/commits/2015-July/008166.html

Generated at Thu Feb 08 07:27:35 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.