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

built-in documentation for performance_schema tables

Details

    Description

      Document all performance schema tables using per-column COMMENT, like in

      --- a/storage/perfschema/table_file_instances.cc
      +++ b/storage/perfschema/table_file_instances.cc
      @@ -49,9 +49,9 @@ table_file_instances::m_share=
         sizeof(PFS_simple_index),
         &m_table_lock,
         { C_STRING_WITH_LEN("CREATE TABLE file_instances("
      -                      "FILE_NAME VARCHAR(512) not null,"
      -                      "EVENT_NAME VARCHAR(128) not null,"
      -                      "OPEN_COUNT INTEGER unsigned not null)") },
      +                      "FILE_NAME VARCHAR(512) not null comment 'File name',"
      +                      "EVENT_NAME VARCHAR(128) not null comment 'Instrument name associated with the file',"
      +                      "OPEN_COUNT INTEGER unsigned not null comment 'Open handles on the file. A value of greater than zero means that the file is currently open')") },
         false  /* perpetual */
       };
       

      After that one can see the built-in documentation with

      show create table performance_schema.file_instances

      or, better, with

      select column_name, column_comment from information_schema.columns where table_schema='performance_schema' and table_name='file_instances'

      returning

      +-------------+----------------------------------------------------------------------------------------------+
      | column_name | column_comment                                                                               |
      +-------------+----------------------------------------------------------------------------------------------+
      | FILE_NAME   | File name                                                                                    |
      | EVENT_NAME  | Instrument name associated with the file                                                     |
      | OPEN_COUNT  | Open handles on the file. A value of greater than zero means that the file is currently open |
      +-------------+----------------------------------------------------------------------------------------------+

      The documentation text is taken from https://mariadb.com/kb/en/performance-schema-file_instances-table/

      Attachments

        Activity

          haidong Haidong Ji added a comment -

          Hi Sergei,

          I'd like to work on this, if that is ok. I've checked the page here on https://mariadb.com/kb/en/performance-schema-tables/ . I think I know what to do.

          Haidong

          haidong Haidong Ji added a comment - Hi Sergei, I'd like to work on this, if that is ok. I've checked the page here on https://mariadb.com/kb/en/performance-schema-tables/ . I think I know what to do. Haidong
          haidong Haidong Ji added a comment -

          I did some development work over the weekend:

          1. The kb articles don't always have the complete columns defined in the cc files. I'll keep note of this.
          2. When comment has single quote, the way to escape it is to double it. Backslash escaping doesn't work.
          3. I've built the binary a few times after making changes in my local branch. I see the changes correctly reflected using the 2 method Sergei mentioned above.

          I'm pretty sure I can finish this task. Any tips/suggestions welcome. Thanks!

          haidong Haidong Ji added a comment - I did some development work over the weekend: 1. The kb articles don't always have the complete columns defined in the cc files. I'll keep note of this. 2. When comment has single quote, the way to escape it is to double it. Backslash escaping doesn't work. 3. I've built the binary a few times after making changes in my local branch. I see the changes correctly reflected using the 2 method Sergei mentioned above. I'm pretty sure I can finish this task. Any tips/suggestions welcome. Thanks!

          haidong, yes, thanks. Please, list here all columns that you find not documented in the KB

          serg Sergei Golubchik added a comment - haidong , yes, thanks. Please, list here all columns that you find not documented in the KB
          haidong Haidong Ji added a comment - - edited

          I have finished editing the cc files for all performance schema tables listed. I've tested every one of them by building and then running `select column_name, column_comment from information_schema.columns where table_schema='performance_schema' and table_name='file_instances'`. They look good.

          I've checked in the code to my forked branch here: https://github.com/haidong/server/tree/MDEV-25325 I plan to work on writing tests next. I've never done that before. So if you have suggestions/tips, that would be welcome. I may not be able to get to it until the weekend.

          PS. I have noted the inconsistencies between the documentation and code files, and will report them also.

          haidong Haidong Ji added a comment - - edited I have finished editing the cc files for all performance schema tables listed. I've tested every one of them by building and then running `select column_name, column_comment from information_schema.columns where table_schema='performance_schema' and table_name='file_instances'`. They look good. I've checked in the code to my forked branch here: https://github.com/haidong/server/tree/MDEV-25325 I plan to work on writing tests next. I've never done that before. So if you have suggestions/tips, that would be welcome. I may not be able to get to it until the weekend. PS. I have noted the inconsistencies between the documentation and code files, and will report them also.
          haidong Haidong Ji added a comment -

          I have finished all coding tasks, including test cases, at least for the first go-round. I have also just submitted a PR: https://github.com/MariaDB/server/pull/1830

          • Documentation typo
          1. "memory_global_by_event_name" should have been "memory_summary_global_by_event_name" on https://mariadb.com/kb/en/performance-schema-memory_global_by_event_name-table/
          2. "LISTENw" should have been "LISTEN" on https://mariadb.com/kb/en/performance-schema-socket_summary_by_event_name-table/
          • The following tables don't have comments defined like others:
            events_statements_summary_by_program
            events_transactions_current
            events_transactions_history
            events_transactions_history_long
            events_transactions_summary_by_account_by_event_name
            events_transactions_summary_by_host_by_event_name
            events_transactions_summary_by_thread_by_event_name
            events_transactions_summary_by_user_by_event_name
            events_transactions_summary_global_by_event_name
            prepared_statements_instances
            replication_applier_configuration
            replication_applier_status
          • For "events_stages_current", "events_stages_history", and "events_stages_history_long", they all miss comment for "WORK_COMPLETED" and "WORK_ESTIMATED" columns;
          • For the same tables above, the ENUM of "NESTING_EVENT_TYPE" misses "TRANSACTION", I don't know if that's intentional or a mistake.
          • For "events_statements_current", "events_statements_history", and "events_statements_history_long", they all miss comment for the "NESTING_EVENT_LEVEL" column;
          • "setup_actors" misses comment for columns "ENABLED", "HISTORY"
          • "threads" misses comment for columns "HISTORY", "CONNECTION_TYPE", "THREAD_OS_ID"
          haidong Haidong Ji added a comment - I have finished all coding tasks, including test cases, at least for the first go-round. I have also just submitted a PR: https://github.com/MariaDB/server/pull/1830 Documentation typo "memory_global_by_event_name" should have been "memory_summary_global_by_event_name" on https://mariadb.com/kb/en/performance-schema-memory_global_by_event_name-table/ "LISTENw" should have been "LISTEN" on https://mariadb.com/kb/en/performance-schema-socket_summary_by_event_name-table/ The following tables don't have comments defined like others: events_statements_summary_by_program events_transactions_current events_transactions_history events_transactions_history_long events_transactions_summary_by_account_by_event_name events_transactions_summary_by_host_by_event_name events_transactions_summary_by_thread_by_event_name events_transactions_summary_by_user_by_event_name events_transactions_summary_global_by_event_name prepared_statements_instances replication_applier_configuration replication_applier_status For "events_stages_current", "events_stages_history", and "events_stages_history_long", they all miss comment for "WORK_COMPLETED" and "WORK_ESTIMATED" columns; For the same tables above, the ENUM of "NESTING_EVENT_TYPE" misses "TRANSACTION", I don't know if that's intentional or a mistake. For "events_statements_current", "events_statements_history", and "events_statements_history_long", they all miss comment for the "NESTING_EVENT_LEVEL" column; "setup_actors" misses comment for columns "ENABLED", "HISTORY" "threads" misses comment for columns "HISTORY", "CONNECTION_TYPE", "THREAD_OS_ID"

          great, thanks!

          serg Sergei Golubchik added a comment - great, thanks!

          People

            cvicentiu Vicențiu Ciorbaru
            serg Sergei Golubchik
            Votes:
            0 Vote for this issue
            Watchers:
            5 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.