Bug #42632 Documentation on GLOBAL vs. SESSION status values is wrong
Submitted: 5 Feb 2009 20:33 Modified: 12 Feb 2009 18:00
Reporter: Harrison Fisk Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S2 (Serious)
Version:5.0 OS:Any
Assigned to: Paul DuBois CPU Architecture:Any

[5 Feb 2009 20:33] Harrison Fisk
Description:
Based on http://dev.mysql.com/doc/refman/5.0/en/server-status-variables.html

I have tried to verify which are global | session for real.  

To find which ones are really global vs. session, I used the following logic:

Look at struct show_var_st status_vars in mysqld.cc for list of values. 
 
If it is defined with a direct variable, and one of the types SHOW_LONG, SHOW_LONG_CONST, or SHOW_INT_CONST, then it is GLOBAL only.

If is defined with a reference to offsetof(STATUS_VAR, ...) and SHOW_LONG_STATUS, SHOW_LONGLONG_STATUS, or SHOW_DOUBLE_STATUS then it is GLOBAL | SESSION.

If it is defined with any other final type, such as SHOW_OPENTABLES, SHOW_SLAVE_RUNNING, etc... then you need to go to the file show_status_array and check on it.  These are generally global, but are not necessarily.

Storage engines have a placeholder entry in this file, such as "Innodb_" and "Ndb_".  They generate the actual status variables in their appropriate handler files from the structure mentioned in the placeholder.  They follow the same rules as above for determining their GLOBAL vs. SESSION nature.

This might work differently in 5.1, I have only verified in 5.0.

How to repeat:
Issue SHOW GLOBAL STATUS vs. SHOW SESSION STATUS and notice that things like Uptime are not really session specific.

Suggested fix:
Corrected chart of status values is attached.
[5 Feb 2009 20:34] Harrison Fisk
List of status variables with corrected values.

Attachment: correct_status_values.txt (text/plain), 12.10 KiB.

[12 Feb 2009 18:00] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly, and will be included in the next release of the relevant products.