session.c:session_free:if session is child of another service (tee in this case), it is the parent which releases child's allocated memory back to the system. This now also includes the child router session.
dcb.h: Added DCB_IS_CLONE macro
tee.c:freeSession:if parent session triggered closing of tee, then child session may not be closed yet. In that case free the child session first and only then free child router session and release child session's memory back to system.
tee.c:routeQuery: only route if child session is ready for routing. Log if session is not ready for routing and set tee session inactive
mysql_client.c:gw_client_close:if DCB is cloned one don't close the protocol because they it is shared with the original DCB.
This commit is contained in:
VilhoRaatikka
2014-12-23 00:26:57 +02:00
parent 61fcc1e21e
commit f0d8ed0cf2
7 changed files with 98 additions and 57 deletions

View File

@ -1401,9 +1401,14 @@ gw_client_close(DCB *dcb)
LOGIF(LD, (skygw_log_write(LOGFILE_DEBUG,
"%lu [gw_client_close]",
pthread_self())));
mysql_protocol_done(dcb);
/**
* Since only protocol pointer is copied from original DCB to clone in
* dcb_clone, only dcb_close for the original DCB closes protocol.
*/
if (!DCB_IS_CLONE(dcb))
{
mysql_protocol_done(dcb);
}
session = dcb->session;
/**
* session may be NULL if session_alloc failed.