diff --git a/server/core/dcb.c b/server/core/dcb.c index 939fe6a2b..2cc65eeb3 100644 --- a/server/core/dcb.c +++ b/server/core/dcb.c @@ -1827,6 +1827,7 @@ dcb_maybe_add_persistent(DCB *dcb) MXS_DEBUG("%lu [dcb_maybe_add_persistent] Adding DCB to persistent pool, user %s.\n", pthread_self(), dcb->user); + dcb->was_persistent = false; dcb->dcb_is_zombie = false; dcb->persistentstart = time(NULL); if (dcb->session) diff --git a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c index 4253b1c45..fe48791b6 100644 --- a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c @@ -947,8 +947,9 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue) CHK_DCB(dcb); spinlock_acquire(&dcb->authlock); - if (dcb->was_persistent) + if (dcb->was_persistent && dcb->state == DCB_STATE_POLLING) { + ss_dassert(dcb->persistentstart == 0); /** * This is a DCB that was just taken out of the persistent connection pool. * We need to sent a COM_CHANGE_USER query to the backend to reset the