MySQL 8.4.2
Source Code Documentation
restart_monitor_win.h File Reference
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Classes

struct  Service_status_msg
 Service status message providing an abstraction for the service message sent by monitor to client. More...
 

Enumerations

enum class  Signal_type { SIGNAL_SHUTDOWN , SIGNAL_SERVICE_STATUS_CMD , SIGNAL_SERVICE_STATUS_CMD_PROCESSED }
 Type indicating the type of signals which involve communication between the monitor and the mysqld. More...
 
enum class  Monitor_log_msg_type { MONITOR_LOG_ERROR , MONITOR_LOG_WARN , MONITOR_LOG_INFO }
 Type of messages logged by monitor logging. More...
 

Functions

bool initialize_mysqld_monitor ()
 Initialize the mysqld monitor. More...
 
void deinitialize_mysqld_monitor ()
 Deinitialize the monitor. More...
 
bool send_service_status (const Service_status_msg &)
 Send service status message to the monitor. More...
 
void close_service_status_pipe_in_mysqld ()
 Close the service status pipe. More...
 
const char * get_monitor_pid ()
 Get char representation corresponding to MYSQLD_PARENT_PID. More...
 
void signal_event (Signal_type signal)
 Signal an event of type Signal_type. More...
 
bool is_early_option (int argc, char **argv)
 Check if option is an early type or –gdb, –no-monitor. More...
 
bool is_mysqld_monitor ()
 Check if we are monitor process. More...
 
bool is_monitor_win_service ()
 Check if the monitor is started under a windows service. More...
 
int start_monitor ()
 Start the monitor if we are called in parent (monitor) context. More...
 
bool setup_service_status_cmd_processed_handle ()
 Setup the service status command processed handle. More...
 
void close_service_status_cmd_processed_handle ()
 Close the Service Status Cmd Processed handle. More...
 
bool is_windows_service ()
 
NTServiceget_win_service_ptr ()
 

Enumeration Type Documentation

◆ Monitor_log_msg_type

enum class Monitor_log_msg_type
strong

Type of messages logged by monitor logging.

Enumerator
MONITOR_LOG_ERROR 

Error log.

MONITOR_LOG_WARN 

Warning log.

MONITOR_LOG_INFO 

Information log.

◆ Signal_type

enum class Signal_type
strong

Type indicating the type of signals which involve communication between the monitor and the mysqld.

Enumerator
SIGNAL_SHUTDOWN 

Shutdown signal from monitor to mysqld.

This is used to relay the shutdown that comes from the SCM.

SIGNAL_SERVICE_STATUS_CMD 

Signal used to send the service status command to the monitor.

SIGNAL_SERVICE_STATUS_CMD_PROCESSED 

Signal to the the mysqld from monitor indicating service status command has been processed.

Function Documentation

◆ close_service_status_cmd_processed_handle()

void close_service_status_cmd_processed_handle ( )

Close the Service Status Cmd Processed handle.

◆ close_service_status_pipe_in_mysqld()

void close_service_status_pipe_in_mysqld ( )

Close the service status pipe.

This method is called by the mysqld child process.

Close the service status pipe.

This call shall made in context of the mysqld process.

◆ deinitialize_mysqld_monitor()

void deinitialize_mysqld_monitor ( )

Deinitialize the monitor.

This method essentially closes any handles opened during initialization.

◆ get_monitor_pid()

const char * get_monitor_pid ( )

Get char representation corresponding to MYSQLD_PARENT_PID.

Returns
Pointer to string representing pid of the monitor.

◆ get_win_service_ptr()

NTService * get_win_service_ptr ( )

◆ initialize_mysqld_monitor()

bool initialize_mysqld_monitor ( )

Initialize the mysqld monitor.

This method is called from both the monitor and mysqld. It sets the variable that distinguishes the monitor and the mysqld. It also initialize the monitor logging subsystem if the process under which it is called is monitor.

◆ is_early_option()

bool is_early_option ( int  argc,
char **  argv 
)

Check if option is an early type or –gdb, –no-monitor.

The early type options are verbose, help, initialize, version and initialize-insecure. These options print and do certain activities and allow the server to exit. In addition there are options like gdb, no-monitor where we do not spawn a monitor process.

Parameters
argcCount of arguments.
argvVector of arguments.
Returns
true if we are early option else false.

◆ is_monitor_win_service()

bool is_monitor_win_service ( )

Check if the monitor is started under a windows service.

Returns
true if the monitor is started as a windows service.

◆ is_mysqld_monitor()

bool is_mysqld_monitor ( )

Check if we are monitor process.

Returns
true if the current process is monitor else false.

◆ is_windows_service()

bool is_windows_service ( )

◆ send_service_status()

bool send_service_status ( const Service_status_msg msg)

Send service status message to the monitor.

This method is used by mysqld to send service status like running and setting the slow timeout value.

◆ setup_service_status_cmd_processed_handle()

bool setup_service_status_cmd_processed_handle ( )

Setup the service status command processed handle.

This method is called from mysqld context. This handle ensures the synchronization required between the monitor and mysqld once the monitor has handled the service status sent by client.

Setup the service status command processed handle.

Returns
true if service status command processed handle could not be setup else false.

◆ signal_event()

void signal_event ( Signal_type  signal)

Signal an event of type Signal_type.

Parameters
signaltype of the event.

◆ start_monitor()

int start_monitor ( )

Start the monitor if we are called in parent (monitor) context.

In child context, set the event names and get the monitor process pid and return -1.

Returns
-1 if we are in child context else exit code of the mysqld process.