-
Marc Alff authored
This bug is caused by the lack of integration between: - the IDLE instrumentation - the SOCKET instrumentation - the STATEMENT instrumentation - the STAGE instrumentation in the server. While each instrumentation taken individually works, the overall result is events that do not properly relate to each others. The fix consist of several parts. 1) Define a network call back interface for the NET structure, so that the network layer can notify events when a packet header is seen. This part is critical to isolate all the SQL layer performance schema related instrumentation from the NET code. 2) Use this call back interface internally in mysqld, to call the IDLE / SOCKET / STATEMENT / STAGE instrumentation in a coherent way, respecting the logical order or events. 3) IDLE instrumentation: - IDLE events are generated with a NULL NESTING_EVENT_ID parent - HAVE_PSI_IDLE_INTERFACE was missing and has been added, to facilitate building without the IDLE instrumentation. 4) STATEMENT instrumentation: Statements are now created (MYSQL_START_STATEMENT) much sooner, when a new packet header is seen. As a result, a new statement instrument "statement/com/", has been defined to represent a statement just started. Also, in release builds only, a spurious "statement/sql/" statement existed, due to a bug related to SHOW PROCEDURE CODE and SHOW FUNCTION CODE, for which no statement name was defined in release builds. This has been fixed. 4) SOCKET instrumentation: no changes in the code itself. SOCKET events are now properly recorded as childrens of a statement, due to the reordering of MYSQL_START_STATEMENT. 5) STAGES instrumentation no changes in the code itself. The first stage ("stage/sql/init") is now started right after a statement starts. 6) Existing test cases tests events_aggregates* were missing instrumentation for "statement/com/Query", so that SQL statements that were intended to be recorded were not. This has been fixed in the tests. Tests outputs have been adjusted, as there is a new statement class. A new test, nesting.test, shows precise events dependencies between all events.
Marc Alff authoredThis bug is caused by the lack of integration between: - the IDLE instrumentation - the SOCKET instrumentation - the STATEMENT instrumentation - the STAGE instrumentation in the server. While each instrumentation taken individually works, the overall result is events that do not properly relate to each others. The fix consist of several parts. 1) Define a network call back interface for the NET structure, so that the network layer can notify events when a packet header is seen. This part is critical to isolate all the SQL layer performance schema related instrumentation from the NET code. 2) Use this call back interface internally in mysqld, to call the IDLE / SOCKET / STATEMENT / STAGE instrumentation in a coherent way, respecting the logical order or events. 3) IDLE instrumentation: - IDLE events are generated with a NULL NESTING_EVENT_ID parent - HAVE_PSI_IDLE_INTERFACE was missing and has been added, to facilitate building without the IDLE instrumentation. 4) STATEMENT instrumentation: Statements are now created (MYSQL_START_STATEMENT) much sooner, when a new packet header is seen. As a result, a new statement instrument "statement/com/", has been defined to represent a statement just started. Also, in release builds only, a spurious "statement/sql/" statement existed, due to a bug related to SHOW PROCEDURE CODE and SHOW FUNCTION CODE, for which no statement name was defined in release builds. This has been fixed. 4) SOCKET instrumentation: no changes in the code itself. SOCKET events are now properly recorded as childrens of a statement, due to the reordering of MYSQL_START_STATEMENT. 5) STAGES instrumentation no changes in the code itself. The first stage ("stage/sql/init") is now started right after a statement starts. 6) Existing test cases tests events_aggregates* were missing instrumentation for "statement/com/Query", so that SQL statements that were intended to be recorded were not. This has been fixed in the tests. Tests outputs have been adjusted, as there is a new statement class. A new test, nesting.test, shows precise events dependencies between all events.
Loading