Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-113

Add the thread ID to each MySQL event

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Done
    • Major
    • 0.4
    • None
    • mysql-connector
    • None

    Description

      The MySQL binlog contains the ID of the thread that has processed the query on the master for each event in the log. It'd be useful to have the thread ID in the Debezium output (just like the server_id), as some applications could take advantage of this data (e.g. for auditing and analytics purposes).

      Below is a sample output of "mysqlbinlog -v" that shows how the thread_id is represented, in a transaction started event.

      # at 219
      #160829 13:56:22 server id 223344  end_log_pos 298 CRC32 0x5a34f2ee 	Query	thread_id=2	exec_time=0	error_code=0
      SET TIMESTAMP=1472478982/*!*/;
      SET @@session.pseudo_thread_id=2/*!*/;
      SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
      SET @@session.sql_mode=1436549152/*!*/;
      SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
      SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
      SET @@session.lc_time_names=0/*!*/;
      SET @@session.collation_database=DEFAULT/*!*/;
      BEGIN
      /*!*/;
      # at 298
      #160829 13:56:22 server id 223344  end_log_pos 364 CRC32 0x8c1a0552 	Table_map: `inventory`.`customers` mapped to number 112
      # at 364
      #160829 13:56:22 server id 223344  end_log_pos 484 CRC32 0xeb8a1235 	Update_rows: table id 112 flags: STMT_END_F
      
      BINLOG '
      Bj/EVxNwaAMAQgAAAGwBAAAAAHAAAAAAAAMACWludmVudG9yeQAJY3VzdG9tZXJzAAQDDw8PBv8A
      /wD/AABSBRqM
      Bj/EVx9waAMAeAAAAOQBAAAAAHAAAAAAAAEAAgAE///w7AMAAARBbm5lCUtyZXRjaG1hchJhbm5l
      a0Bub2Fuc3dlci5vcmfw7AMAAApBbm5lIE1hcmllCUtyZXRjaG1hchJhbm5la0Bub2Fuc3dlci5v
      cmc1Eorr
      '/*!*/;
      ### UPDATE `inventory`.`customers`
      ### WHERE
      ###   @1=1004
      ###   @2='Anne'
      ###   @3='Kretchmar'
      ###   @4='annek@noanswer.org'
      ### SET
      ###   @1=1004
      ###   @2='Anne Marie'
      ###   @3='Kretchmar'
      ###   @4='annek@noanswer.org'
      # at 484
      #160829 13:56:22 server id 223344  end_log_pos 515 CRC32 0xc3948371 	Xid = 55
      COMMIT/*!*/;
      

      Attachments

        Activity

          People

            rhauch Randall Hauch (Inactive)
            sagiba Sagi Bashari (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: