WL#8460: Progress Reporting in Sys Schema

Affects: Server-5.7   —   Status: Complete

Add progress reporting of long running transactions in
the sys schema, by putting the percentage completed for stages that track work 
estimates / completed, in to the processlist / session views.
F1 A new "progress" column should show up in the 
processlist/x$processlist/session/x$session views.

F2 For stages that support progress reporting, when a session is actively within 
one of those stages, and the performance_schema.events_stages_current consumer and 
the relevant stages are enabled, the percentage of work completed should be shown 
within the "progress" column. The supported stages are currently:

- stage/sql/Copying to tmp table
- stage/innodb/alter table (end)
- stage/innodb/alter table (flush)
- stage/innodb/alter table (insert)
- stage/innodb/alter table (log apply index)
- stage/innodb/alter table (log apply table)
- stage/innodb/alter table (merge sort)
- stage/innodb/alter table (read PK and internal sort)
- stage/innodb/buffer pool load

F3 For stages that do not support work estimate/completion reporting, or if the 
performance_schema.events_stages_current consumer is disabled (or any of the 
related instruments), then NULL should be shown in the "progress" column
Add a new "progress" column to the processlist/x$processlist/session/x$session 
views, that shows the estimated progress for stages the implement progress 
tracking.

These views will join to the performance_schema.events_stages_current table, and 
will compute the progress column as:

   IF(events_stages_current.end_event_id IS NULL,
      ROUND(100 * (events_stages_current.work_completed / 
events_stages_current.work_estimated), 2),
      NULL) AS progress