Bug #53874 SETUP_INSTRUMENTS.TIMED='NO' should not change TIMER_WAIT in aggregations
Submitted: 21 May 2010 6:56 Modified: 8 Sep 2010 1:55
Reporter: Marc ALFF Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Performance Schema Severity:S3 (Non-critical)
Version:5.5.3-m3, 5.5.4-m3 OS:Any
Assigned to: Christopher Powers CPU Architecture:Any

[21 May 2010 6:56] Marc ALFF
Description:
When using the performance schema without timers,
the SUM/MIN/MAX/AVG TIMER_WAIT in aggregations are garbage instead of 0.

How to repeat:
update performance_schema.SETUP_INSTRUMENTS set TIMED='NO';
truncate performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;
select * from performance_schema.EVENTS_WAITS_SUMMARY_BY_EVENT_NAME;

Suggested fix:
N/A
[19 Aug 2010 22:25] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/116305

3188 Christopher Powers	2010-08-19
      Bug#53874, "SETUP_INSTRUMENTS.TIMED='NO' should not change TIMER_WAIT in aggregations"
      
      end_*_wait() functions now honor TIMER_STATE_UNTIMED
     @ storage/perfschema/pfs.cc
        Don't aggregate stats if TIMER_STATE_UNTIMED
[20 Aug 2010 13:31] Kevin Lewis
Code change looks appropriate and correct.
[20 Aug 2010 14:44] Christopher Powers
The end wait functions ignored the timer state when collecting stats such that, even when the 'TIMED' flag in the SETUP_INSTRUMENTS table was set to 'NO', stats were still aggregated.
[23 Aug 2010 16:49] Marc ALFF
The patch posted previously is incorrect, and should not be pushed.

Changing the bug status back to in progress.

What needs to happen is:

1) with ENABLED='YES' and TIMED='YES',
update the columns COUNT_STAR, MIN/AVG/MAX TIMER_WAIT

this worked before and after the proposed patch.

2) with ENABLED='YES' and TIMED='NO',
update the column COUNT_STAR only.

This was broken before the fix, because the MIN/AVG/MAX TIMER_WAIT
columns were updated with garbage (hence the bug report).

Now with the proposed patch, the column COUNT_STAR that *was* aggregated
is not updated any more.

The fix introduced a regression, and needs to be re worked.

Also, test cases need to be added to the test suite, to clarify the desired behavior here.
[25 Aug 2010 9:23] Bugs System
Pushed into mysql-5.5 5.5.6-m3 (revid:alik@ibmvm-20100825092002-2yvkb3iwu43ycpnm) (version source revid:alik@ibmvm-20100825092002-2yvkb3iwu43ycpnm) (merge vers: 5.5.6-m3) (pib:20)
[25 Aug 2010 18:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/116795

3193 Christopher Powers	2010-08-25
      Bug# 53874 "SETUP_INSTRUMENTS.TIMED='NO' should not change TIMER_WAIT
      
      Handle combined instrument states of ENABLED and/or TIMED:
      
      ENABLED TIMED  
        1       1   Aggregate stats, increment counter
        1       0   Increment counter
        0       1   Do nothing
        0       0   Do nothing 
       
     @ storage/perfschema/pfs.cc
        Aggregate stats only if state is both ENABLED and TIMED. If ENABLED
        but not TIMED, only increment the value counter.
     @ storage/perfschema/pfs_stat.h
        Split aggregate and counter increment into separate
        methods for performance.
[26 Aug 2010 15:47] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/116920

3197 Christopher Powers	2010-08-26
      Bug# 53874 "SETUP_INSTRUMENTS.TIMED='NO' should not change TIMER_WAIT
      
      Handle combined instrument states of ENABLED and/or TIMED:
      
      ENABLED TIMED
      1 1 Aggregate stats, increment counter
      1 0 Increment counter
      0 1 Do nothing
      0 0 Do nothing 
     @ storage/perfschema/pfs.cc
        Aggregate stats only if state is both ENABLED and TIMED. If ENABLED
        but not TIMED, only increment the value counter.
     @ storage/perfschema/pfs_stat.h
        Split aggregate and counter increment into separate
        methods for performance.
[26 Aug 2010 16:00] Marc ALFF
Last patch 
  http://lists.mysql.com/commits/116920
approved, thanks for the fix.
[26 Aug 2010 20:19] Christopher Powers
Patch queued into:

mysql-trunk-bugfixing
mysql-next-mr-bugfixing
[26 Aug 2010 21:30] Christopher Powers
Also queued to:

mysql-5.5-bugfixing
[30 Aug 2010 8:30] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@sun.com-20100830082732-n2eyijnv86exc5ci) (version source revid:alik@sun.com-20100830082732-n2eyijnv86exc5ci) (merge vers: 5.6.1-m4) (pib:21)
[30 Aug 2010 8:34] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100830082745-n6sh01wlwh3itasv) (version source revid:alik@sun.com-20100830082745-n6sh01wlwh3itasv) (pib:21)
[30 Aug 2010 8:36] Bugs System
Pushed into mysql-5.5 5.5.7-m3 (revid:alik@sun.com-20100830082727-5ac4czrxl61w9wle) (version source revid:alik@sun.com-20100830082727-5ac4czrxl61w9wle) (merge vers: 5.5.7-m3) (pib:21)
[8 Sep 2010 1:55] Paul DuBois
Noted in 5.5.6, 5.6.1 changelogs.

Setting SETUP_INSTRUMENTS.TIMER = 'NO' caused TIMER_WAIT values for
aggregations to be NULL rather than 0.
[9 Sep 2010 15:59] Paul DuBois
Fixed in 5.5.7, not 5.5.6.