backend connection counter was decreased in freeSession even for those backends which weren't connected. This resulted negative counts and affected on selection algorithm.
This commit is contained in:
@ -648,8 +648,7 @@ static void closeSession(
|
|||||||
if (dcb != NULL)
|
if (dcb != NULL)
|
||||||
{
|
{
|
||||||
CHK_DCB(dcb);
|
CHK_DCB(dcb);
|
||||||
backend_ref[i].bref_dcb =
|
backend_ref[i].bref_dcb = NULL; /*< prevent new uses of DCB */
|
||||||
(DCB *)0xdeadbeef; /*< prevent new uses of DCB */
|
|
||||||
dcb->func.close(dcb);
|
dcb->func.close(dcb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -673,6 +672,11 @@ static void freeSession(
|
|||||||
|
|
||||||
for (i=0; i<router_cli_ses->rses_nbackends; i++)
|
for (i=0; i<router_cli_ses->rses_nbackends; i++)
|
||||||
{
|
{
|
||||||
|
if (backend_ref[i].bref_dcb == NULL)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ss_dassert(backend_ref[i].bref_backend->backend_conn_count > 0);
|
||||||
atomic_add(&backend_ref[i].bref_backend->backend_conn_count, -1);
|
atomic_add(&backend_ref[i].bref_backend->backend_conn_count, -1);
|
||||||
}
|
}
|
||||||
spinlock_acquire(&router->lock);
|
spinlock_acquire(&router->lock);
|
||||||
@ -1635,6 +1639,7 @@ static bool select_connect_backend_servers(
|
|||||||
{
|
{
|
||||||
if (backend_ref[i].bref_dcb != NULL)
|
if (backend_ref[i].bref_dcb != NULL)
|
||||||
{
|
{
|
||||||
|
ss_dassert(backend_ref[i].bref_backend->backend_conn_count > 0);
|
||||||
/** disconnect opened connections */
|
/** disconnect opened connections */
|
||||||
backend_ref[i].bref_dcb->func.close(backend_ref[i].bref_dcb);
|
backend_ref[i].bref_dcb->func.close(backend_ref[i].bref_dcb);
|
||||||
atomic_add(&backend_ref[i].bref_backend->backend_conn_count, -1);
|
atomic_add(&backend_ref[i].bref_backend->backend_conn_count, -1);
|
||||||
|
Reference in New Issue
Block a user