1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-33620 Improve times and states in show processlist for replication

This will makes it easier to find out what replication workers are
doing and what they are waiting for.

Things changed in processlist:
- Slave_SQL time was not consistent. Now time for state "Slave has
  read all relay log; waiting for more updates" shows how long it has
  waited for getting the next event.
- Slave_worker threads did often show "Closing tables" for a long
  time.  Now the state is reverted to the previous state after
  "Closing tables" is done.
- Commit and Rollback states where not shown for replication (and some
  other threads). Now Commit and Rollback states are always shown and
  the state is reverted to previous state when the Commit/Rollback
  have finished.

Code changes:
- Added thd->set_time_for_next_stage() for parallel replication when
  when starting to wait for prior transactions to commit, group commit,
  and FTWRL and for free space in thread pool.
  Before we reset the time only after the above events.
- Moved THD_STAGE_INFO(stage_rollback) and THD_STAGE_INFO(stage_commit)
  from sql_parse.cc to transaction.cc to ensure this is done for
  all commits and not only 'normal connection queries'.

Test case changes:
- close_thread_tables() reverting stage to previous stage caused the
  counter in performance_schema to be increased. In many case it is
  the 'sql/starting' stage that was effected.
- We only change to "Commit" stage if there is a need for a commit.
  This caused some "Commit" stages to disapper from perfschema reports.

TODO in 11.#:
- Slave_IO always showes "Waiting for master to send event" and the time is
  from SLAVE START. We should in 11.# change this to be the time since
  reading the last event.
This commit is contained in:
Monty
2024-03-07 11:25:30 +02:00
parent 0df4651c13
commit 9a132d423a
17 changed files with 1054 additions and 1013 deletions

View File

@ -128,8 +128,8 @@ relative_event_id relative_end_event_id event_name comment nesting_event_type re
11 11 stage/sql/Executing (stage) STATEMENT 0
12 12 stage/sql/End of update loop (stage) STATEMENT 0
13 13 stage/sql/Query end (stage) STATEMENT 0
14 14 stage/sql/Commit (stage) STATEMENT 0
15 15 stage/sql/closing tables (stage) STATEMENT 0
14 14 stage/sql/closing tables (stage) STATEMENT 0
15 15 stage/sql/Query end (stage) STATEMENT 0
16 16 stage/sql/Starting cleanup (stage) STATEMENT 0
17 17 stage/sql/Freeing items (stage) STATEMENT 0
18 18 wait/io/socket/sql/client_connection send STATEMENT 0
@ -152,8 +152,8 @@ relative_event_id relative_end_event_id event_name comment nesting_event_type re
35 35 stage/sql/Executing (stage) STATEMENT 24
36 36 stage/sql/End of update loop (stage) STATEMENT 24
37 37 stage/sql/Query end (stage) STATEMENT 24
38 38 stage/sql/Commit (stage) STATEMENT 24
39 39 stage/sql/closing tables (stage) STATEMENT 24
38 38 stage/sql/closing tables (stage) STATEMENT 24
39 39 stage/sql/Query end (stage) STATEMENT 24
40 40 stage/sql/Starting cleanup (stage) STATEMENT 24
41 41 stage/sql/Freeing items (stage) STATEMENT 24
42 42 wait/io/socket/sql/client_connection send STATEMENT 24
@ -176,8 +176,8 @@ relative_event_id relative_end_event_id event_name comment nesting_event_type re
59 59 stage/sql/Executing (stage) STATEMENT 48
60 60 stage/sql/End of update loop (stage) STATEMENT 48
61 61 stage/sql/Query end (stage) STATEMENT 48
62 62 stage/sql/Commit (stage) STATEMENT 48
63 63 stage/sql/closing tables (stage) STATEMENT 48
62 62 stage/sql/closing tables (stage) STATEMENT 48
63 63 stage/sql/Query end (stage) STATEMENT 48
64 64 stage/sql/Starting cleanup (stage) STATEMENT 48
65 65 stage/sql/Freeing items (stage) STATEMENT 48
66 66 wait/io/socket/sql/client_connection send STATEMENT 48
@ -203,8 +203,8 @@ select "With a third part to make things complete" as payload NULL NULL
84 84 stage/sql/Executing (stage) STATEMENT 72
85 85 stage/sql/End of update loop (stage) STATEMENT 72
86 86 stage/sql/Query end (stage) STATEMENT 72
87 87 stage/sql/Commit (stage) STATEMENT 72
88 88 stage/sql/closing tables (stage) STATEMENT 72
87 87 stage/sql/closing tables (stage) STATEMENT 72
88 88 stage/sql/Query end (stage) STATEMENT 72
89 89 stage/sql/Starting cleanup (stage) STATEMENT 72
90 92 stage/sql/Freeing items (stage) STATEMENT 72
91 91 wait/io/socket/sql/client_connection send STAGE 90
@ -222,8 +222,8 @@ select "With a third part to make things complete" as payload NULL NULL
102 102 stage/sql/Executing (stage) STATEMENT 93
103 103 stage/sql/End of update loop (stage) STATEMENT 93
104 104 stage/sql/Query end (stage) STATEMENT 93
105 105 stage/sql/Commit (stage) STATEMENT 93
106 106 stage/sql/closing tables (stage) STATEMENT 93
105 105 stage/sql/closing tables (stage) STATEMENT 93
106 106 stage/sql/Query end (stage) STATEMENT 93
107 107 stage/sql/Starting cleanup (stage) STATEMENT 93
108 110 stage/sql/Freeing items (stage) STATEMENT 93
109 109 wait/io/socket/sql/client_connection send STAGE 108
@ -239,8 +239,8 @@ select "With a third part to make things complete" as payload NULL NULL
119 119 stage/sql/Executing (stage) STATEMENT 111
120 120 stage/sql/End of update loop (stage) STATEMENT 111
121 121 stage/sql/Query end (stage) STATEMENT 111
122 122 stage/sql/Commit (stage) STATEMENT 111
123 123 stage/sql/closing tables (stage) STATEMENT 111
122 122 stage/sql/closing tables (stage) STATEMENT 111
123 123 stage/sql/Query end (stage) STATEMENT 111
124 124 stage/sql/Starting cleanup (stage) STATEMENT 111
125 125 stage/sql/Freeing items (stage) STATEMENT 111
126 126 wait/io/socket/sql/client_connection send STATEMENT 111
@ -263,8 +263,8 @@ select "With a third part to make things complete" as payload NULL NULL
143 143 stage/sql/Executing (stage) STATEMENT 132
144 144 stage/sql/End of update loop (stage) STATEMENT 132
145 145 stage/sql/Query end (stage) STATEMENT 132
146 146 stage/sql/Commit (stage) STATEMENT 132
147 147 stage/sql/closing tables (stage) STATEMENT 132
146 146 stage/sql/closing tables (stage) STATEMENT 132
147 147 stage/sql/Query end (stage) STATEMENT 132
148 148 stage/sql/Starting cleanup (stage) STATEMENT 132
149 149 stage/sql/Freeing items (stage) STATEMENT 132
150 150 wait/io/socket/sql/client_connection send STATEMENT 132