Description:
SHOW SESSION STATUS,
SHOW GLOBAL STATUS,
select * from INFORMATION_SCHEMA.SESSION_STATUS (in 5.1),
select * from INFORMATION_SCHEMA.GLOBAL_STATUS (in 5.1),
return status data that either does not make sense, or returns incorrect results.
The expected result is that, if a status variable:
- is a property of a *session* only, it should be displayed in SHOW SESSION
status, but not in SHOW GLOBAL STATUS.
- is a property of the *global* server status, if should be displayed in
SHOW GLOBAL STATUS only, but not in SHOW SESSION STATUS
- is a property of a *session*, that can be aggregated (summed) for the entire
server, if should be displayed in SHOW SESSION STATUS and SHOW GLOBAL STATUS,
and the result for SHOW GLOBAL STATUS should actually be the sum of the status
for each session.
In other words, if SHOW STATUS returns a status variable,
this status variable should have a well defined semantic,
as well as a correct associated value.
Actual results :
Every status variable is displayed both in SESSION and GLOBAL status,
leading to invalid output.
How to repeat:
SHOW SESSION STATUS displays the following:
- Aborted_clients, Aborted_connects, Connections ... (many more)
--> What does that mean ?
How can "Aborted_clients" be a property of a session ?
- Delayed_errors, Delayed_insert_threads, Delayed_writes ... (many more)
--> wrong result, the stats returned are not for the session but global
SHOW GLOBAL STATUS displays the following:
- Ssl_version (and others)
--> what does that mean, considering that Ssl_version seems to be a property
of each session ?
- Ssl_sessions_reused
--> wrong results, the code returns this counter for the current connection,
not the sum (as one could expect with other counters like Bytes_received)
for all the sessions in the server.
Suggested fix:
Add a bit flag to the SHOW_VAR structure, to indicate if it's a:
- session variable
- global variable
- both
and make use of the flag to filter the status_vars[] array when implementing
SHOW [SESSION|GLOBAL] STATUS,
as well as
select * from INFORMATION_SCHEMA.SESSION_STATUS (in 5.1),
select * from INFORMATION_SCHEMA.GLOBAL_STATUS (in 5.1)