Bug #77115 replication thread statuses not shown in performance_schema
Submitted: 21 May 2015 10:36 Modified: 2 Apr 2016 2:27
Reporter: Sven Sandberg Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S3 (Non-critical)
Version:5.6 OS:Any
Assigned to: CPU Architecture:Any

[21 May 2015 10:36] Sven Sandberg
Description:
The following thread statuses are not shown in the PROCESSLIST_INFO column of performance_schema.threads:

  waiting for GTID to be written to binary log
  Waiting for the slave SQL thread to free enough relay log space
  Waiting for workers to exit
  Waiting for Slave Worker to release partition
  Waiting for Slave Workers to free pending events
  Waiting for Slave Worker queue
  Waiting for an event from Coordinator

In 5.7, additionally the following stages have the same problem:

  Waiting for dependent transaction to commit.
  Waiting for its turn to commit.
  Waiting for slave workers to finish.

How to repeat:
#!/bin/sh
file=$1
for stage in `grep PSI_stage_info $file | grep -v all_server_stages | sed 's/^\s*PSI_stage_info\s*//;s/\s*=.*//'` ; do
    grep -P -q '^\s*&\s*'$stage',?\s*$' $file
    if [ $? != 0 ] ; then
        echo $stage
        grep "PSI_stage_info\s*$stage" $file | sed 's/^[^"]*"/  /;s/".*//'
    fi
done

Suggested fix:
Add the stages to PSI_stage_info *all_server_stages[].
[2 Apr 2016 2:27] Daniel So
The following was noted in the 5.7.8 internal changelog:

"Some replication thread statuses were not being shown in the PROCESSLIST_INFO
column of the threads table."

The MySQL 5.7 manual (http://dev.mysql.com/doc/refman/5.7/en/replication-options-slave.html#sysvar_slave_preserv...) has also been updated accordingly:

"While the slave thread is waiting for other workers to commit their transactions it reports its status as Waiting for preceding transaction to commit."