diff options
author | Monty <monty@mariadb.org> | 2017-08-06 21:53:49 +0300 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2017-08-24 01:05:52 +0200 |
commit | b6c5657ef27de034439b1505a8b4815c263d6455 (patch) | |
tree | a0bcef3957b1e7f5f7e8423f245ffce97f5e6ae5 /sql/wsrep_mysqld.cc | |
parent | ffb17a6509168c34465f4d3b0605a3b4198c05ef (diff) | |
download | mariadb-git-b6c5657ef27de034439b1505a8b4815c263d6455.tar.gz |
Reduce stack size
WSREP_LOG increased the stack size of all function, where it was used,
with 1024 bytes, even if it would never called. What's worse is that one
a Mac with Lion 10.7, the stack size was increased with 1024* number of
calls per function.
By moving WSREP_LOG() to a function, the stack size on Lion in function
mysql_execute() was reduced from 18K to 12K. On my main Linux machine
with gcc 5.4 the reduction was from 5k to 4k.
Diffstat (limited to 'sql/wsrep_mysqld.cc')
-rw-r--r-- | sql/wsrep_mysqld.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 2854a9b162a..947492e2b73 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -246,6 +246,17 @@ static void wsrep_log_cb(wsrep_log_level_t level, const char *msg) { } } +void wsrep_log(void (*fun)(const char *, ...), const char *format, ...) +{ + va_list args; + char msg[1024]; + va_start(args, format); + vsnprintf(msg, sizeof(msg) - 1, format, args); + va_end(args); + (fun)("WSREP: %s", msg); +} + + static void wsrep_log_states (wsrep_log_level_t const level, const wsrep_uuid_t* const group_uuid, wsrep_seqno_t const group_seqno, |