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:
Markus Mäkelä 2020-06-30 15:14:14 +03:00
parent 9f07613330
commit 1ad8ae97d3
No known key found for this signature in database
GPG Key ID: 5CE746D557ACC499
3 changed files with 3 additions and 0 deletions

View File

@ -189,6 +189,7 @@ struct DCB : public MXB_POLL_DATA
* -1: Evicted from the persistent pool and being closed.
* 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 */
void* data = nullptr; /**< Client protocol data, owned by client DCB */
void* authenticator_data = nullptr;/**< The authenticator data for this DCB */

View File

@ -61,6 +61,7 @@ void Backend::close(close_type type)
/** Clean operation counter in bref and in SERVER */
if (is_waiting_result())
{
m_dcb->valid_for_pool = false;
clear_state(WAITING_RESULT);
}
clear_state(IN_USE);

View File

@ -1260,6 +1260,7 @@ static bool dcb_maybe_add_persistent(DCB* dcb)
&& strlen(dcb->user)
&& server
&& dcb->session
&& dcb->valid_for_pool
&& session_valid_for_pool(dcb->session)
&& server->persistpoolmax()
&& (server->status & SERVER_RUNNING)