Bug #27638 slow logging to CSV table inserts bad query_time and lock_time values
Submitted: 4 Apr 2007 7:28 Modified: 7 Apr 2007 18:29
Reporter: Timothy Smith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:5.1.18-bk OS:Any
Assigned to: Timothy Smith CPU Architecture:Any

[4 Apr 2007 7:28] Timothy Smith
Description:
Log_to_csv_event_handler::log_slow() tries to store the number of seconds (for query_time or lock_time) directly in a TIME field via Field_time::store(longlong, bool).  However, that function expects a number in the format HHHMMSS, not a number of seconds.

How to repeat:
Noticed due to valgrind failure in count_distinct3 and multi_update tests, with slow log running.  Valgrind failure is a separate problem with pushing errors inside logging functions, not directly related to this bug.

Suggested fix:
Call calc_time_from_sec() and Field_time::store_time().
[4 Apr 2007 9:11] 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/23761

ChangeSet@1.2559, 2007-04-04 11:11:18+02:00, tsmith@quadxeon.mysql.com +2 -0
  Bug #27638: slow logging to CSV table inserts bad query_time and lock_time values
  
  When MySQL logged slow query information to a CSV table, it stored the
  query_time and lock_time values with an incorrect formula.
  
  If the time was over 59 seconds, this caused incorrect statistics (either the
  slow query was not logged, or the time was far from correct).  This change
  fixes the method used to store those TIME values in the slow_log table.
[4 Apr 2007 17:12] Timothy Smith
Updated patch:
http://lists.mysql.com/commits/23817

(to->neg can't be cleared in calc_time_from_sec(), see for example Item_func_timediff::val_str())
[4 Apr 2007 19:41] 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/23833

ChangeSet@1.2559, 2007-04-04 21:40:47+02:00, tsmith@quadxeon.mysql.com +6 -0
  Bug #27638: slow logging to CSV table inserts bad query_time and lock_time values
  
  When MySQL logged slow query information to a CSV table, it stored the
  query_time and lock_time values with an incorrect formula.
  
  If the time was over 59 seconds, this caused incorrect statistics (either the
  slow query was not logged, or the time was far from correct).  This change
  fixes the method used to store those TIME values in the slow_log table.
[6 Apr 2007 17:25] Bugs System
Pushed into 5.1.18-beta
[7 Apr 2007 18:29] Paul Dubois
Noted in 5.1.18 changelog.