Bug#21557 entries in the general query log truncated at 1000 characters.
The general log write function (general_log_print) uses printf style arguments which need to be pre-processed, meaning that the all arguments are copied to a single buffer and the problem is that the buffer size is constant (1022 characters) but queries can be much larger then this. The solution is to introduce a new log write function that accepts a buffer and it's length as arguments. The function is to be used when a formatted output is not required, which is the case for almost all query write-to-log calls. This is a incompatible change with respect to the log format of prepared statements. mysql-test/r/log_tables.result: Add test case result for Bug#21557 mysql-test/t/log_tables.test: Add test case for Bug#21557 sql/log.cc: Introduce the logger function general_log_write which is similar to general_log_print but accepts a single buffer and the buffer length. The function doesn't perform any formatting and sends the buffer directly to the underlying log handlers. sql/log.h: Introduce the logger function general_log_write. sql/log_event.cc: Pass the query buffer directly to the logger function, formatting is not required on this case. sql/mysql_priv.h: Prototype for the logger function general_log_write. sql/sp_head.cc: Pass the query buffer directly to the logger function, formatting is not required on this case. sql/sql_parse.cc: Pass the buffer directly to the logger function when formatting is not required. sql/sql_prepare.cc: Don't log the statement id, it avoids making a extra copy of the query and the query is not truncated anymore if it exceeds the limit.
Showing
Please register or sign in to comment