MXS-1804: Allow large session commands
Session commands that span multiple packets are now allowed and will work. However, if one is executed the session command history is disabled as no interface for appending to session commands exists. The backend protocol modules now also correctly track the current command. This was a pre-requisite for large session commands as they needed to be gathered into a single buffer and to do this the current command had to be accurate. Updated tests to expect success instead of failure for large prepared statements.
This commit is contained in:
@ -409,7 +409,19 @@ static inline void prepare_for_write(DCB *dcb, GWBUF *buffer)
|
||||
*/
|
||||
if (rcap_type_required(capabilities, RCAP_TYPE_STMT_INPUT))
|
||||
{
|
||||
proto->current_command = (mxs_mysql_cmd_t)MYSQL_GET_COMMAND(GWBUF_DATA(buffer));
|
||||
uint8_t* data = GWBUF_DATA(buffer);
|
||||
|
||||
if (!proto->large_query)
|
||||
{
|
||||
proto->current_command = (mxs_mysql_cmd_t)MYSQL_GET_COMMAND(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the buffer contains a large query, we have to skip the command
|
||||
* byte extraction for the next packet. This way current_command always
|
||||
* contains the latest command executed on this backend.
|
||||
*/
|
||||
proto->large_query = MYSQL_GET_PAYLOAD_LEN(data) == MYSQL_PACKET_LENGTH_MAX;
|
||||
}
|
||||
else if (dcb->session->client_dcb && dcb->session->client_dcb->protocol)
|
||||
{
|
||||
|
@ -73,6 +73,7 @@ MySQLProtocol* mysql_protocol_init(DCB* dcb, int fd)
|
||||
p->collect_result = false;
|
||||
p->changing_user = false;
|
||||
p->num_eof_packets = 0;
|
||||
p->large_query = false;
|
||||
#if defined(SS_DEBUG)
|
||||
p->protocol_chk_top = CHK_NUM_PROTOCOL;
|
||||
p->protocol_chk_tail = CHK_NUM_PROTOCOL;
|
||||
|
Reference in New Issue
Block a user