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

Set thread names for MariaDB Server threads

Details

    Description

      Multi-threaded Linux programs (like Firefox or MySQL since 8.0.27 or so) usually set a name for each thread. This name will appear in the output of top and other utilities and would help to answer questions like "What thread uses most of CPU" etc.

      Consider this example of MySQL 8.0.29:

      openxs@ao756:~/dbs/8.0$ for task in $(ls /proc/$(pidof mysqld)/task/); do name=$(cat /proc/$(pidof mysqld)/task/${task}/comm); echo "TASK: ${task} (${name})"; done
      TASK: 567049 (mysqld)
      TASK: 567079 (ib_io_ibuf)
      TASK: 567080 (ib_io_log)
      TASK: 567081 (ib_io_rd-1)
      TASK: 567082 (ib_io_rd-2)
      TASK: 567083 (ib_io_rd-3)
      TASK: 567084 (ib_io_rd-4)
      TASK: 567085 (ib_io_wr-1)
      TASK: 567086 (ib_io_wr-2)
      TASK: 567087 (ib_io_wr-3)
      TASK: 567088 (ib_io_wr-4)
      TASK: 567089 (ib_pg_flush_co)
      TASK: 567096 (ib_log_checkpt)
      TASK: 567097 (ib_log_fl_notif)
      TASK: 567098 (ib_log_flush)
      TASK: 567099 (ib_log_wr_notif)
      TASK: 567100 (ib_log_writer)
      TASK: 567114 (ib_srv_lock_to)
      TASK: 567115 (ib_srv_err_mon)
      TASK: 567116 (ib_srv_mon)
      TASK: 567117 (ib_buf_resize)
      TASK: 567118 (ib_src_main)
      TASK: 567119 (ib_dict_stats)
      TASK: 567120 (ib_fts_opt)
      TASK: 567122 (xpl_worker-1)
      TASK: 567123 (xpl_worker-2)
      TASK: 567124 (xpl_accept-1)
      TASK: 567893 (ib_buf_dump)
      TASK: 567894 (ib_clone_gtid)
      TASK: 567895 (ib_srv_purge)
      TASK: 567896 (ib_srv_wkr-1)
      TASK: 567897 (ib_srv_wkr-2)
      TASK: 567898 (ib_srv_wkr-3)
      TASK: 567899 (evt_sched)
      TASK: 567900 (sig_handler)
      TASK: 567902 (xpl_accept-3)
      TASK: 567903 (gtid_zip)
      

      For MariaDB (10.6 here for example) we get:

      openxs@ao756:~/dbs/maria10.6$ for task in $(ls /proc/$(pidof mariadbd)/task/); do name=$(cat /proc/$(pidof mariadbd)/task/${task}/comm); echo "TASK: ${task} (${name})"; done
      TASK: 568093 (mariadbd)
      TASK: 568095 (mariadbd)
      TASK: 568096 (mariadbd)
      TASK: 568097 (mariadbd)
      TASK: 568098 (mariadbd)
      TASK: 568099 (mariadbd)
      TASK: 568104 (mariadbd)
      TASK: 568105 (mariadbd)
      openxs@ao756:~/dbs/maria10.6$
      

      See also https://bugs.mysql.com/bug.php?id=70858

      It makes sense to use the same thread name as used in Performance Schema.

      Attachments

        Activity

          Transition Time In Source Status Execution Times
          Vladislav Vaintroub made transition -
          Open In Progress
          89d 3m 1
          Vladislav Vaintroub made transition -
          In Progress In Review
          1m 44s 1
          Vladislav Vaintroub made transition -
          Stalled In Review
          56d 7h 16m 1
          Sergei Golubchik made transition -
          In Review Stalled
          86d 3h 8m 2
          Vladislav Vaintroub made transition -
          Stalled In Testing
          2d 19h 28m 1
          Lena Startseva made transition -
          In Testing Stalled
          27d 16h 2m 1
          Vladislav Vaintroub made transition -
          Stalled Closed
          10h 39m 1

          People

            wlad Vladislav Vaintroub
            valerii Valerii Kravchuk
            Votes:
            1 Vote for this issue
            Watchers:
            7 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.