Bug #57662 | Incorrect Query Duration When useNanosForElapsedTime Enabled | ||
---|---|---|---|
Submitted: | 22 Oct 2010 15:01 | Modified: | 5 Sep 2012 18:09 |
Reporter: | John McCarthy | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / J | Severity: | S3 (Non-critical) |
Version: | 5.1.13 | OS: | Any |
Assigned to: | Alexander Soklakov | CPU Architecture: | Any |
[22 Oct 2010 15:01]
John McCarthy
[27 Jul 2011 22:23]
Knut Forkalsrud
I can confirm this bug, it is somewhat annoying, and the fix as detailed above is obvious. From what I can tell all the other uses of System.currentTimeMillis() in MysqlIO.java are correct. The only other thing I would change is the cast to int near line 1426 of ServerPreparedStatement.java. There is no point casting the duration to an int, it will only limit the durations that can reliably be reported (with useNanosForElapsedTime enabled) to 2^31 nanoseconds, or about 21.5 seconds.
[3 Jul 2012 11:36]
Alexander Soklakov
Hi John, Thank you for the bug report. Verified as described.
[5 Sep 2012 18:09]
John Russell
Added to changelog for 5.1.22: With profileSQL=true and useNanosForElapsedTime=true specified in the connection URL, query and fetch duration were not reported correctly. The com.mysql.jdbc.MysqlIO.sqlQueryDirect() method always measured times in milliseconds rather than switching between milliseconds and nanoseconds.