Commit b6c5657e authored by Monty's avatar Monty Committed by Sergei Golubchik

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.
parent ffb17a65
......@@ -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,
......
......@@ -192,13 +192,8 @@ extern wsrep_seqno_t wsrep_locked_seqno;
? wsrep_forced_binlog_format : (ulong)(my_format))
// prefix all messages with "WSREP"
#define WSREP_LOG(fun, ...) \
do { \
char msg[1024] = {'\0'}; \
snprintf(msg, sizeof(msg) - 1, ## __VA_ARGS__); \
fun("WSREP: %s", msg); \
} while(0)
void wsrep_log(void (*fun)(const char *, ...), const char *format, ...);
#define WSREP_LOG(fun, ...) wsrep_log(fun, ## __VA_ARGS__)
#define WSREP_LOG_CONFLICT_THD(thd, role) \
WSREP_LOG(sql_print_information, \
"%s: \n " \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment