Use correct write in Backend::execute_session_command

Backend::execute_session_command would use the overridden write method
instead of the Backend::write method that it intended to use. This caused
session commands that did not expect a response to be in a state that
expected a result.

Also fixed RWBackend::write pass the response_type value to
Backend::write.
This commit is contained in:
Markus Mäkelä
2018-06-21 14:43:15 +03:00
parent c49b6ada7d
commit e561c3995c
2 changed files with 10 additions and 11 deletions

View File

@ -87,18 +87,18 @@ bool Backend::execute_session_command()
CHK_DCB(m_dcb); CHK_DCB(m_dcb);
SessionCommandList::iterator iter = m_session_commands.begin(); SSessionCommand& sescmd = m_session_commands.front();
SessionCommand& sescmd = *(*iter); GWBUF *buffer = sescmd->deep_copy_buffer();
GWBUF *buffer = sescmd.deep_copy_buffer();
bool rval = false; bool rval = false;
switch (sescmd.get_command()) switch (sescmd->get_command())
{ {
case MXS_COM_QUIT: case MXS_COM_QUIT:
case MXS_COM_STMT_CLOSE: case MXS_COM_STMT_CLOSE:
/** These commands do not generate responses */ /** These commands do not generate responses */
rval = write(buffer, NO_RESPONSE); rval = Backend::write(buffer, NO_RESPONSE);
complete_session_command(); complete_session_command();
ss_dassert(!is_waiting_result());
break; break;
case MXS_COM_CHANGE_USER: case MXS_COM_CHANGE_USER:
@ -109,12 +109,11 @@ bool Backend::execute_session_command()
case MXS_COM_QUERY: case MXS_COM_QUERY:
default: default:
/** // TODO: Remove use of GWBUF_TYPE_SESCMD
* Mark session command buffer, it triggers writing //Mark session command buffer, it triggers writing MySQL command to protocol
* MySQL command to protocol
*/
gwbuf_set_type(buffer, GWBUF_TYPE_SESCMD); gwbuf_set_type(buffer, GWBUF_TYPE_SESCMD);
rval = write(buffer); rval = Backend::write(buffer);
ss_dassert(is_waiting_result());
break; break;
} }

View File

@ -96,7 +96,7 @@ bool RWBackend::write(GWBUF* buffer, response_type type)
} }
} }
return mxs::Backend::write(buffer); return mxs::Backend::write(buffer, type);
} }
bool RWBackend::consume_fetched_rows(GWBUF* buffer) bool RWBackend::consume_fetched_rows(GWBUF* buffer)