Details
-
Bug
-
Status: Stalled (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.5, 10.6, 10.11, 11.4, 11.8, 12.0
-
Q3/2025 Maintenance
Description
Reporting on the status of Rows_log_event execution (as seen by process_list) is inefficient.
- 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.
- 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.
- 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
- is caused by
-
MDEV-7409 On RBR, extend the PROCESSLIST info to include at least the name of the recently used table
-
- Closed
-
- relates to
-
MDEV-29894 Calling a function from a different database in a slave side trigger crashes
-
- Closed
-
- split to
-
MDEV-37211 THD::proc_info is vulnerable to data race
-
- Open
-
-
MDEV-37216 Dynamic THD::proc_info
-
- Open
-