Exclude MXS_DEBUG in release builds

Now, MXS_DEBUG turns into a nop in release builds.
This commit is contained in:
Johan Wikman 2016-10-24 13:41:00 +03:00
parent 1a2e0ba3ee
commit 3915b4e7c7
8 changed files with 23 additions and 26 deletions

View File

@ -247,7 +247,11 @@ To disable these messages use the value 0 and to enable them use the value 1.
#### `log_debug`
Enable or disable the logging of messages whose syslog priority is *debug*. This kind of messages are intended for development purposes and are disabled by default.
Enable or disable the logging of messages whose syslog priority is *debug*.
This kind of messages are intended for development purposes and are disabled
by default. Note that if MariaDB MaxScale has been built in release mode, then
debug messages are excluded from the build and this setting will not have any
effect.
```
# Valid options are:

View File

@ -156,7 +156,12 @@ int mxs_log_message(int priority,
#define MXS_WARNING(format, ...) MXS_LOG_MESSAGE(LOG_WARNING, format, ##__VA_ARGS__)
#define MXS_NOTICE(format, ...) MXS_LOG_MESSAGE(LOG_NOTICE, format, ##__VA_ARGS__)
#define MXS_INFO(format, ...) MXS_LOG_MESSAGE(LOG_INFO, format, ##__VA_ARGS__)
#if defined(SS_DEBUG)
#define MXS_DEBUG(format, ...) MXS_LOG_MESSAGE(LOG_DEBUG, format, ##__VA_ARGS__)
#else
#define MXS_DEBUG(format, ...)
#endif
/**
* Log an out of memory error using custom message.

View File

@ -2919,20 +2919,16 @@ dcb_create_SSL(DCB* dcb, SSL_LISTENER *ssl)
*/
int dcb_accept_SSL(DCB* dcb)
{
int ssl_rval;
char *remote;
char *user;
if ((NULL == dcb->listener || NULL == dcb->listener->ssl) ||
(NULL == dcb->ssl && dcb_create_SSL(dcb, dcb->listener->ssl) != 0))
{
return -1;
}
remote = dcb->remote ? dcb->remote : "";
user = dcb->user ? dcb->user : "";
ss_debug(char *remote = dcb->remote ? dcb->remote : "");
ss_debug(char *user = dcb->user ? dcb->user : "");
ssl_rval = SSL_accept(dcb->ssl);
int ssl_rval = SSL_accept(dcb->ssl);
switch (SSL_get_error(dcb->ssl, ssl_rval))
{

View File

@ -1044,9 +1044,8 @@ process_pollq(int thread_id)
if (ev & EPOLLHUP)
{
int eno = 0;
eno = gw_getsockerrno(dcb->fd);
char errbuf[MXS_STRERROR_BUFLEN];
ss_debug(int eno = gw_getsockerrno(dcb->fd));
ss_debug(char errbuf[MXS_STRERROR_BUFLEN]);
MXS_DEBUG("%lu [poll_waitevents] "
"EPOLLHUP on dcb %p, fd %d. "
"Errno %d, %s.",
@ -1080,9 +1079,8 @@ process_pollq(int thread_id)
#ifdef EPOLLRDHUP
if (ev & EPOLLRDHUP)
{
int eno = 0;
eno = gw_getsockerrno(dcb->fd);
char errbuf[MXS_STRERROR_BUFLEN];
ss_debug(int eno = gw_getsockerrno(dcb->fd));
ss_debug(char errbuf[MXS_STRERROR_BUFLEN]);
MXS_DEBUG("%lu [poll_waitevents] "
"EPOLLRDHUP on dcb %p, fd %d. "
"Errno %d, %s.",

View File

@ -1199,7 +1199,6 @@ get_users(SERV_LISTENER *listener, USERS *users)
MYSQL_PASSWORD_LEN +
sizeof(char) +
MYSQL_DATABASE_MAXLEN;
int dbnames = 0;
int db_grants = 0;
char dbnm[MYSQL_DATABASE_MAXLEN + 1];
bool anon_user = false;
@ -1454,7 +1453,7 @@ get_users(SERV_LISTENER *listener, USERS *users)
if (db_grants)
{
/* load all mysql database names */
dbnames = get_databases(listener, con);
ss_debug(int dbnames =) get_databases(listener, con);
MXS_DEBUG("Loaded %d MySQL Database Names for service [%s]",
dbnames, service->name);
}

View File

@ -914,9 +914,8 @@ static void freeSession(ROUTER* router_instance,
{
ROUTER_INSTANCE *router = (ROUTER_INSTANCE *)router_instance;
ROUTER_SLAVE *slave = (ROUTER_SLAVE *)router_client_ses;
int prev_val;
prev_val = atomic_add(&router->stats.n_slaves, -1);
ss_debug(int prev_val = ) atomic_add(&router->stats.n_slaves, -1);
ss_dassert(prev_val > 0);
/*

View File

@ -633,9 +633,8 @@ static void freeSession(ROUTER* router_instance, void* router_client_ses)
ROUTER_INSTANCE* router = (ROUTER_INSTANCE *) router_instance;
ROUTER_CLIENT_SES* router_cli_ses =
(ROUTER_CLIENT_SES *) router_client_ses;
int prev_val;
prev_val = atomic_add(&router_cli_ses->backend->current_connection_count, -1);
ss_debug(int prev_val = ) atomic_add(&router_cli_ses->backend->current_connection_count, -1);
ss_dassert(prev_val > 0);
spinlock_acquire(&router->lock);

View File

@ -3578,17 +3578,14 @@ static void tracelog_routed_query(ROUTER_CLIENT_SES* rses,
size_t buflen = GWBUF_LENGTH(buf);
char* querystr;
char* startpos = (char *)&packet[5];
BACKEND* b;
backend_type_t be_type;
DCB* dcb;
CHK_BACKEND_REF(bref);
b = bref->bref_backend;
ss_debug(BACKEND *b = bref->bref_backend);
CHK_BACKEND(b);
dcb = bref->bref_dcb;
ss_debug(DCB *dcb = bref->bref_dcb);
CHK_DCB(dcb);
be_type = BACKEND_TYPE(b);
ss_debug(backend_type_t be_type = BACKEND_TYPE(b));
if (GWBUF_IS_TYPE_MYSQL(buf))
{