Session info always copied to tls

Maxadmin earlier gave the impression that you could change whether
messages for different log files could be specifically enabled for
a session. In practice that was true only for trace messages as the
session id and the bitmask telling what logfiles are enabled, were
copied to thread local storage only as far as trace messages were
concered.

The code for setting that information in place is quit short and
efficient, so there is really no reason not to do that always.
This also means that it always will be possible to get your hands
on the session object if there is a need for that.
This commit is contained in:
Johan Wikman
2015-11-23 12:31:01 +02:00
parent d7e685e2fe
commit 62b0e5fab0
3 changed files with 24 additions and 45 deletions

View File

@ -90,9 +90,6 @@ extern __thread log_info_t tls_log_info;
(log_ses_count[id] > 0 && \
tls_log_info.li_enabled_logs & id)) ? true : false)
#define LOG_MAY_BE_ENABLED(id) (((lm_enabled_logfiles_bitmask & id) || \
log_ses_count[id] > 0) ? true : false)
// TODO: Add this at a later stage.
#define MXS_LOG_PRIORITY_IS_ENABLED(priority) false

View File

@ -618,12 +618,9 @@ dcb_process_victim_queue(DCB *listofdcb)
}
}
if (LOG_MAY_BE_ENABLED(LOGFILE_TRACE))
{
dcb_get_ses_log_info(dcb,
&tls_log_info.li_sesid,
&tls_log_info.li_enabled_logs);
}
dcb->state = DCB_STATE_DISCONNECTED;
nextdcb = dcb->memdata.next;

View File

@ -858,12 +858,9 @@ unsigned long qtime;
if (eno == 0) {
atomic_add(&pollStats.n_write, 1);
/** Read session id to thread's local storage */
if (LOG_MAY_BE_ENABLED(LOGFILE_TRACE))
{
dcb_get_ses_log_info(dcb,
&tls_log_info.li_sesid,
&tls_log_info.li_enabled_logs);
}
if (poll_dcb_session_check(dcb, "write_ready"))
{
@ -891,12 +888,9 @@ unsigned long qtime;
dcb->fd);
atomic_add(
&pollStats.n_accept, 1);
if (LOG_MAY_BE_ENABLED(LOGFILE_TRACE))
{
dcb_get_ses_log_info(dcb,
&tls_log_info.li_sesid,
&tls_log_info.li_enabled_logs);
}
if (poll_dcb_session_check(dcb, "accept"))
{
@ -912,12 +906,9 @@ unsigned long qtime;
dcb->fd);
atomic_add(&pollStats.n_read, 1);
/** Read session id to thread's local storage */
if (LOG_MAY_BE_ENABLED(LOGFILE_TRACE))
{
dcb_get_ses_log_info(dcb,
&tls_log_info.li_sesid,
&tls_log_info.li_enabled_logs);
}
if (poll_dcb_session_check(dcb, "read"))
{
@ -951,12 +942,10 @@ unsigned long qtime;
}
atomic_add(&pollStats.n_error, 1);
/** Read session id to thread's local storage */
if (LOG_MAY_BE_ENABLED(LOGFILE_TRACE))
{
dcb_get_ses_log_info(dcb,
&tls_log_info.li_sesid,
&tls_log_info.li_enabled_logs);
}
if (poll_dcb_session_check(dcb, "error"))
{
dcb->func.error(dcb);
@ -983,12 +972,10 @@ unsigned long qtime;
dcb->flags |= DCBF_HUNG;
spinlock_release(&dcb->dcb_initlock);
/** Read session id to thread's local storage */
if (LOG_MAY_BE_ENABLED(LOGFILE_TRACE))
{
dcb_get_ses_log_info(dcb,
&tls_log_info.li_sesid,
&tls_log_info.li_enabled_logs);
}
if (poll_dcb_session_check(dcb, "hangup EPOLLHUP"))
{
dcb->func.hangup(dcb);
@ -1019,12 +1006,10 @@ unsigned long qtime;
dcb->flags |= DCBF_HUNG;
spinlock_release(&dcb->dcb_initlock);
/** Read session id to thread's local storage */
if (LOG_MAY_BE_ENABLED(LOGFILE_TRACE))
{
dcb_get_ses_log_info(dcb,
&tls_log_info.li_sesid,
&tls_log_info.li_enabled_logs);
}
if (poll_dcb_session_check(dcb, "hangup EPOLLRDHUP"))
{
dcb->func.hangup(dcb);