Fix crash in backend command tracking
The backend protocol command tracking didn't check whether the session was the dummy session. The DCB's session is always set to this value when it is put into the persistent pool.
This commit is contained in:
@ -199,6 +199,11 @@ MXS_SESSION *session_alloc_with_id(struct service *, struct dcb *, uint64_t);
|
||||
|
||||
MXS_SESSION *session_set_dummy(struct dcb *);
|
||||
|
||||
static inline bool session_is_dummy(MXS_SESSION* session)
|
||||
{
|
||||
return session->state == SESSION_STATE_DUMMY;
|
||||
}
|
||||
|
||||
const char *session_get_remote(const MXS_SESSION *);
|
||||
const char *session_get_user(const MXS_SESSION *);
|
||||
|
||||
|
@ -377,6 +377,14 @@ mxs_auth_state_t handle_server_response(DCB *dcb, GWBUF *buffer)
|
||||
static inline void prepare_for_write(DCB *dcb, GWBUF *buffer)
|
||||
{
|
||||
MySQLProtocol *proto = (MySQLProtocol*)dcb->protocol;
|
||||
|
||||
/**
|
||||
* The DCB's session is set to the dummy session when it is put into the
|
||||
* persistent connection pool. If this is not the dummy session, track
|
||||
* the current command being executed.
|
||||
*/
|
||||
if (!session_is_dummy(dcb->session))
|
||||
{
|
||||
uint64_t capabilities = service_get_capabilities(dcb->session->service);
|
||||
|
||||
/**
|
||||
@ -395,6 +403,7 @@ static inline void prepare_for_write(DCB *dcb, GWBUF *buffer)
|
||||
MySQLProtocol *client_proto = (MySQLProtocol*)dcb->session->client_dcb->protocol;
|
||||
proto->current_command = client_proto->current_command;
|
||||
}
|
||||
}
|
||||
|
||||
if (GWBUF_IS_TYPE_SESCMD(buffer))
|
||||
{
|
||||
|
Reference in New Issue
Block a user