Bug #59658 performance_schema tracks both binary and relay logs in the same events

Submitted: 21 Jan 2011 14:46 Modified: 16 Apr 2011 17:09
Reporter: Mark Leith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S3 (Non-critical)
Version:5.5.8 OS:Any
Assigned to: Marc ALFF CPU Architecture:Any

[21 Jan 2011 14:46] Mark Leith
Description:
Currently performance_schema tracks IO to both the slave relay logs, and binary logs, and their related index files, as the same events - wait/io/file/sql/binlog and wait/io/file/sql/binlog_index. This is obvious when looking at summaries on the file level, however when trying to diagnose IO for background slave threads and looking at summaries from a thread perspective, it would be useful to have these broken out by relay log or binary log. 

This is especially true of mid level servers in a replication tree, where the server may be a master and a slave where the slave SQL threads reads from the relay logs, and causes writes to the binary logs. 

mysql> SELECT SUBSTRING_INDEX(file_name, '/', -1) AS file, fsbi.event_name,
    ->        count_read, sum_number_of_bytes_read, 
    ->        count_write, sum_number_of_bytes_write
    ->   FROM file_summary_by_instance fsbi
    ->   JOIN file_instances USING (file_name)
    ->  WHERE fsbi.event_name = 'wait/io/file/sql/binlog'
    ->    AND open_count > 0\G
*************************** 1. row ***************************
                     file: mysql-bin.000001
               event_name: wait/io/file/sql/binlog
               count_read: 0
 sum_number_of_bytes_read: 0
              count_write: 6
sum_number_of_bytes_write: 931
*************************** 2. row ***************************
                     file: mysql_sandbox11045-relay-bin.000002
               event_name: wait/io/file/sql/binlog
               count_read: 37
 sum_number_of_bytes_read: 5039
              count_write: 76
sum_number_of_bytes_write: 5039
2 rows in set (0.00 sec)

Likewise the wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond event has different meanings depending on the context the server is in. 

For a master server, it is the time a connected slave server thread has waited for an update to the binary log - i.e within MYSQL_BIN_LOG::wait_for_update_bin_log(), which corresponds to the "Master has sent all binlog to slave; waiting for binlog to be updated" state. 

For a slave server, it is the time the SQL thread has waited for the IO thread to write more events to the relay log - i.e within MYSQL_BIN_LOG::wait_for_update_relay_log(), which corresponds to the "Slave has read all relay log; waiting for the slave I/O thread to update it" state. 

In the same mid-level-tree replication server scenario, this makes it hard to differentiate based on different summaries. 

How to repeat:
o Set up a simple master/slave replication, enable log_slave_updates

SELECT SUBSTRING_INDEX(file_name, '/', -1) AS file, fsbi.event_name,
       count_read, sum_number_of_bytes_read, 
       count_write, sum_number_of_bytes_write
  FROM file_summary_by_instance fsbi
  JOIN file_instances USING (file_name)
 WHERE fsbi.event_name = 'wait/io/file/sql/binlog'
   AND open_count > 0\G

Suggested fix:
Add new wait/io/file/sql/relaylog and wait/io/file/sql/relaylog_index events to track relay log IO specifically.

Split wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond in to wait/synch/cond/sql/MYSQL_BIN_LOG::update_binlog_cond and wait/synch/cond/sql/MYSQL_BIN_LOG::update_relaylog_cond.
[16 Apr 2011 17:09] Paul DuBois
Noted in 5.5.11, 5.6.3 changelogs. 

Previously, Performance Schema instrumentation for both the binary 
log and the relay log used these 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 

Now instrumentation for the relay log uses these instruments, which 
makes it possible to distinquish events for the binary log from those 
for the relay log: 

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 

CHANGESET - http://lists.mysql.com/commits/132230

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.052 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.