Change abort to error message when read connection router finds mismatch between router client session DCB and given backend DCB; improve order of actions when closing DCB in read-write router.

This commit is contained in:
counterpoint
2015-09-15 15:22:44 +01:00
parent 0cf4b2cf68
commit fdbe070e80
2 changed files with 15 additions and 8 deletions

View File

@ -886,13 +886,20 @@ static void handleError(
spinlock_release(&session->ses_lock);
}
if (router_cli_ses->backend_dcb) {
if (backend_dcb != router_cli_ses->backend_dcb)
{
/* Linkages have gone badly wrong - this may not be best solution */
raise(SIGABRT);
/* Linkages have gone badly wrong */
LOGIF(LE, (skygw_log_write(LOGFILE_ERROR,
"Read Connection Router error in handleError: router client "
"session DCB %p is not null, but does not match backend DCB %p "
"either. \n",
router_cli_ses->backend_dcb,
backend_dcb)));
}
router_cli_ses->backend_dcb = NULL;
dcb_close(backend_dcb);
}
/** false because connection is not available anymore */
*succp = false;

View File

@ -3655,10 +3655,10 @@ static bool select_connect_backend_servers(
ss_dassert(backend_ref[i].bref_backend->backend_conn_count > 0);
/** disconnect opened connections */
dcb_close(backend_ref[i].bref_dcb);
bref_clear_state(&backend_ref[i], BREF_IN_USE);
/** Decrease backend's connection counter. */
atomic_add(&backend_ref[i].bref_backend->backend_conn_count, -1);
dcb_close(backend_ref[i].bref_dcb);
}
}
}