summaryrefslogtreecommitdiff
path: root/sql/log.h
diff options
context:
space:
mode:
authorunknown <davi@moksha.com.br>2007-10-18 15:45:07 -0300
committerunknown <davi@moksha.com.br>2007-10-18 15:45:07 -0300
commitb9b481ec70c2475abb6303ae08c6b73592bf0c03 (patch)
tree540546209ad541756aaa56853f9a69fbf859a671 /sql/log.h
parent73458352133ac1d2660e60e84b96d3659cff399a (diff)
downloadmariadb-git-b9b481ec70c2475abb6303ae08c6b73592bf0c03.tar.gz
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.
Diffstat (limited to 'sql/log.h')
-rw-r--r--sql/log.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/log.h b/sql/log.h
index e597c986794..bef0101c8b5 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -499,6 +499,8 @@ public:
void lock_exclusive() { rw_wrlock(&LOCK_logger); }
void unlock() { rw_unlock(&LOCK_logger); }
bool is_log_table_enabled(uint log_table_type);
+ bool log_command(THD *thd, enum enum_server_command command);
+
/*
We want to initialize all log mutexes as soon as possible,
but we cannot do it in constructor, as safe_mutex relies on
@@ -518,6 +520,8 @@ public:
ulonglong current_utime);
bool general_log_print(THD *thd,enum enum_server_command command,
const char *format, va_list args);
+ bool general_log_write(THD *thd, enum enum_server_command command,
+ const char *query, uint query_length);
/* we use this function to setup all enabled log event handlers */
int set_handlers(uint error_log_printer,