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

Optimize Rows_log_event Reporting of Process Info

    XMLWordPrintable

Details

    • Q3/2025 Maintenance

    Description

      Reporting on the status of Rows_log_event execution (as seen by process_list) is inefficient.

      1. thd_proc_info(thd, message) is called within do_exec_row(), without the possibility of the message actually changing between rows; however, the message is re-built entirely using my_snprintf for each row. my_snprintf is slow and doesn't need to be called per-row. This could instead be done in do_apply_event() around the loop which iterates rows, thereby only needing to call my_snprintf() once.
      2. When WSREP_PROC_INFO is defined, my_snprintf() is called again to re-write the same message into thd->wsrep_info. This should also be moved to do_apply_event.
      3. In error checking, thd->is_error() should always be set when write_row() (or whatever equivalent for the Rows_log_event implementation) is called. This can be switched to a debug assertion DBUG_ASSERT(!error || thd->is_error) where we can just return the returned error.

      The above logic should be applicable for all Rows_log_event implementations:: Write, Update, and Delete.

      Note these points come from monty, I'm just filing the JIRA.

      Depending on the speedup seen from this, it may be beneficial to put into 10.6 (rather than a new version, as cleanups usually are).

      Note the above suggestion says that my_snprintf is slow and doesn't need to be called per-row; but actually it shouldn't be called at all. Notice the following comment for the proc_info variable (which is assigned this string):

        /*
          ...
          This member is accessed and assigned without any synchronization.
          Therefore, it may point only to constant (statically
          allocated) strings, which memory won't go away over time.
        */
        const char *proc_info;
      

      Dynamically creating this message for SHOW PROCESSLIST violates this principle, potentially leading to crashes. When moving the thd_proc_info call, we should revert to the original message displayed before MDEV-7409 (and consequently revert MDEV-29894 entirely).

      Attachments

        Issue Links

          Activity

            People

              ParadoxV5 Jimmy Hú
              bnestere Brandon Nesterenko
              Jimmy Hú Jimmy Hú
              Brandon Nesterenko Brandon Nesterenko
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.