Bug #85764 workbench elapsed_time is wrong due to incorrectly subtracting timestamp values
Submitted: 3 Apr 2017 7:33 Modified: 30 May 2018 15:50
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench: Administration Severity:S3 (Non-critical)
Version:6.3.8 OS:Any
Assigned to: CPU Architecture:Any

[3 Apr 2017 7:33] Shane Bester
Description:
Workbench shows incorrect time elapsed for backups. See screenshot.

On closer inspection,  WB is subtracting two timestamp columns which is not the correct way to do it.

How to repeat:
This shows the error that WB makes:

set sql_mode='';
drop table if exists t;
create table t(
 a timestamp not null default '0000-00-00 00:00:00', 
 b timestamp not null default '0000-00-00 00:00:00'
)engine=innodb;

insert into t values('2017-03-29 21:00:01','2017-03-29 22:50:48');
select b,a,b-a from t; -- this is how workbench does it!!!

select 
  unix_timestamp(b),
  unix_timestamp(a),
  unix_timestamp(b)-unix_timestamp(a),
  sec_to_time(unix_timestamp(b)-unix_timestamp(a))
from t;   -- more correct

Suggested fix:
In wb_admin_meb_overview.py:

result = self._context.ctrl_be.exec_query("""
                SELECT backup_id, backup_type, backup_format, exit_state, start_time, end_time, 
sec_to_time(unix_timestamp(end_time)-unix_timestamp(start_time)) as elapsed_time, backup_destination, last_error
                    FROM mysql.backup_history bh
                    WHERE start_time %s
                    ORDER BY start_time DESC
                    """ % time_condition)
[14 May 2018 10:13] Miguel Tadeu Mota
Posted by developer:
 
commit id: 3392483cae8a61a7705f98cb37233de4e2443219
[30 May 2018 15:50] Christine Cole
Posted by developer:
 
Fixed as of the upcoming MySQL Workbench 8.0.12 release, and here's the changelog entry:

Time stamps representing the elapsed time of backup operations were
miscalculated.

Thank you for the bug report.