MySQL 9.1.0
Source Code Documentation
service_pfs_notification.cc File Reference

The performance schema implementation of the notification service. More...

#include <mysql/components/my_service.h>
#include <mysql/components/service_implementation.h>
#include <mysql/plugin.h>
#include <string.h>
#include <atomic>
#include "my_systime.h"
#include "pfs_thread_provider.h"
#include "sql/log.h"
#include "storage/perfschema/pfs_instr.h"
#include "storage/perfschema/pfs_server.h"
#include "storage/perfschema/pfs_services.h"
#include "template_utils.h"

Classes

struct  PFS_notification_node
 PFS_notification_node Element of the notification registry containing callback functions. More...
 
struct  PFS_notification_registry
 PFS_notification_registry A singly linked list of callback registrations. More...
 

Macros

#define EVENT_THREAD_CREATE   0x0001
 Bitmap identifiers for PSI_notification callbacks. More...
 
#define EVENT_THREAD_DESTROY   0x0002
 
#define EVENT_SESSION_CONNECT   0x0004
 
#define EVENT_SESSION_DISCONNECT   0x0008
 
#define EVENT_SESSION_CHANGE_USER   0x0010
 

Functions

void pfs_get_thread_system_attrs (PFS_thread *thread, PSI_thread_attrs *thread_attrs)
 
int pfs_register_notification (const PSI_notification *callbacks, bool with_ref_count)
 Register callbacks for the Notification service. More...
 
int pfs_unregister_notification (int handle)
 Unregister callbacks for the Notification service. More...
 
void pfs_notify_thread_create (PFS_thread *thread)
 Invoke callbacks registered for create thread events. More...
 
void pfs_notify_thread_destroy (PFS_thread *thread)
 Invoke callbacks registered for destroy thread events. More...
 
void pfs_notify_session_connect (PFS_thread *thread)
 Invoke callbacks registered for session connect events. More...
 
void pfs_notify_session_disconnect (PFS_thread *thread)
 Invoke callbacks registered for session disconnect events. More...
 
void pfs_notify_session_change_user (PFS_thread *thread)
 Invoke callbacks registered for session change user events. More...
 
int impl_register_notification (const PSI_notification *callbacks, bool with_ref_count)
 Notification Service implementation. More...
 
int impl_unregister_notification (int handle)
 

Variables

static PFS_notification_registry pfs_notification_registry
 Notification service registry. More...
 
const mysql_service_pfs_notification_v3_t SERVICE_IMPLEMENTATION (mysql_server, pfs_notification_v3)
 

Detailed Description

The performance schema implementation of the notification service.

Macro Definition Documentation

◆ EVENT_SESSION_CHANGE_USER

#define EVENT_SESSION_CHANGE_USER   0x0010

◆ EVENT_SESSION_CONNECT

#define EVENT_SESSION_CONNECT   0x0004

◆ EVENT_SESSION_DISCONNECT

#define EVENT_SESSION_DISCONNECT   0x0008

◆ EVENT_THREAD_CREATE

#define EVENT_THREAD_CREATE   0x0001

Bitmap identifiers for PSI_notification callbacks.

See also
PSI_notification

◆ EVENT_THREAD_DESTROY

#define EVENT_THREAD_DESTROY   0x0002

Function Documentation

◆ impl_register_notification()

int impl_register_notification ( const PSI_notification callbacks,
bool  with_ref_count 
)

Notification Service implementation.

◆ impl_unregister_notification()

int impl_unregister_notification ( int  handle)

◆ pfs_get_thread_system_attrs()

void pfs_get_thread_system_attrs ( PFS_thread thread,
PSI_thread_attrs thread_attrs 
)

◆ pfs_notify_session_change_user()

void pfs_notify_session_change_user ( PFS_thread thread)

Invoke callbacks registered for session change user events.

Parameters
threadinstrumented thread
See also
PSI_v1::notify_session_change_user

◆ pfs_notify_session_connect()

void pfs_notify_session_connect ( PFS_thread thread)

Invoke callbacks registered for session connect events.

Parameters
threadinstrumented thread
See also
PSI_v1::notify_session_connect

◆ pfs_notify_session_disconnect()

void pfs_notify_session_disconnect ( PFS_thread thread)

Invoke callbacks registered for session disconnect events.

Parameters
threadinstrumented thread
See also
PSI_v1::notify_session_disconnect

◆ pfs_notify_thread_create()

void pfs_notify_thread_create ( PFS_thread thread)

Invoke callbacks registered for create thread events.

This is an internal function, not part of Notification API.

Parameters
threadinstrumented thread
See also
pfs_notify_thread_create

◆ pfs_notify_thread_destroy()

void pfs_notify_thread_destroy ( PFS_thread thread)

Invoke callbacks registered for destroy thread events.

This is an internal function, not part of Notification API.

Parameters
threadinstrumented thread
See also
pfs_notify_thread_destroy

◆ pfs_register_notification()

int pfs_register_notification ( const PSI_notification callbacks,
bool  with_ref_count 
)

Register callbacks for the Notification service.

Parameters
callbacksblock of callback function pointers
with_ref_counttrue if callbacks can be unregistered
Returns
handle unique handle needed to unregister, 0 on failure
See also
PSI_v1::register_notification

◆ pfs_unregister_notification()

int pfs_unregister_notification ( int  handle)

Unregister callbacks for the Notification service.

Parameters
handleunique handle returned by register_notification()
Returns
0 if successful, non-zero otherwise
See also
PSI_v1::unregister_notification

Variable Documentation

◆ pfs_notification_registry

PFS_notification_registry pfs_notification_registry
static

Notification service registry.

◆ SERVICE_IMPLEMENTATION

const mysql_service_pfs_notification_v3_t SERVICE_IMPLEMENTATION(mysql_server, pfs_notification_v3) ( mysql_server  ,
pfs_notification_v3   
)
Initial value:
= {
int impl_register_notification(const PSI_notification *callbacks, bool with_ref_count)
Notification Service implementation.
Definition: service_pfs_notification.cc:498
int impl_unregister_notification(int handle)
Definition: service_pfs_notification.cc:503