MXS-3054: Prevent pooling of DCBs with inbound data
If a DCB is expecting a response from the server, it must not be placed into the connection pool. This prevents the case where unexpected responses would be delivered to DCBs taken out of the connection pool.
This commit is contained in:
@ -189,6 +189,7 @@ struct DCB : public MXB_POLL_DATA
|
|||||||
* -1: Evicted from the persistent pool and being closed.
|
* -1: Evicted from the persistent pool and being closed.
|
||||||
* non-0: Time when placed in the persistent pool.
|
* non-0: Time when placed in the persistent pool.
|
||||||
*/
|
*/
|
||||||
|
bool valid_for_pool = true; // TODO: Make this private in 2.5
|
||||||
SERVICE* service = nullptr; /**< The related service */
|
SERVICE* service = nullptr; /**< The related service */
|
||||||
void* data = nullptr; /**< Client protocol data, owned by client DCB */
|
void* data = nullptr; /**< Client protocol data, owned by client DCB */
|
||||||
void* authenticator_data = nullptr;/**< The authenticator data for this DCB */
|
void* authenticator_data = nullptr;/**< The authenticator data for this DCB */
|
||||||
|
@ -61,6 +61,7 @@ void Backend::close(close_type type)
|
|||||||
/** Clean operation counter in bref and in SERVER */
|
/** Clean operation counter in bref and in SERVER */
|
||||||
if (is_waiting_result())
|
if (is_waiting_result())
|
||||||
{
|
{
|
||||||
|
m_dcb->valid_for_pool = false;
|
||||||
clear_state(WAITING_RESULT);
|
clear_state(WAITING_RESULT);
|
||||||
}
|
}
|
||||||
clear_state(IN_USE);
|
clear_state(IN_USE);
|
||||||
|
@ -1260,6 +1260,7 @@ static bool dcb_maybe_add_persistent(DCB* dcb)
|
|||||||
&& strlen(dcb->user)
|
&& strlen(dcb->user)
|
||||||
&& server
|
&& server
|
||||||
&& dcb->session
|
&& dcb->session
|
||||||
|
&& dcb->valid_for_pool
|
||||||
&& session_valid_for_pool(dcb->session)
|
&& session_valid_for_pool(dcb->session)
|
||||||
&& server->persistpoolmax()
|
&& server->persistpoolmax()
|
||||||
&& (server->status & SERVER_RUNNING)
|
&& (server->status & SERVER_RUNNING)
|
||||||
|
Reference in New Issue
Block a user