-
Marc Alff authored
BEHAVIOR WITH PERF. SCHEMA VS. WITHOUT IT Context: ======== Before the fix for MySQL BUG 78777, THD::proc_info was not reset when a session goes IDLE. While SHOW PROCESSLIST handled this case, SHOW ENGINE INNODB STATUS did not, and displayed an incorrect status for an idle thread. The fix for bug 78777 exposed then another issue: When a session that was IDLE is now active again, aka when a request is received, the session status is not always changed back to reflect the statement execution. When compiling with the performance schema, the session status was changed to Init, as expected. When compiling without the performance schema, the session status was left unchanged. In particular for the SHOW PROCESSLIST statement, the STATE column for the running session did not reflect that this statement is being executed (with a state set to Init). Having statements that behave differently with and without the performance schema is very undesirable, as this confuse monitoring tools and cause regressions. Root cause: =========== The problem is with init_net_server_extension(). When compiling without the performance schema, this function takes a shortcut and do not hook up net_before_header_psi() and net_after_header_psi() at all, assuming these functions have no effect. This is incorrect, init_net_server_extension() has an effect even without hte performance schema, because the call to THD_STAGE_INFO() affects THD::proc_info, which is the data exposed in column STATE in SHOW PROCESSLIST. The reason for THD_STAGE_INFO() to behave this way is to maintain consistency between - the (relatively recent) performance schema STAGE instrumentation - the existing THD::proc_info instrumentation, which has to be preserved for backward compatibility. Fix: ==== In init_net_server_extension(), do not take shortcuts when compiling without the performance schema. Invoke net_after_header_psi() normally, by hooking up the callback. Tested both with and without the performance schema.
Marc Alff authoredBEHAVIOR WITH PERF. SCHEMA VS. WITHOUT IT Context: ======== Before the fix for MySQL BUG 78777, THD::proc_info was not reset when a session goes IDLE. While SHOW PROCESSLIST handled this case, SHOW ENGINE INNODB STATUS did not, and displayed an incorrect status for an idle thread. The fix for bug 78777 exposed then another issue: When a session that was IDLE is now active again, aka when a request is received, the session status is not always changed back to reflect the statement execution. When compiling with the performance schema, the session status was changed to Init, as expected. When compiling without the performance schema, the session status was left unchanged. In particular for the SHOW PROCESSLIST statement, the STATE column for the running session did not reflect that this statement is being executed (with a state set to Init). Having statements that behave differently with and without the performance schema is very undesirable, as this confuse monitoring tools and cause regressions. Root cause: =========== The problem is with init_net_server_extension(). When compiling without the performance schema, this function takes a shortcut and do not hook up net_before_header_psi() and net_after_header_psi() at all, assuming these functions have no effect. This is incorrect, init_net_server_extension() has an effect even without hte performance schema, because the call to THD_STAGE_INFO() affects THD::proc_info, which is the data exposed in column STATE in SHOW PROCESSLIST. The reason for THD_STAGE_INFO() to behave this way is to maintain consistency between - the (relatively recent) performance schema STAGE instrumentation - the existing THD::proc_info instrumentation, which has to be preserved for backward compatibility. Fix: ==== In init_net_server_extension(), do not take shortcuts when compiling without the performance schema. Invoke net_after_header_psi() normally, by hooking up the callback. Tested both with and without the performance schema.
Loading