mirror of
https://github.com/MariaDB/server.git
synced 2025-02-05 13:22:17 +01:00
9a132d423a
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.
99 lines
3.7 KiB
Text
99 lines
3.7 KiB
Text
connect con1, localhost, root, , ;
|
|
drop table if exists t1;
|
|
create table t1(a int) engine = myisam;
|
|
insert into t1 values (1), (2), (3), (4), (5);
|
|
connection default;
|
|
update performance_schema.threads
|
|
set instrumented = 'NO'
|
|
where processlist_id = connection_id();
|
|
truncate table performance_schema.events_statements_history_long;
|
|
truncate table performance_schema.events_stages_history_long;
|
|
connection con1;
|
|
SET DEBUG_SYNC='RESET';
|
|
SET DEBUG_SYNC='copy_data_between_tables_before SIGNAL found_row WAIT_FOR wait_row EXECUTE 5';
|
|
ALTER TABLE t1 engine = innodb;;
|
|
connection default;
|
|
SET DEBUG_SYNC='now WAIT_FOR found_row';
|
|
select event_id from performance_schema.events_statements_current
|
|
where thread_id = @con1_thread_id into @con1_stmt_id;
|
|
Warnings:
|
|
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
|
select EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED
|
|
from performance_schema.events_stages_current
|
|
where (thread_id = @con1_thread_id);
|
|
EVENT_NAME WORK_COMPLETED WORK_ESTIMATED
|
|
stage/sql/copy to tmp table 0 5
|
|
SET DEBUG_SYNC='now SIGNAL wait_row';
|
|
SET DEBUG_SYNC='now WAIT_FOR found_row';
|
|
select EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED
|
|
from performance_schema.events_stages_current
|
|
where (thread_id = @con1_thread_id);
|
|
EVENT_NAME WORK_COMPLETED WORK_ESTIMATED
|
|
stage/sql/copy to tmp table 1 5
|
|
SET DEBUG_SYNC='now SIGNAL wait_row';
|
|
SET DEBUG_SYNC='now WAIT_FOR found_row';
|
|
select EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED
|
|
from performance_schema.events_stages_current
|
|
where (thread_id = @con1_thread_id);
|
|
EVENT_NAME WORK_COMPLETED WORK_ESTIMATED
|
|
stage/sql/copy to tmp table 2 5
|
|
SET DEBUG_SYNC='now SIGNAL wait_row';
|
|
SET DEBUG_SYNC='now WAIT_FOR found_row';
|
|
select EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED
|
|
from performance_schema.events_stages_current
|
|
where (thread_id = @con1_thread_id);
|
|
EVENT_NAME WORK_COMPLETED WORK_ESTIMATED
|
|
stage/sql/copy to tmp table 3 5
|
|
SET DEBUG_SYNC='now SIGNAL wait_row';
|
|
SET DEBUG_SYNC='now WAIT_FOR found_row';
|
|
select EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED
|
|
from performance_schema.events_stages_current
|
|
where (thread_id = @con1_thread_id);
|
|
EVENT_NAME WORK_COMPLETED WORK_ESTIMATED
|
|
stage/sql/copy to tmp table 4 5
|
|
SET DEBUG_SYNC='now SIGNAL wait_row';
|
|
connection con1;
|
|
select "After payload";
|
|
After payload
|
|
After payload
|
|
connection default;
|
|
# Dumping ALTER TABLE stages
|
|
select EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED
|
|
from performance_schema.events_stages_history_long
|
|
where (thread_id = @con1_thread_id)
|
|
and (nesting_event_id = @con1_stmt_id)
|
|
order by thread_id, event_id;
|
|
EVENT_NAME WORK_COMPLETED WORK_ESTIMATED
|
|
stage/sql/starting NULL NULL
|
|
stage/sql/checking permissions NULL NULL
|
|
stage/sql/init for update NULL NULL
|
|
stage/sql/Opening tables NULL NULL
|
|
stage/sql/After opening tables NULL NULL
|
|
stage/sql/setup NULL NULL
|
|
stage/sql/creating table NULL NULL
|
|
stage/sql/After create NULL NULL
|
|
stage/sql/System lock NULL NULL
|
|
stage/sql/table lock NULL NULL
|
|
stage/sql/After create NULL NULL
|
|
stage/sql/copy to tmp table 5 5
|
|
stage/sql/Enabling keys NULL NULL
|
|
stage/sql/Rename result table NULL NULL
|
|
stage/sql/Unlocking tables NULL NULL
|
|
stage/sql/Rename result table NULL NULL
|
|
stage/sql/End of update loop NULL NULL
|
|
stage/sql/Query end NULL NULL
|
|
stage/sql/closing tables NULL NULL
|
|
stage/sql/Unlocking tables NULL NULL
|
|
stage/sql/closing tables NULL NULL
|
|
stage/sql/Query end NULL NULL
|
|
stage/sql/Starting cleanup NULL NULL
|
|
stage/sql/Freeing items NULL NULL
|
|
stage/sql/Reset for next command NULL NULL
|
|
SET DEBUG_SYNC='RESET';
|
|
connection con1;
|
|
drop table t1;
|
|
disconnect con1;
|
|
connection default;
|
|
update performance_schema.threads
|
|
set instrumented = 'YES'
|
|
where processlist_id = connection_id();
|