Merge branch 'develop' into MXS-1209

This commit is contained in:
MassimilianoPinto
2017-05-03 12:54:19 +02:00
15 changed files with 176 additions and 82 deletions

View File

@ -229,7 +229,6 @@ int MySQLSendHandshake(DCB* dcb)
char server_scramble[GW_MYSQL_SCRAMBLE_SIZE + 1] = "";
char *version_string;
int len_version_string = 0;
int id_num;
bool is_maria = false;
@ -275,10 +274,9 @@ int MySQLSendHandshake(DCB* dcb)
memcpy(mysql_filler_ten + 6, &new_flags, sizeof(new_flags));
}
// thread id, now put thePID
id_num = getpid() + dcb->fd;
gw_mysql_set_byte4(mysql_thread_id_num, id_num);
// Get the equivalent of the server process id.
protocol->tid = session_get_next_id();
gw_mysql_set_byte4(mysql_thread_id_num, protocol->tid);
memcpy(mysql_scramble_buf, server_scramble, 8);
memcpy(mysql_plugin_data, server_scramble + 8, 12);
@ -702,7 +700,8 @@ gw_read_do_authentication(DCB *dcb, GWBUF *read_buffer, int nbytes_read)
* is changed so that future data will go through the
* normal data handling function instead of this one.
*/
MXS_SESSION *session = session_alloc(dcb->service, dcb);
MXS_SESSION *session =
session_alloc_with_id(dcb->service, dcb, protocol->tid);
if (session != NULL)
{

View File

@ -1724,7 +1724,7 @@ convert_arg(char *arg, int arg_type)
break;
case ARG_TYPE_SESSION:
rval = (unsigned long)session_get_by_id(strtol(arg, NULL, 0));
rval = (unsigned long)session_get_by_id(strtoul(arg, NULL, 0));
break;
case ARG_TYPE_MONITOR:

View File

@ -13,6 +13,8 @@
#include "schemarouter.hh"
#include <inttypes.h>
#include <maxscale/alloc.h>
#include <maxscale/query_classifier.h>
#include <maxscale/modutil.h>
@ -361,7 +363,7 @@ int32_t SchemaRouterSession::routeQuery(GWBUF* pPacket)
if (m_config->debug)
{
sprintf(errbuf + strlen(errbuf),
" ([%lu]: DB change failed)",
" ([%" PRIu32 "]: DB change failed)",
m_client->session->ses_id);
}
@ -989,7 +991,7 @@ bool SchemaRouterSession::handle_default_db()
sprintf(errmsg, "Unknown database '%s'", m_connect_db.c_str());
if (m_config->debug)
{
sprintf(errmsg + strlen(errmsg), " ([%lu]: DB not found on connect)",
sprintf(errmsg + strlen(errmsg), " ([%" PRIu32 "]: DB not found on connect)",
m_client->session->ses_id);
}
write_error_to_client(m_client,