Commit 5aa34462 authored by unknown's avatar unknown

BUG#18669: Session COM_STATISTICS breaks mysqladmin status.

Changed COM_STATISTICS to display the global status, instead of thead status, for slow queries and table opens.


sql/sql_parse.cc:
  Calculate and display the global statistics.
parent 42c47bcb
...@@ -1992,13 +1992,17 @@ bool dispatch_command(enum enum_server_command command, THD *thd, ...@@ -1992,13 +1992,17 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
#else #else
char *buff= thd->net.last_error; char *buff= thd->net.last_error;
#endif #endif
STATUS_VAR current_global_status_var;
calc_sum_of_all_status(&current_global_status_var);
ulong uptime = (ulong) (thd->start_time - start_time); ulong uptime = (ulong) (thd->start_time - start_time);
sprintf((char*) buff, sprintf((char*) buff,
"Uptime: %lu Threads: %d Questions: %lu Slow queries: %lu Opens: %lu Flush tables: %lu Open tables: %u Queries per second avg: %.3f", "Uptime: %lu Threads: %d Questions: %lu Slow queries: %lu Opens: %lu Flush tables: %lu Open tables: %u Queries per second avg: %.3f",
uptime, uptime,
(int) thread_count, (ulong) thd->query_id, (int) thread_count, (ulong) thd->query_id,
(ulong) thd->status_var.long_query_count, current_global_status_var.long_query_count,
thd->status_var.opened_tables, refresh_version, cached_tables(), current_global_status_var.opened_tables, refresh_version, cached_tables(),
(uptime ? (ulonglong2double(thd->query_id) / (double) uptime) : (uptime ? (ulonglong2double(thd->query_id) / (double) uptime) :
(double) 0)); (double) 0));
#ifdef SAFEMALLOC #ifdef SAFEMALLOC
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment