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

Bug#11766528 PERFORMANCE_SCHEMA TRACKS BOTH BINARY AND RELAY LOGS IN THE SAME EVENTS

Before this fix, all the performance schema instrumentation for both the binary log
and the relay log would use the following instruments:
- wait/io/file/sql/binlog
- wait/io/file/sql/binlog_index
- wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_index
- wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond

This instrumentation is too general and can be more specific.

With this fix, the binlog instrumentation is identical,
and the relay log instrumentation is changed to:
- wait/io/file/sql/relaylog
- wait/io/file/sql/relaylog_index
- wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_index
- wait/synch/cond/sql/MYSQL_RELAY_LOG::update_cond

With this change, the performance instrumentation for the binary log and the relay log,
which share the same structure but have different uses, is more detailed.
This is especially important for hosts in the middle of a replication chain,
that are both masters (binlog) and slaves (relaylog).
This commit is contained in:
Marc Alff
2011-03-01 17:39:28 +01:00
parent 69b8293759
commit 5ee9001844
7 changed files with 270 additions and 10 deletions

View File

@ -0,0 +1,112 @@
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
# 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
connection master;
-- echo "============ Performance schema on master ============"
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--replace_result $MYSQLD_DATADIR [DATADIR]
select * from performance_schema.file_summary_by_instance
where file_name like "%master-%" order by file_name;
--replace_result $MYSQLD_DATADIR [DATADIR]
select * from performance_schema.file_summary_by_instance
where file_name like "%slave-%" order by file_name;
# Expect a master binlog + binlog_index
--replace_result $MYSQLD_DATADIR [DATADIR]
select * from performance_schema.file_summary_by_instance
where event_name like "%binlog%" order by file_name;
select * from performance_schema.file_summary_by_event_name
where event_name like "%binlog%" order by event_name;
select event_name, count_star
from performance_schema.events_waits_summary_global_by_event_name
where event_name like "%MYSQL_BIN_LOG%" order by event_name;
# Expect no slave relay log.
--replace_result $MYSQLD_DATADIR [DATADIR]
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%" order by event_name;
sync_slave_with_master;
-- echo "============ Performance schema on slave ============"
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--replace_result $MYSQLD_DATADIR [DATADIR]
select * from performance_schema.file_summary_by_instance
where file_name like "%master-%" order by file_name;
--replace_result $MYSQLD_DATADIR [DATADIR]
select * from performance_schema.file_summary_by_instance
where file_name like "%slave-%" order by file_name;
# Expect a slave binlog + binlog_index
--replace_result $MYSQLD_DATADIR [DATADIR]
select * from performance_schema.file_summary_by_instance
where event_name like "%binlog%" order by file_name;
select * from performance_schema.file_summary_by_event_name
where event_name like "%binlog%" order by event_name;
select event_name, count_star
from performance_schema.events_waits_summary_global_by_event_name
where event_name like "%MYSQL_BIN_LOG%" order by event_name;
# Expect a slave relay log.
--replace_result $MYSQLD_DATADIR [DATADIR]
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 event_name, count_star
from performance_schema.events_waits_summary_global_by_event_name
where event_name like "%MYSQL_RELAY_LOG%" order by event_name;
--source include/stop_slave.inc