Bug #70939 psi keys were incorrectly passed to function set_psi_keys

Submitted: 18 Nov 2013 14:18 Modified: 22 Nov 2013 15:05
Reporter: zhai weixiang (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S2 (Serious)
Version:5.7.2 OS:Any
Assigned to: Marc ALFF CPU Architecture:Any

[18 Nov 2013 14:18] zhai weixiang
Description:
for mysql_bin_log (quoted code from mysqld.cc)

  mysql_bin_log.set_psi_keys(key_BINLOG_LOCK_index,
                             key_BINLOG_LOCK_commit,
                             key_BINLOG_LOCK_commit_queue,
                             key_BINLOG_LOCK_done,
                             key_BINLOG_LOCK_flush_queue,
                             key_BINLOG_LOCK_log,
                             key_BINLOG_LOCK_binlog_end_pos,    ----it's correct
                             key_BINLOG_LOCK_sync,
                             key_BINLOG_LOCK_sync_queue,
                             key_BINLOG_LOCK_xids,
                             key_BINLOG_COND_done,
                             key_BINLOG_update_cond,
                             key_BINLOG_prep_xids_cond,
                             key_file_binlog,
                             key_file_binlog_index);

for relay_log (quoted code from rpl_rli.cc)

  relay_log.set_psi_keys(key_RELAYLOG_LOCK_index,
                         key_RELAYLOG_LOCK_commit,
                         key_RELAYLOG_LOCK_commit_queue,
                         key_RELAYLOG_LOCK_done,
                         key_RELAYLOG_LOCK_flush_queue,
                         key_RELAYLOG_LOCK_log,
                         key_RELAYLOG_LOCK_sync,
                         0, /* Relaylog doesn't support LOCK_binlog_end_pos */ --- incorrect,should above key_RELAYLOG_LOCK_sync
                         key_RELAYLOG_LOCK_sync_queue,
                         key_RELAYLOG_LOCK_xids,
                         key_RELAYLOG_COND_done,
                         key_RELAYLOG_update_cond,
                         key_RELAYLOG_prep_xids_cond,
                         key_file_relaylog,
                         key_file_relaylog_index);

and the define of set_psi_keys:

  void set_psi_keys(PSI_mutex_key key_LOCK_index,
                    PSI_mutex_key key_LOCK_commit,
                    PSI_mutex_key key_LOCK_commit_queue,
                    PSI_mutex_key key_LOCK_done,
                    PSI_mutex_key key_LOCK_flush_queue,
                    PSI_mutex_key key_LOCK_log,
                    PSI_mutex_key key_LOCK_binlog_end_pos,
                    PSI_mutex_key key_LOCK_sync,
                    PSI_mutex_key key_LOCK_sync_queue,
                    PSI_mutex_key key_LOCK_xids,
                    PSI_cond_key key_COND_done,
                    PSI_cond_key key_update_cond,
                    PSI_cond_key key_prep_xids_cond,
                    PSI_file_key key_file_log,
                    PSI_file_key key_file_log_index)

How to repeat:
read the code 

Suggested fix:
correct it
[18 Nov 2013 17:49] MySQL Verification Team
This is verified by the inspection of the  code in all three source files where it is declared. 

Indeed, that 0 (zero) in the case of the relay log should be ABOVE the sync. This order is very important in order to position all keys correctly.
[22 Nov 2013 15:05] Paul DuBois
Noted in 5.7.4 changelog.

The wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_sync mutex was not
properly instrumented for the Performance Schema.

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

Page generated in 0.085 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.