Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA

This commit is contained in:
Mark Riddoch
2014-11-28 17:56:34 +00:00
5 changed files with 52 additions and 28 deletions

View File

@ -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+MAX(sesid_str_len-1,0)+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+MAX(sesid_str_len-1,0)+str_len;
} }
/** /**
* Seek write position and register to block buffer. * Seek write position and register to block buffer.
@ -809,6 +809,7 @@ static int logmanager_write_log(
sesid_str_len, sesid_str_len,
"[%lu] ", "[%lu] ",
tls_log_info.li_sesid); tls_log_info.li_sesid);
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

View File

@ -1233,18 +1233,17 @@ bool service_set_param_value (
* Function to find a string in typelib_t * Function to find a string in typelib_t
* (similar to find_type() of mysys/typelib.c) * (similar to find_type() of mysys/typelib.c)
* *
* SYNOPSIS * SYNOPSIS
* find_type() * find_type()
* lib typelib_t * lib typelib_t
* find String to find * find String to find
* length Length of string to find * length Length of string to find
* part_match Allow part matching of value * part_match Allow part matching of value
* *
* RETURN * RETURN
* 0 error * 0 error
* > 0 position in TYPELIB->type_names +1 * > 0 position in TYPELIB->type_names +1
*/ */
static int find_type( static int find_type(
typelib_t* tl, typelib_t* tl,
const char* needle, const char* needle,

View File

@ -1065,18 +1065,21 @@ gw_backend_hangup(DCB *dcb)
if (ses_state != SESSION_STATE_ROUTER_READY) if (ses_state != SESSION_STATE_ROUTER_READY)
{ {
int error, len; int error, len;
char buf[100]; char buf[100];
len = sizeof(error); len = sizeof(error);
if (getsockopt(dcb->fd, SOL_SOCKET, SO_ERROR, &error, &len) == 0) if (getsockopt(dcb->fd, SOL_SOCKET, SO_ERROR, &error, &len) == 0)
{ {
strerror_r(error, buf, 100); if (error != 0)
LOGIF(LE, (skygw_log_write_flush( {
LOGFILE_ERROR, strerror_r(error, buf, 100);
"Hangup in session that is not ready for routing, " LOGIF(LE, (skygw_log_write_flush(
"Error reported is '%s'.", LOGFILE_ERROR,
buf))); "Hangup in session that is not ready for routing, "
"Error reported is '%s'.",
buf)));
}
} }
gwbuf_free(errbuf); gwbuf_free(errbuf);
goto retblock; goto retblock;

View File

@ -1212,9 +1212,10 @@ static bool get_dcb(
* backend and update assign it to new candidate if * backend and update assign it to new candidate if
* necessary. * necessary.
*/ */
else if (max_rlag == MAX_RLAG_UNDEFINED || else if (SERVER_IS_SLAVE(b->backend_server) &&
(max_rlag == MAX_RLAG_UNDEFINED ||
(b->backend_server->rlag != MAX_RLAG_NOT_AVAILABLE && (b->backend_server->rlag != MAX_RLAG_NOT_AVAILABLE &&
b->backend_server->rlag <= max_rlag)) b->backend_server->rlag <= max_rlag)))
{ {
candidate_bref = check_candidate_bref( candidate_bref = check_candidate_bref(
candidate_bref, candidate_bref,
@ -1473,6 +1474,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;
} }
@ -2125,6 +2132,14 @@ static int routeQuery(
rlag_max); rlag_max);
if (succp) if (succp)
{ {
#if defined(SS_DEBUG)
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE,
"Found DCB for slave.")));
ss_dassert(get_bref_from_dcb(router_cli_ses, target_dcb) !=
router_cli_ses->rses_master_ref);
ss_dassert(get_root_master_bref(router_cli_ses) ==
router_cli_ses->rses_master_ref);
#endif
atomic_add(&inst->stats.n_slave, 1); atomic_add(&inst->stats.n_slave, 1);
} }
else else

View File

@ -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)