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

@ -781,7 +781,6 @@ gw_read_and_write(DCB *dcb)
if (session_ok_to_route(dcb))
{
gwbuf_set_type(stmt, GWBUF_TYPE_MYSQL);
session->service->router->clientReply(session->service->router_instance,
session->router_session,
stmt, dcb);
@ -964,8 +963,7 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
* Server commands are stored to MySQLProtocol structure
* if buffer always includes a single statement.
*/
if (GWBUF_IS_TYPE_SINGLE_STMT(queue) &&
GWBUF_IS_TYPE_SESCMD(queue))
if (GWBUF_IS_TYPE_SESCMD(queue))
{
/** Record the command to backend's protocol */
protocol_add_srv_command(backend_protocol, cmd);
@ -1004,8 +1002,7 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue)
* In case of session commands, store command to DCB's
* protocol struct.
*/
if (GWBUF_IS_TYPE_SINGLE_STMT(queue) &&
GWBUF_IS_TYPE_SESCMD(queue))
if (GWBUF_IS_TYPE_SESCMD(queue))
{
uint8_t* ptr = GWBUF_DATA(queue);
mysql_server_cmd_t cmd = MYSQL_GET_COMMAND(ptr);
@ -1130,7 +1127,6 @@ static int gw_backend_close(DCB *dcb)
/** Send COM_QUIT to the backend being closed */
GWBUF* quitbuf = mysql_create_com_quit(NULL, 0);
gwbuf_set_type(quitbuf, GWBUF_TYPE_MYSQL);
mysql_send_com_quit(dcb, 0, quitbuf);
/** Free protocol data */
@ -1623,7 +1619,6 @@ gw_create_change_user_packet(MYSQL_session* mses,
char* user;
uint8_t* pwd;
GWBUF* buffer;
int compress = 0;
uint8_t* payload = NULL;
uint8_t* payload_start = NULL;
long bytes;
@ -1649,13 +1644,6 @@ gw_create_change_user_packet(MYSQL_session* mses,
/* get charset the client sent and use it for connection auth */
charset = protocol->charset;
if (compress)
{
#ifdef DEBUG_MYSQL_CONN
fprintf(stderr, ">>>> Backend Connection with compression\n");
#endif
}
/**
* Protocol MySQL COM_CHANGE_USER for CLIENT_PROTOCOL_41
* 1 byte COMMAND
@ -1695,7 +1683,7 @@ gw_create_change_user_packet(MYSQL_session* mses,
* Set correct type to GWBUF so that it will be handled like session
* commands
*/
buffer->gwbuf_type = GWBUF_TYPE_MYSQL | GWBUF_TYPE_SINGLE_STMT | GWBUF_TYPE_SESCMD;
buffer->gwbuf_type = GWBUF_TYPE_SESCMD;
payload = GWBUF_DATA(buffer);
memset(payload, '\0', bytes);
payload_start = payload;

View File

@ -943,7 +943,6 @@ gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read)
return 0;
}
gwbuf_set_type(read_buffer, GWBUF_TYPE_MYSQL);
}
/**
@ -1388,20 +1387,8 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF
{
int rc;
GWBUF* packetbuf;
#if defined(SS_DEBUG)
GWBUF* tmpbuf;
tmpbuf = *p_readbuf;
while (tmpbuf != NULL)
{
ss_dassert(GWBUF_IS_TYPE_MYSQL(tmpbuf));
tmpbuf = tmpbuf->next;
}
#endif
do
{
ss_dassert(GWBUF_IS_TYPE_MYSQL((*p_readbuf)));
/**
* Collect incoming bytes to a buffer until complete packet has
* arrived and then return the buffer.
@ -1412,7 +1399,6 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF
if (packetbuf != NULL)
{
CHK_GWBUF(packetbuf);
ss_dassert(GWBUF_IS_TYPE_MYSQL(packetbuf));
/**
* This means that buffer includes exactly one MySQL
* statement.
@ -1425,8 +1411,6 @@ static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF
* Set it here instead of gw_read_client_event to make
* sure it is set to each (MySQL) packet.
*/
gwbuf_set_type(packetbuf, GWBUF_TYPE_SINGLE_STMT);
if (rcap_type_required(capabilities, RCAP_TYPE_CONTIGUOUS_INPUT))
{
if (!GWBUF_IS_CONTIGUOUS(packetbuf))