Remove unused buffer types

A part of the buffer types weren't used or provided no real functionality.
This commit is contained in:
Markus Mäkelä
2017-03-29 07:10:19 +03:00
parent c59ed30da1
commit 5c1c89c835
10 changed files with 14 additions and 144 deletions

View File

@ -564,13 +564,9 @@ static int routeQuery(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session,
{
closed_session_reply(querybuf);
}
else
else if (route_single_stmt(inst, rses, querybuf))
{
live_session_reply(&querybuf, rses);
if (route_single_stmt(inst, rses, querybuf))
{
rval = 1;
}
rval = 1;
}
if (querybuf != NULL)

View File

@ -47,7 +47,6 @@ do{ \
bool route_single_stmt(ROUTER_INSTANCE *inst, ROUTER_CLIENT_SES *rses,
GWBUF *querybuf);
void closed_session_reply(GWBUF *querybuf);
void live_session_reply(GWBUF **querybuf, ROUTER_CLIENT_SES *rses);
void print_error_packet(ROUTER_CLIENT_SES *rses, GWBUF *buf, DCB *dcb);
void check_session_command_reply(GWBUF *writebuf, sescmd_cursor_t *scur, backend_ref_t *bref);
bool execute_sescmd_in_backend(backend_ref_t *backend_ref);

View File

@ -312,37 +312,6 @@ void closed_session_reply(GWBUF *querybuf)
}
}
/*
* Probably MySQL specific because of modutil function
*/
/**
* @brief First step to handle request in a live session
*
* Used when a request is about to be routed. Note that the query buffer is
* passed by name and is likely to be modified by this function.
*
* @param querybuf Query buffer containing packet
* @param rses Router session
*/
void live_session_reply(GWBUF **querybuf, ROUTER_CLIENT_SES *rses)
{
GWBUF *tmpbuf = *querybuf;
if (GWBUF_IS_TYPE_UNDEFINED(tmpbuf))
{
/* Note that many modutil functions are MySQL specific */
*querybuf = modutil_get_complete_packets(&tmpbuf);
if (tmpbuf)
{
rses->client_dcb->dcb_readqueue = gwbuf_append(rses->client_dcb->dcb_readqueue, tmpbuf);
}
*querybuf = gwbuf_make_contiguous(*querybuf);
/** Mark buffer to as MySQL type */
gwbuf_set_type(*querybuf, GWBUF_TYPE_MYSQL);
gwbuf_set_type(*querybuf, GWBUF_TYPE_SINGLE_STMT);
}
}
/*
* Uses MySQL specific mechanisms
*/

View File

@ -96,7 +96,6 @@ bool route_single_stmt(ROUTER_INSTANCE *inst, ROUTER_CLIENT_SES *rses,
bool non_empty_packet;
ss_dassert(querybuf->next == NULL); // The buffer must be contiguous.
ss_dassert(!GWBUF_IS_TYPE_UNDEFINED(querybuf));
/* packet_type is a problem as it is MySQL specific */
packet_type = determine_packet_type(querybuf, &non_empty_packet);

View File

@ -266,8 +266,6 @@ static bool is_empty_packet(GWBUF* pPacket)
int32_t SchemaRouterSession::routeQuery(GWBUF* pPacket)
{
ss_dassert(!GWBUF_IS_TYPE_UNDEFINED(pPacket));
if (m_closed)
{
return 0;
@ -959,7 +957,6 @@ bool SchemaRouterSession::handle_default_db()
{
uint8_t *data = GWBUF_DATA(buffer);
gw_mysql_set_byte3(data, qlen + 1);
gwbuf_set_type(buffer, GWBUF_TYPE_MYSQL);
data[3] = 0x0;
data[4] = 0x2;
memcpy(data + 5, m_connect_db.c_str(), qlen);
@ -1129,7 +1126,6 @@ void create_error_reply(char* fail_str, DCB* dcb)
return;
}
/** Set flags that help router to identify session commands reply */
gwbuf_set_type(errbuf, GWBUF_TYPE_MYSQL);
gwbuf_set_type(errbuf, GWBUF_TYPE_SESCMD_RESPONSE);
gwbuf_set_type(errbuf, GWBUF_TYPE_RESPONSE_END);