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

Add Xid or GTID to SHOW PROCESSLIST and SHOW ENGINE INNODB STATUS output for wsrep slave thread

    XMLWordPrintable

Details

    Description

      In a Galera Cluster environment, sometimes it can be useful to look at SHOW PROCESSLIST and SHOW ENGINE INNODB STATUS output to try to determine what the WSREP slave thread is currently doing. Unfortunately, since the thread is not actually executing raw SQL, some of the information shown isn't very useful for trying to determine what transaction is currently being executed. For example, you might see something like this in SHOW PROCESSLIST:

            Id: 2
          User: system user
          Host:
            db: NULL
       Command: Sleep
          Time: 0
         State: Update_rows_log_event::find_row(442082)
          Info: NULL
      Progress: 0.000

      And you might see something like this in SHOW ENGINE INNODB STATUS:

      ---TRANSACTION 6372971, ACTIVE 1435 sec starting index read
      mysql tables in use 1, locked 1
      1572723 lock struct(s), heap size 224818728, 20603597 row lock(s), undo log entries 20659529
      MySQL thread id 2, OS thread handle 0x7fbf52b22b00, query id 4979324 Update_rows_log_event::find_row(442082)
      Trx #rec lock waits 0 #table lock waits 0
      Trx total rec lock wait time 0 SEC
      Trx total table lock wait time 0 SEC

      If the user wanted to try to match this specific transaction to another transaction in the master's binary log, this information doesn't really help the user does that. For WSREP slave threads, maybe it would be worth printing in SHOW PROCESSLIST and SHOW ENGINE INNODB STATUS the "Xid" or GTID of the transaction? e.g. see the "Xid" and GTID values in the mysqlbinlog output below:

      # at 463
      #170110 17:55:58 server id 1  end_log_pos 501   GTID 1-1-11 trans
      /*!100001 SET @@session.gtid_seq_no=11*//*!*/;
      BEGIN
      /*!*/;
      # at 501
      #170110 17:55:58 server id 1  end_log_pos 545   Table_map: `db1`.`tab` mapped to number 18
      # at 545
      #170110 17:55:58 server id 1  end_log_pos 584   Write_rows: table id 18 flags: STMT_END_F
       
      BINLOG '
      fmZ1WBMBAAAALAAAACECAAAAABIAAAAAAAEAA2RiMQADdGFiAAIDDwIyAAI=
      fmZ1WBcBAAAAJwAAAEgCAAAAABIAAAAAAAEAAgP8AQAAAARzdHIx
      '/*!*/;
      ### INSERT INTO `db1`.`tab`
      ### SET
      ###   @1=1
      ###   @2='str1'
      # at 584
      #170110 17:55:58 server id 1  end_log_pos 611   Xid = 11
      COMMIT/*!*/;

      Attachments

        Issue Links

          Activity

            People

              seppo Seppo Jaakola
              GeoffMontee Geoff Montee (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              4 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.