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

Gtid_log_event thread_id missing in binlog when pseudo_thread_id is set to 0 or negative

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • 11.5(EOL)
    • 11.5.1
    • Replication
    • None

    Description

      Server does not print thread id correctly in binlog when pseudo_thread_id is set to negative or high value.

      Server does not print thread id in GTID part when pseudo_thread_id is set to negative value.
      PS: Query part thread id is set to zero

      11.5.0-dbg>set @@pseudo_thread_id=-888;
      Query OK, 0 rows affected, 1 warning (0.000 sec)
       
      11.5.0-dbg>show warnings;
      +---------+------+----------------------------------------------------+
      | Level   | Code | Message                                            |
      +---------+------+----------------------------------------------------+
      | Warning | 1292 | Truncated incorrect pseudo_thread_id value: '-888' |
      +---------+------+----------------------------------------------------+
      1 row in set (0.000 sec)
       
      11.5.0-dbg>insert into t1 values(2,2,2);
      Query OK, 1 row affected (0.031 sec)
       
      11.5.0-dbg>
      # at 1971
      #240417 10:01:27 server id 1  end_log_pos 2002 CRC32 0xab1e125f         Xid = 42
      COMMIT/*!*/;
      # at 2002
      #240417 10:02:15 server id 1  end_log_pos 2044 CRC32 0x648df5fc         GTID 0-1-11 trans
      /*!100001 SET @@session.gtid_seq_no=11*//*!*/;
      START TRANSACTION
      /*!*/;
      # at 2044
      #240417 10:02:15 server id 1  end_log_pos 0 CRC32 0x4629d690    Query   thread_id=0     exec_time=0     error_code=0    xid=0
      SET TIMESTAMP=1713337335/*!*/;
      insert into t1 values(2,2,2)
      /*!*/;
      # at 2139
      #240417 10:02:15 server id 1  end_log_pos 2170 CRC32 0x326c9ee4         Xid = 49
      COMMIT/*!*/;
      

      Binlog info when setting binlog_format to ROW

      # at 2903
      #240417 10:45:00 server id 1  end_log_pos 2945 CRC32 0xd5f7657d         GTID 0-1-16 trans
      /*!100001 SET @@session.gtid_seq_no=16*//*!*/;
      START TRANSACTION
      /*!*/;
      # at 2945
      # at 2996
      #240417 10:45:00 server id 1  end_log_pos 0 CRC32 0xe207457b    Annotate_rows:
      #Q> insert into t1 values(5,5,5)
      #240417 10:45:00 server id 1  end_log_pos 0 CRC32 0xd9697f47    Table_map: `test`.`t1` mapped to number 24
      # at 3043
      #240417 10:45:00 server id 1  end_log_pos 0 CRC32 0x5732644b    Write_rows: table id 24 flags: STMT_END_F
       
      BINLOG '
      /H0fZhMBAAAALwAAAAAAAAAAABgAAAAAAAEABHRlc3QAAnQxAAMDAwMAB0d/adk=
      /H0fZhcBAAAALgAAAAAAAAAAABgAAAAAAAEAA//4BQAAAAUAAAAFAAAAS2QyVw==
      '/*!*/;
      # Number of rows: 1
      # at 3089
      #240417 10:45:00 server id 1  end_log_pos 3120 CRC32 0xc36051fe         Xid = 79
      COMMIT/*!*/;
      

      When pseudo_thread_id is set to a high value the server prints the thread ID differently in GTID and query part

      11.5.0-dbg>set @@pseudo_thread_id=99999999999999999999;
      Query OK, 0 rows affected, 1 warning (0.000 sec)
       
      11.5.0-dbg>show warnings;
      +---------+------+-----------------------------------------------------------------------------+
      | Level   | Code | Message                                                                     |
      +---------+------+-----------------------------------------------------------------------------+
      | Warning | 1916 | Got overflow when converting '99999999999999999999' to INT. Value truncated |
      +---------+------+-----------------------------------------------------------------------------+
      1 row in set (0.000 sec)
       
      11.5.0-dbg>insert into t1 values(3,3,3);
      Query OK, 1 row affected (0.002 sec)
       
      11.5.0-dbg>
       
      # at 2512
      #240417 10:16:42 server id 1  end_log_pos 2557 CRC32 0x3c9b50c1         GTID 0-1-14 trans thread_id=9223372036854775807
      /*!100001 SET @@session.gtid_seq_no=14*//*!*/;
      START TRANSACTION
      /*!*/;
      # at 2557
      #240417 10:16:42 server id 1  end_log_pos 0 CRC32 0x05e0502f    Query   thread_id=4294967295    exec_time=0     error_code=0    xid=0
      SET TIMESTAMP=1713338202/*!*/;
      insert into t1 values(3,3,3)
      /*!*/;
      # at 2652
      #240417 10:16:42 server id 1  end_log_pos 2683 CRC32 0x22216322         Xid = 69
      COMMIT/*!*/;
      DELIMITER ;
      # End of log file
      

      Binlog info when setting binlog_format to ROW

      # at 2683
      #240417 10:41:32 server id 1  end_log_pos 2728 CRC32 0x54aae207         GTID 0-1-15 trans thread_id=9223372036854775807
      /*!100001 SET @@session.gtid_seq_no=15*//*!*/;
      START TRANSACTION
      /*!*/;
      # at 2728
      # at 2779
      #240417 10:41:32 server id 1  end_log_pos 0 CRC32 0xff138352    Annotate_rows:
      #Q> insert into t1 values(4,4,4)
      #240417 10:41:32 server id 1  end_log_pos 0 CRC32 0xe61a251d    Table_map: `test`.`t1` mapped to number 24
      # at 2826
      #240417 10:41:32 server id 1  end_log_pos 0 CRC32 0x7eddc879    Write_rows: table id 24 flags: STMT_END_F
       
      BINLOG '
      LH0fZhMBAAAALwAAAAAAAAAAABgAAAAAAAEABHRlc3QAAnQxAAMDAwMABx0lGuY=
      LH0fZhcBAAAALgAAAAAAAAAAABgAAAAAAAEAA//4BAAAAAQAAAAEAAAAecjdfg==
      '/*!*/;
      # Number of rows: 1
      # at 2872
      #240417 10:41:32 server id 1  end_log_pos 2903 CRC32 0x7d022c00         Xid = 74
      COMMIT/*!*/;
      

      Attachments

        Issue Links

          Activity

            People

              bnestere Brandon Nesterenko
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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