summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorMarc Alff <marc.alff@oracle.com>2011-03-01 17:39:28 +0100
committerMarc Alff <marc.alff@oracle.com>2011-03-01 17:39:28 +0100
commit5ee90018446bcb10c4a85f03eee968f99de4fa97 (patch)
tree65bbccb37aeddd07d7c8fafb985b0e746957847f /mysql-test
parent69b82937591f6e5cf30ec75d1ba7caf0cb69ead4 (diff)
downloadmariadb-git-5ee90018446bcb10c4a85f03eee968f99de4fa97.tar.gz
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).
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/suite/perfschema/r/relaylog.result98
-rw-r--r--mysql-test/suite/perfschema/t/relaylog.test112
2 files changed, 210 insertions, 0 deletions
diff --git a/mysql-test/suite/perfschema/r/relaylog.result b/mysql-test/suite/perfschema/r/relaylog.result
new file mode 100644
index 00000000000..0cd346b62a1
--- /dev/null
+++ b/mysql-test/suite/perfschema/r/relaylog.result
@@ -0,0 +1,98 @@
+include/master-slave.inc
+[connection master]
+drop table if exists test.t1;
+reset master;
+create table test.t1(a int);
+drop table test.t1;
+show binlog events from <binlog_start>;
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Query # # use `test`; create table test.t1(a int)
+slave-bin.000001 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
+"============ Performance schema on master ============"
+select * from performance_schema.file_summary_by_instance
+where file_name like "%master-%" order by file_name;
+FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
+[DATADIR]master-bin.000001 wait/io/file/sql/binlog 6 4 221 329
+[DATADIR]master-bin.index wait/io/file/sql/binlog_index 0 2 0 40
+select * from performance_schema.file_summary_by_instance
+where file_name like "%slave-%" order by file_name;
+FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
+select * from performance_schema.file_summary_by_instance
+where event_name like "%binlog%" order by file_name;
+FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
+[DATADIR]master-bin.000001 wait/io/file/sql/binlog 6 4 221 329
+[DATADIR]master-bin.index wait/io/file/sql/binlog_index 0 2 0 40
+select * from performance_schema.file_summary_by_event_name
+where event_name like "%binlog%" order by event_name;
+EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
+wait/io/file/sql/binlog 6 4 221 329
+wait/io/file/sql/binlog_index 0 2 0 40
+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;
+event_name count_star
+wait/synch/cond/sql/MYSQL_BIN_LOG::COND_prep_xids 0
+wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond 1
+wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_index 3
+wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_prep_xids 0
+select * from performance_schema.file_summary_by_instance
+where event_name like "%relaylog%" order by file_name;
+FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
+select * from performance_schema.file_summary_by_event_name
+where event_name like "%relaylog%" order by event_name;
+EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
+wait/io/file/sql/relaylog 0 0 0 0
+wait/io/file/sql/relaylog_index 0 0 0 0
+select * from performance_schema.events_waits_summary_global_by_event_name
+where event_name like "%MYSQL_RELAY_LOG%" order by event_name;
+EVENT_NAME COUNT_STAR SUM_TIMER_WAIT MIN_TIMER_WAIT AVG_TIMER_WAIT MAX_TIMER_WAIT
+wait/synch/cond/sql/MYSQL_RELAY_LOG::update_cond 0 0 0 0 0
+wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_index 0 0 0 0 0
+"============ Performance schema on slave ============"
+select * from performance_schema.file_summary_by_instance
+where file_name like "%master-%" order by file_name;
+FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
+select * from performance_schema.file_summary_by_instance
+where file_name like "%slave-%" order by file_name;
+FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
+[DATADIR]slave-bin.000001 wait/io/file/sql/binlog 3 8 602 631
+[DATADIR]slave-bin.index wait/io/file/sql/binlog_index 0 3 0 57
+[DATADIR]slave-relay-bin.000001 wait/io/file/sql/relaylog 4 3 370 263
+[DATADIR]slave-relay-bin.000002 wait/io/file/sql/relaylog 2 4 368 368
+[DATADIR]slave-relay-bin.index wait/io/file/sql/relaylog_index 2 4 50 125
+select * from performance_schema.file_summary_by_instance
+where event_name like "%binlog%" order by file_name;
+FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
+[DATADIR]slave-bin.000001 wait/io/file/sql/binlog 3 8 602 631
+[DATADIR]slave-bin.index wait/io/file/sql/binlog_index 0 3 0 57
+select * from performance_schema.file_summary_by_event_name
+where event_name like "%binlog%" order by event_name;
+EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
+wait/io/file/sql/binlog 3 8 602 631
+wait/io/file/sql/binlog_index 0 3 0 57
+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;
+event_name count_star
+wait/synch/cond/sql/MYSQL_BIN_LOG::COND_prep_xids 0
+wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond 0
+wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_index 5
+wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_prep_xids 0
+select * from performance_schema.file_summary_by_instance
+where event_name like "%relaylog%" order by file_name;
+FILE_NAME EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
+[DATADIR]slave-relay-bin.000001 wait/io/file/sql/relaylog 4 3 370 263
+[DATADIR]slave-relay-bin.000002 wait/io/file/sql/relaylog 2 4 368 368
+[DATADIR]slave-relay-bin.index wait/io/file/sql/relaylog_index 2 4 50 125
+select * from performance_schema.file_summary_by_event_name
+where event_name like "%relaylog%" order by event_name;
+EVENT_NAME COUNT_READ COUNT_WRITE SUM_NUMBER_OF_BYTES_READ SUM_NUMBER_OF_BYTES_WRITE
+wait/io/file/sql/relaylog 6 7 738 631
+wait/io/file/sql/relaylog_index 2 4 50 125
+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;
+event_name count_star
+wait/synch/cond/sql/MYSQL_RELAY_LOG::update_cond 2
+wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_index 12
+include/stop_slave.inc
diff --git a/mysql-test/suite/perfschema/t/relaylog.test b/mysql-test/suite/perfschema/t/relaylog.test
new file mode 100644
index 00000000000..43822e30f0e
--- /dev/null
+++ b/mysql-test/suite/perfschema/t/relaylog.test
@@ -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
+