KILL [CONNECTION | QUERY] support, part1
Preparation for adding KILL syntax support. Session id changed to uint32 everywhere. Added atomic op. Session id can be acquired before session_alloc(). Added session_alloc_with_id(), which is given a session id number. Worker object has a session_id->SESSION* mapping, not used yet.
This commit is contained in:
@ -133,7 +133,7 @@ typedef struct session
|
||||
{
|
||||
skygw_chk_t ses_chk_top;
|
||||
mxs_session_state_t state; /*< Current descriptor state */
|
||||
size_t ses_id; /*< Unique session identifier */
|
||||
uint32_t ses_id; /*< Unique session identifier */
|
||||
struct dcb *client_dcb; /*< The client connection */
|
||||
struct mxs_router_session *router_session; /*< The router instance data */
|
||||
MXS_SESSION_STATS stats; /*< Session statistics */
|
||||
@ -171,7 +171,30 @@ typedef struct session
|
||||
((sess)->tail.clientReply)((sess)->tail.instance, \
|
||||
(sess)->tail.session, (buf))
|
||||
|
||||
/**
|
||||
* Allocate a new session for a new client of the specified service.
|
||||
*
|
||||
* Create the link to the router session by calling the newSession
|
||||
* entry point of the router using the router instance of the
|
||||
* service this session is part of.
|
||||
*
|
||||
* @param service The service this connection was established by
|
||||
* @param client_dcb The client side DCB
|
||||
* @return The newly created session or NULL if an error occurred
|
||||
*/
|
||||
MXS_SESSION *session_alloc(struct service *, struct dcb *);
|
||||
|
||||
/**
|
||||
* A version of session_alloc() which takes the session id number as parameter.
|
||||
* The id should have been generated with session_get_next_id().
|
||||
*
|
||||
* @param service The service this connection was established by
|
||||
* @param client_dcb The client side DCB
|
||||
* @param id Id for the new session.
|
||||
* @return The newly created session or NULL if an error occurred
|
||||
*/
|
||||
MXS_SESSION *session_alloc_with_id(struct service *, struct dcb *, uint32_t);
|
||||
|
||||
MXS_SESSION *session_set_dummy(struct dcb *);
|
||||
|
||||
const char *session_get_remote(const MXS_SESSION *);
|
||||
@ -328,7 +351,14 @@ static inline bool session_set_autocommit(MXS_SESSION* ses, bool autocommit)
|
||||
*
|
||||
* @note The caller must free the session reference by calling session_put_ref
|
||||
*/
|
||||
MXS_SESSION* session_get_by_id(int id);
|
||||
MXS_SESSION* session_get_by_id(uint32_t id);
|
||||
|
||||
/**
|
||||
* Get the next available unique (assuming no overflow) session id number.
|
||||
*
|
||||
* @return An unused session id.
|
||||
*/
|
||||
uint32_t session_get_next_id();
|
||||
|
||||
/**
|
||||
* @brief Close a session
|
||||
|
||||
Reference in New Issue
Block a user