Bug #91496 | Regression: Slow_queries status variable isn't incremented if slow query is off | ||
---|---|---|---|
Submitted: | 29 Jun 2018 11:40 | Modified: | 7 Jun 2022 15:43 |
Reporter: | Mikiya Okuno | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Logging | Severity: | S3 (Non-critical) |
Version: | 5.7.3 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[29 Jun 2018 11:40]
Mikiya Okuno
[29 Jun 2018 12:05]
MySQL Verification Team
The suggest fix was wrong. The following patch is the true fix. diff --git a/sql/log.cc b/sql/log.cc index e9b43a6..1a0669a 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1711,7 +1711,6 @@ bool log_slow_applicable(THD *thd) void log_slow_do(THD *thd) { THD_STAGE_INFO(thd, stage_logging_slow_query); - thd->status_var.long_query_count++; if (thd->rewritten_query.length()) query_logger.slow_log_write(thd, @@ -1724,6 +1723,10 @@ void log_slow_do(THD *thd) void log_slow_statement(THD *thd) { + if (thd->server_status & SERVER_QUERY_WAS_SLOW) + { + thd->status_var.long_query_count++; + } if (log_slow_applicable(thd)) log_slow_do(thd); }
[26 Aug 2019 15:53]
Paul DuBois
Posted by developer: Fixed in 8.0.19. For slow query logging, the Slow_queries was not implemented unless the slow query log was enabled, contrary to the documentation.
[27 Aug 2021 5:40]
MySQL Verification Team
Bug #104240 marked as duplicate of this one.
[7 Jun 2022 15:43]
Daniel Price
Posted by developer: Fixed as of the upcoming 8.0.30 release: For slow query logging, the Slow_queries status variable was not implemented unless the slow query log was enabled, contrary to the documentation.