mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Rewrite profiler code to be easier to maintain and less buggy.
Between 5.0 and 5.1, the step of incrementing the global query id changed, which broke how the profiler noticed when a new query had started. That reset the state list and caused all but the last five (or so) states to be thrown away. Now, don't watch for query_id changes in the lower level. Add a bogus state change at the end of profiling so that the last real state change is timed. Emit source reference for the start of the span of time instead of the end of it. mysql-test/r/profiling.result: Add a test that shows continuation of execution with multi-statement packets. mysql-test/t/profiling.test: Add a test that shows continuation of execution with multi-statement packets. sql/sql_parse.cc: Insert profiling calls at beginnings and ends of each query. Remove the old way of keeping or discarding profiles, and flipping to new query profiles. sql/sql_profile.cc: No longer use the thread's query_id to determine when we flip to a new statement. Some status statements are set to be NULL in the server. We don't log those, as it doesn't fit this style of profiling yet. Rewrite the parser code to be more active and legible. Relying on passive/lazy discovery of new queries was buggy. Add a bogus status change before ending a profile, so that the previous real status has a endpoint. Emit source reference of the start of the span-of-time instead of the end of it. sql/sql_profile.h: Store the server_query_id at instantiation time for a new query. Rewrite the parser code to be more active. Relying on passive/lazy discovery of new queries was buggy. Name first state to more honestly describe the state. We don't really know of initialization that will follow. sql/sql_show.cc: Update comment to note the decidedly weird field_length behavior on Decimal types in information_schema.
This commit is contained in:
@ -5361,17 +5361,24 @@ ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Create information_schema table using schema_table data
|
||||
/**
|
||||
Create information_schema table using schema_table data.
|
||||
|
||||
SYNOPSIS
|
||||
create_schema_table()
|
||||
@note
|
||||
For MYSQL_TYPE_DECIMAL fields only, the field_length member has encoded
|
||||
into it two numbers, based on modulus of base-10 numbers. In the ones
|
||||
position is the number of decimals. Tens position is unused. In the
|
||||
hundreds and thousands position is a two-digit decimal number representing
|
||||
length. Encode this value with (decimals*100)+length , where
|
||||
0<decimals<10 and 0<=length<100 .
|
||||
|
||||
@param
|
||||
thd thread handler
|
||||
@param
|
||||
schema_table pointer to 'shema_tables' element
|
||||
|
||||
RETURN
|
||||
# Pointer to created table
|
||||
0 Can't create table
|
||||
@retval \# Pointer to created table
|
||||
@retval NULL Can't create table
|
||||
*/
|
||||
|
||||
TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
|
||||
|
Reference in New Issue
Block a user