MySQL  8.0.27
Source Code Documentation
srv_session_service.cc File Reference

Server session service implementation. More...

#include <stddef.h>
#include <new>
#include "my_dbug.h"
#include "mysql/service_srv_session.h"
#include "mysqld_error.h"
#include "sql/conn_handler/connection_handler_manager.h"
#include "sql/current_thd.h"
#include "sql/derror.h"
#include "sql/mysqld.h"
#include "sql/server_component/mysql_admin_session_imp.h"
#include "sql/sql_class.h"
#include "sql/srv_session.h"

Functions

int srv_session_init_thread (const void *plugin)
 Initializes physical thread to use with session service. More...
 
void srv_session_deinit_thread ()
 Deinitializes physical thread to use with session service. More...
 
Srv_sessionsrv_session_open_internal (srv_session_error_cb error_cb, void *plugin_ctx, bool ignore_max_connection_limit)
 Opens server session. More...
 
Srv_sessionsrv_session_open (srv_session_error_cb error_cb, void *plugin_ctx)
 Opens a server session. More...
 
int srv_session_detach (Srv_session *session)
 Detaches a session from current physical thread. More...
 
int srv_session_close (Srv_session *session)
 Closes a session. More...
 
int srv_session_server_is_available ()
 Returns if the server is available (not booting or shutting down) More...
 
int srv_session_attach (MYSQL_SESSION session, MYSQL_THD *ret_previous_thd)
 Attaches a session to current physical thread. More...
 

Detailed Description

Server session service implementation.

For more information please check the function comments.

Function Documentation

◆ srv_session_attach()

int srv_session_attach ( MYSQL_SESSION  session,
MYSQL_THD ret_previous_thd 
)

Attaches a session to current physical thread.

Previously attached THD is detached and returned through ret_previous_thd. THD associated with session is attached.

Parameters
sessionSession to attach
ret_previous_thdPreviously attached THD
Returns
0 success 1 failure

◆ srv_session_close()

int srv_session_close ( Srv_session session)

Closes a session.

Parameters
sessionSession handle to close
Returns
0 Session successfully closed 1 Session wasn't found or key doesn't match

◆ srv_session_deinit_thread()

void srv_session_deinit_thread ( )

Deinitializes physical thread to use with session service.

Deinitializes the current physical thread to use with session service.

◆ srv_session_detach()

int srv_session_detach ( Srv_session session)

Detaches a session from current physical thread.

Parameters
sessionSession handle to detach
Returns
0 success 1 failure

◆ srv_session_init_thread()

int srv_session_init_thread ( const void *  plugin)

Initializes physical thread to use with session service.

Initializes the current physical thread to use with session service.

Returns
0 success 1 failure

◆ srv_session_open()

Srv_session* srv_session_open ( srv_session_error_cb  error_cb,
void *  plugin_ctx 
)

Opens a server session.

In a thread not initialized by the server itself, this function should be called only after srv_session_init_thread() has already been called.

Parameters
error_cbsession error callback
plugin_ctxPlugin's context, opaque pointer that would be provided to callbacks. Might be NULL.
Returns
session on success NULL on failure

◆ srv_session_open_internal()

Srv_session* srv_session_open_internal ( srv_session_error_cb  error_cb,
void *  plugin_ctx,
bool  ignore_max_connection_limit 
)

Opens server session.

Parameters
error_cbDefault completion callback
plugin_ctxPlugin's context, opaque pointer that would be provided to callbacks. Might be NULL.
ignore_max_connection_limittrue if the session is exempted
Returns
handler of session on success NULL on failure

◆ srv_session_server_is_available()

int srv_session_server_is_available ( )

Returns if the server is available (not booting or shutting down)

Returns
0 not available 1 available