mirror of
https://github.com/MariaDB/server.git
synced 2025-02-07 06:12:18 +01:00
![Monty](/assets/img/avatar_default.png)
This commit adds 3 new status variables to 'show all slaves status': - Master_last_event_time ; timestamp of the last event read from the master by the IO thread. - Slave_last_event_time ; Master timestamp of the last event committed on the slave. - Master_Slave_time_diff: The difference of the above two timestamps. All the above variables are NULL until the slave has started and the slave has read one query event from the master that changes data. - Added information_schema.slave_status, which allows us to remove: - show_master_info(), show_master_info_get_fields(), send_show_master_info_data(), show_all_master_info() - class Sql_cmd_show_slave_status. - Protocol::store(I_List<i_string_pair>* str_list) as it is not used anymore. - Changed old SHOW SLAVE STATUS and SHOW ALL SLAVES STATUS to use the SELECT code path, as all other SHOW ... STATUS commands. Other things: - Xid_log_time is set to time of commit to allow slave that reads the binary log to calculate Master_last_event_time and Slave_last_event_time. This is needed as there is not 'exec_time' for row events. - Fixed that Load_log_event calculates exec_time identically to Query_event. - Updated RESET SLAVE to reset Master/Slave_last_event_time - Updated SQL thread's update on first transaction read-in to only update Slave_last_event_time on group events. - Fixed possible (unlikely) bugs in sql_show.cc ...old_format() functions if allocation of 'field' would fail. Reviewed By: Brandon Nesterenko <brandon.nesterenko@mariadb.com> Kristian Nielsen <knielsen@knielsen-hq.org>
180 lines
6.9 KiB
Text
180 lines
6.9 KiB
Text
# Tests for PERFORMANCE_SCHEMA
|
|
|
|
--source include/have_log_bin.inc
|
|
--source include/not_embedded.inc
|
|
--source include/have_perfschema.inc
|
|
--source include/master-slave.inc
|
|
|
|
--disable_warnings
|
|
drop table if exists test.t1;
|
|
--sync_slave_with_master
|
|
reset master;
|
|
--enable_warnings
|
|
|
|
create table test.t1(a int);
|
|
drop table test.t1;
|
|
|
|
--source include/show_binlog_events.inc
|
|
|
|
# Notes
|
|
#
|
|
# The point of this test is to make sure code is properly instrumented,
|
|
# where instruments have the proper key (binlog or relaylog),
|
|
# it is not to dive into statistics for each instruments.
|
|
# Different test execution sequence in different platforms do make the
|
|
# results vary, making the test results very sensitive to changes.
|
|
# To ensure robustness:
|
|
# - log file rotation is limited to file .000001 and .000002
|
|
# - statistics are normalized to "NONE" or "MANY"
|
|
# - statistics on ::update_cond conditions are not collected,
|
|
# since this is too much dependent on execution.
|
|
# - statistics on COND_binlog_background_thread and COND_xid_list are not
|
|
# collected, as they depend on exact timing for background binlog
|
|
# checkpointing operations.
|
|
#
|
|
|
|
connection master;
|
|
|
|
select
|
|
substring(file_name, locate("master-", file_name)) as FILE_NAME,
|
|
EVENT_NAME,
|
|
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
|
|
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
|
|
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
|
|
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
|
|
from performance_schema.file_summary_by_instance
|
|
where file_name like "%master-%" and file_name not like "%sql/share%" order by file_name;
|
|
|
|
select * from performance_schema.file_summary_by_instance
|
|
where file_name like "%slave-%" order by file_name;
|
|
|
|
-- echo "Expect a master binlog + binlog_index"
|
|
|
|
select
|
|
substring(file_name, locate("master-", file_name)) as FILE_NAME,
|
|
EVENT_NAME,
|
|
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
|
|
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
|
|
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
|
|
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
|
|
from performance_schema.file_summary_by_instance
|
|
where event_name like "%binlog%" order by file_name;
|
|
|
|
select
|
|
EVENT_NAME,
|
|
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
|
|
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
|
|
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
|
|
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
|
|
from performance_schema.file_summary_by_event_name
|
|
where event_name like "%binlog%" order by event_name;
|
|
|
|
select
|
|
EVENT_NAME,
|
|
if (count_star > 0, "MANY", "NONE") as COUNT_STAR
|
|
from performance_schema.events_waits_summary_global_by_event_name
|
|
where event_name like "%MYSQL_BIN_LOG%"
|
|
and event_name not like "%MYSQL_BIN_LOG::update_cond"
|
|
and event_name not like "%MYSQL_BIN_LOG::COND_binlog_background_thread%"
|
|
and event_name not like "%MYSQL_BIN_LOG::COND_xid_list"
|
|
order by event_name;
|
|
|
|
-- echo "Expect no slave relay log"
|
|
|
|
select * from performance_schema.file_summary_by_instance
|
|
where event_name like "%relaylog%" order by file_name;
|
|
|
|
select * from performance_schema.file_summary_by_event_name
|
|
where event_name like "%relaylog%" order by event_name;
|
|
|
|
select * from performance_schema.events_waits_summary_global_by_event_name
|
|
where event_name like "%MYSQL_RELAY_LOG%"
|
|
and event_name not like "%MYSQL_RELAY_LOG::update_cond"
|
|
order by event_name;
|
|
|
|
sync_slave_with_master;
|
|
-- echo "============ Performance schema on slave ============"
|
|
|
|
select * from performance_schema.file_summary_by_instance
|
|
where file_name like "%master-%" order by file_name;
|
|
|
|
select
|
|
substring(file_name, locate("slave-", file_name)) as FILE_NAME,
|
|
EVENT_NAME,
|
|
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
|
|
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
|
|
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
|
|
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
|
|
from performance_schema.file_summary_by_instance
|
|
where file_name like "%slave-%"
|
|
and (file_name not like "%slave-relay-bin.0%"
|
|
or file_name like "%slave-relay-bin.000001"
|
|
or file_name like "%slave-relay-bin.000002")
|
|
order by file_name;
|
|
|
|
-- echo "Expect a slave binlog + binlog_index"
|
|
|
|
select
|
|
substring(file_name, locate("slave-", file_name)) as FILE_NAME,
|
|
EVENT_NAME,
|
|
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
|
|
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
|
|
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
|
|
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
|
|
from performance_schema.file_summary_by_instance
|
|
where event_name like "%binlog%" order by file_name;
|
|
|
|
select
|
|
EVENT_NAME,
|
|
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
|
|
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
|
|
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
|
|
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
|
|
from performance_schema.file_summary_by_event_name
|
|
where event_name like "%binlog%" order by event_name;
|
|
|
|
select
|
|
EVENT_NAME,
|
|
if (count_star > 0, "MANY", "NONE") as COUNT_STAR
|
|
from performance_schema.events_waits_summary_global_by_event_name
|
|
where event_name like "%MYSQL_BIN_LOG%"
|
|
and event_name not like "%MYSQL_BIN_LOG::update_cond"
|
|
and event_name not like "%MYSQL_BIN_LOG::COND_binlog_background_thread%"
|
|
and event_name not like "%MYSQL_BIN_LOG::COND_xid_list"
|
|
order by event_name;
|
|
|
|
-- echo "Expect a slave relay log"
|
|
|
|
select
|
|
substring(file_name, locate("slave-", file_name)) as FILE_NAME,
|
|
EVENT_NAME,
|
|
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
|
|
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
|
|
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
|
|
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
|
|
from performance_schema.file_summary_by_instance
|
|
where event_name like "%relaylog%"
|
|
and (file_name not like "%slave-relay-bin.0%"
|
|
or file_name like "%slave-relay-bin.000001"
|
|
or file_name like "%slave-relay-bin.000002")
|
|
order by file_name;
|
|
|
|
select
|
|
EVENT_NAME,
|
|
if (count_read > 0, "MANY", "NONE") as COUNT_READ,
|
|
if (count_write > 0,"MANY", "NONE") as COUNT_WRITE,
|
|
if (sum_number_of_bytes_read > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_READ,
|
|
if (sum_number_of_bytes_write > 0, "MANY", "NONE") as SUM_NUMBER_OF_BYTES_WRITE
|
|
from performance_schema.file_summary_by_event_name
|
|
where event_name like "%relaylog%" order by event_name;
|
|
|
|
select
|
|
EVENT_NAME,
|
|
if (count_star > 0, "MANY", "NONE") as COUNT_STAR
|
|
from performance_schema.events_waits_summary_global_by_event_name
|
|
where event_name like "%MYSQL_RELAY_LOG%"
|
|
and event_name not like "%MYSQL_RELAY_LOG::update_cond"
|
|
order by event_name;
|
|
|
|
--source include/stop_slave.inc
|
|
|