Further enhancement in prepared statement logging #4861#4922
Merged
renecannao merged 6 commits intov3.0from May 8, 2025
Merged
Further enhancement in prepared statement logging #4861#4922renecannao merged 6 commits intov3.0from
renecannao merged 6 commits intov3.0from
Conversation
In bufferTypeInfoMap , use sizeof(MYSQL_TIME) for the size of these types: * MYSQL_TYPE_TIMESTAMP * MYSQL_TYPE_DATE * MYSQL_TYPE_TIME * MYSQL_TYPE_DATETIME Notes: * sizeof(MYSQL_TIME) is 40 * client library may use MYSQL_TYPE_DATETIME for all of these types
When logging the parameters of COM_STMT_EXECUTE , use sizeof(MYSQL_TIME) for these types: * MYSQL_TYPE_TIMESTAMP * MYSQL_TYPE_DATE * MYSQL_TYPE_TIME * MYSQL_TYPE_DATETIME Notes: * sizeof(MYSQL_TIME) is 40 * client library may use MYSQL_TYPE_DATETIME for all of these types
When parameters are strings or blobs, they are always converted to hex
Variable mysql-eventslog_stmt_parameters configures the logging of parameters in prepared statements: - 0 : logging disabled - 1 : logging enabled
…ters Now that variable `mysql-eventslog_stmt_parameters` is present and disabled by default, `mysql-eventslog_stmt_parameters` needs to be enabled to run test `test_ps_logging-t`
When creating an event log in binary format, a metadata packet is written. The metadata is in JSON format. It currently only provide the ProxySQL version. For illustration purposes, tool eventlog_reader_to_json.cpp supports it too. This commit includes also some reformatting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proper use of DATETIME/TIME/DATE/TIMESTAMP
For columns DATETIME/TIME/DATE/TIMESTAMP , in MYSQL_BIND they are set as length = 0 , but their real size is
sizeof(MYSQL_TIME)(40 bytes) .For reference,
MYSQL_TIMEis defined as:It is also worth to notice that during the execution of
COM_STMT_EXECUTEthe client library may choose a datatype different than the column type. This because the client library specifies the format of the data being sent.This means that client library could use a
STRINGformat when sendingDATETIME/TIME/DATE/TIMESTAMP, or always specifyDATETIMEbecause the encoding is always the same.Use hex encoding for string
STRING and BLOB are encoded in hex format. This is useful especially for blob, but blob are often sent as string, thus the same encoding is applied for both
Adding new variable
mysql-eventslog_stmt_parameters#4923Because of the overhead of logging prepared statements parameters , especially in JSON format and in the presence of large blob, new variable
mysql-eventslog_stmt_parameterscontrols if parameters need to be logged or not## Adding event_type
PROXYSQL_METADATAWhen creating an event log in binary format, a metadata packet is written.
The metadata is in JSON format.
It currently only provide the ProxySQL version.
This allows application reading the binary format file to identify the ProxySQL version thus know what format is used.
For illustration purposes, tool eventlog_reader_to_json.cpp supports it too.