Fixed unreported bug in log_manager where a terminating character was added in the middle of log message.
This commit is contained in:
@ -729,10 +729,10 @@ static int logmanager_write_log(
|
|||||||
/** Length of session id */
|
/** Length of session id */
|
||||||
int sesid_str_len;
|
int sesid_str_len;
|
||||||
|
|
||||||
/** 2 braces and 2 spaces */
|
/** 2 braces, 2 spaces and terminating char */
|
||||||
if (id == LOGFILE_TRACE && tls_log_info.li_sesid != 0)
|
if (id == LOGFILE_TRACE && tls_log_info.li_sesid != 0)
|
||||||
{
|
{
|
||||||
sesid_str_len = 2+2+get_decimal_len(tls_log_info.li_sesid);
|
sesid_str_len = 2+2+get_decimal_len(tls_log_info.li_sesid)+1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -741,13 +741,13 @@ static int logmanager_write_log(
|
|||||||
timestamp_len = get_timestamp_len();
|
timestamp_len = get_timestamp_len();
|
||||||
|
|
||||||
/** Find out how much can be safely written with current block size */
|
/** Find out how much can be safely written with current block size */
|
||||||
if (timestamp_len-1+sesid_str_len+str_len > lf->lf_buf_size)
|
if (timestamp_len-1+sesid_str_len-1+str_len > lf->lf_buf_size)
|
||||||
{
|
{
|
||||||
safe_str_len = lf->lf_buf_size;
|
safe_str_len = lf->lf_buf_size;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
safe_str_len = timestamp_len-1+sesid_str_len+str_len;
|
safe_str_len = timestamp_len-1+sesid_str_len-1+str_len;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Seek write position and register to block buffer.
|
* Seek write position and register to block buffer.
|
||||||
@ -810,6 +810,11 @@ static int logmanager_write_log(
|
|||||||
"[%lu] ",
|
"[%lu] ",
|
||||||
tls_log_info.li_sesid);
|
tls_log_info.li_sesid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sesid_str_len != 0)
|
||||||
|
{
|
||||||
|
sesid_str_len -= 1; /*< don't calculate terminating char anymore */
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Write next string to overwrite terminating null character
|
* Write next string to overwrite terminating null character
|
||||||
* of the timestamp string.
|
* of the timestamp string.
|
||||||
|
@ -1473,6 +1473,12 @@ static route_target_t get_route_target (
|
|||||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_UNKNOWN)));
|
QUERY_IS_TYPE(qtype, QUERY_TYPE_UNKNOWN)));
|
||||||
target = TARGET_MASTER;
|
target = TARGET_MASTER;
|
||||||
}
|
}
|
||||||
|
#if defined(SS_DEBUG)
|
||||||
|
LOGIF(LT, (skygw_log_write(
|
||||||
|
LOGFILE_TRACE,
|
||||||
|
"Selected target \"%s\"",
|
||||||
|
STRTARGET(target))));
|
||||||
|
#endif
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,6 +262,12 @@ typedef enum skygw_chk_t {
|
|||||||
(SERVER_IS_RELAY_SERVER(s) ? "RUNNING RELAY" : \
|
(SERVER_IS_RELAY_SERVER(s) ? "RUNNING RELAY" : \
|
||||||
(SERVER_IS_RUNNING(s) ? "RUNNING (only)" : "NO STATUS")))))))
|
(SERVER_IS_RUNNING(s) ? "RUNNING (only)" : "NO STATUS")))))))
|
||||||
|
|
||||||
|
#define STRTARGET(t) (t == TARGET_ALL ? "TARGET_ALL" : \
|
||||||
|
(t == TARGET_MASTER ? "TARGET_MASTER" : \
|
||||||
|
(t == TARGET_SLAVE ? "TARGET_SLAVE" : \
|
||||||
|
(t == TARGET_UNDEFINED ? "TARGET_UNDEFINED" : \
|
||||||
|
"Unknown target value"))))
|
||||||
|
|
||||||
#define BREFSRV(b) (b->bref_backend->backend_server)
|
#define BREFSRV(b) (b->bref_backend->backend_server)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user