CUBRID Engine  latest
master_request.c File Reference
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <pthread.h>
#include "system_parameter.h"
#include "connection_globals.h"
#include "connection_cl.h"
#include "error_manager.h"
#include "utility.h"
#include "message_catalog.h"
#include "memory_alloc.h"
#include "porting.h"
#include "release_string.h"
#include "tcp.h"
#include "master_util.h"
#include "master_request.h"
#include "master_heartbeat.h"

Go to the source code of this file.

Macros

#define IS_MASTER_SOCKET_FD(FD)   ((FD) == css_Master_socket_fd[0] || (FD) == css_Master_socket_fd[1])
 
#define SERVER_FORMAT_STRING   " Server %s (rel %s, pid %d)\n"
 
#define HA_SERVER_FORMAT_STRING   " HA-Server %s (rel %s, pid %d)\n"
 
#define HA_COPYLOGDB_FORMAT_STRING   " HA-copylogdb %s (rel %s, pid %d)\n"
 
#define HA_APPLYLOGDB_FORMAT_STRING   " HA-applylogdb %s (rel %s, pid %d)\n"
 

Functions

static void css_send_command_to_server (const SOCKET_QUEUE_ENTRY *sock_entry, int command)
 
static void css_send_message_to_server (const SOCKET_QUEUE_ENTRY *sock_entry, const char *message)
 
static void css_cleanup_info_connection (CSS_CONN_ENTRY *conn)
 
static void css_process_start_time_info (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
static void css_process_shutdown_time_info (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
static void css_process_server_count_info (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
static void css_process_all_count_info (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
static void css_process_server_list_info (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
static void css_process_all_list_info (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
static void css_process_kill_slave (CSS_CONN_ENTRY *conn, unsigned short request_id, char *server_name)
 
static void css_process_kill_immediate (CSS_CONN_ENTRY *conn, unsigned short request_id, char *server_name)
 
static void css_send_term_signal (int pid)
 
static void css_process_kill_master (void)
 
static void css_process_request_count_info (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
static void css_process_shutdown (char *time_buffer)
 
static void css_process_get_server_ha_mode (CSS_CONN_ENTRY *conn, unsigned short request_id, char *server_name)
 
static void css_process_get_eof (CSS_CONN_ENTRY *conn)
 
static void css_process_ha_node_list_info (CSS_CONN_ENTRY *conn, unsigned short request_id, bool verbose_yn)
 
static void css_process_ha_process_list_info (CSS_CONN_ENTRY *conn, unsigned short request_id, bool verbose_yn)
 
static void css_process_kill_all_ha_process (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
static void css_process_is_registered_ha_proc (CSS_CONN_ENTRY *conn, unsigned short request_id, char *buf)
 
static void css_process_ha_deregister_by_pid (CSS_CONN_ENTRY *conn, unsigned short request_id, char *pid_p)
 
static void css_process_ha_deregister_by_args (CSS_CONN_ENTRY *conn, unsigned short request_id, char *args)
 
static void css_process_reconfig_heartbeat (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
static void css_process_deact_stop_all (CSS_CONN_ENTRY *conn, unsigned short request_id, char *deact_immediately)
 
static void css_process_deact_confirm_stop_all (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
static void css_process_deactivate_heartbeat (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
static void css_process_deact_confirm_no_server (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
static void css_process_activate_heartbeat (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
static void css_process_register_ha_process (CSS_CONN_ENTRY *conn)
 
static void css_process_deregister_ha_process (CSS_CONN_ENTRY *conn)
 
static void css_process_change_ha_mode (CSS_CONN_ENTRY *conn)
 
static void css_process_ha_ping_host_info (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
static void css_process_ha_admin_info (CSS_CONN_ENTRY *conn, unsigned short request_id)
 
static void css_process_ha_start_util_process (CSS_CONN_ENTRY *conn, unsigned short request_id, char *args)
 
static void css_process_server_state (CSS_CONN_ENTRY *conn, unsigned short request_id, char *server_name)
 
void css_process_start_shutdown (SOCKET_QUEUE_ENTRY *sock_entq, int timeout, char *buffer)
 
void css_process_stop_shutdown (void)
 
void css_process_info_request (CSS_CONN_ENTRY *conn)
 
void css_process_heartbeat_request (CSS_CONN_ENTRY *conn)
 

Macro Definition Documentation

#define HA_APPLYLOGDB_FORMAT_STRING   " HA-applylogdb %s (rel %s, pid %d)\n"

Definition at line 70 of file master_request.c.

Referenced by css_process_all_list_info().

#define HA_COPYLOGDB_FORMAT_STRING   " HA-copylogdb %s (rel %s, pid %d)\n"

Definition at line 69 of file master_request.c.

Referenced by css_process_all_list_info().

#define HA_SERVER_FORMAT_STRING   " HA-Server %s (rel %s, pid %d)\n"

Definition at line 68 of file master_request.c.

Referenced by css_process_all_list_info(), and css_process_server_list_info().

#define SERVER_FORMAT_STRING   " Server %s (rel %s, pid %d)\n"

Definition at line 67 of file master_request.c.

Referenced by css_process_all_list_info(), and css_process_server_list_info().

Function Documentation

static void css_process_activate_heartbeat ( CSS_CONN_ENTRY conn,
unsigned short  request_id 
)
static
static void css_process_all_count_info ( CSS_CONN_ENTRY conn,
unsigned short  request_id 
)
static
static void css_process_change_ha_mode ( CSS_CONN_ENTRY conn)
static

Definition at line 891 of file master_request.c.

References hb_resource_receive_changemode().

Referenced by css_process_heartbeat_request().

Here is the caller graph for this function:

static void css_process_deact_confirm_stop_all ( CSS_CONN_ENTRY conn,
unsigned short  request_id 
)
static
static void css_process_deregister_ha_process ( CSS_CONN_ENTRY conn)
static

Definition at line 864 of file master_request.c.

References css_cleanup_info_connection(), css_receive_heartbeat_data(), hb_deregister_by_pid(), NO_ERRORS, ntohl(), pid, and rv.

Referenced by css_process_heartbeat_request().

Here is the caller graph for this function:

static void css_process_get_eof ( CSS_CONN_ENTRY conn)
static

Definition at line 1037 of file master_request.c.

References hb_resource_receive_get_eof().

Referenced by css_process_heartbeat_request().

Here is the caller graph for this function:

static void css_process_ha_node_list_info ( CSS_CONN_ENTRY conn,
unsigned short  request_id,
bool  verbose_yn 
)
static
static void css_process_ha_process_list_info ( CSS_CONN_ENTRY conn,
unsigned short  request_id,
bool  verbose_yn 
)
static
void css_process_info_request ( CSS_CONN_ENTRY conn)

Definition at line 1855 of file master_request.c.

References ACTIVATE_HEARTBEAT, CANCEL_SHUTDOWN, css_cleanup_info_connection(), css_process_activate_heartbeat(), css_process_all_count_info(), css_process_all_list_info(), css_process_deact_confirm_no_server(), css_process_deact_confirm_stop_all(), css_process_deact_stop_all(), css_process_deactivate_heartbeat(), css_process_get_server_ha_mode(), css_process_ha_admin_info(), css_process_ha_deregister_by_args(), css_process_ha_deregister_by_pid(), css_process_ha_node_list_info(), css_process_ha_ping_host_info(), css_process_ha_process_list_info(), css_process_ha_start_util_process(), css_process_is_registered_ha_proc(), css_process_kill_all_ha_process(), css_process_kill_immediate(), css_process_kill_master(), css_process_kill_slave(), css_process_reconfig_heartbeat(), css_process_request_count_info(), css_process_server_count_info(), css_process_server_list_info(), css_process_server_state(), css_process_shutdown(), css_process_shutdown_time_info(), css_process_start_time_info(), css_process_stop_shutdown(), css_receive_data(), css_receive_request(), DEACT_CONFIRM_NO_SERVER, DEACT_CONFIRM_STOP_ALL, DEACT_STOP_ALL, DEACTIVATE_HEARTBEAT, DEREGISTER_HA_PROCESS_BY_ARGS, DEREGISTER_HA_PROCESS_BY_PID, free_and_init, GET_ALL_COUNT, GET_ALL_LIST, GET_HA_ADMIN_INFO, GET_HA_NODE_LIST, GET_HA_NODE_LIST_VERBOSE, GET_HA_PING_HOST_INFO, GET_HA_PROCESS_LIST, GET_HA_PROCESS_LIST_VERBOSE, GET_REQUEST_COUNT, GET_SERVER_COUNT, GET_SERVER_HA_MODE, GET_SERVER_LIST, GET_SERVER_STATE, GET_SHUTDOWN_TIME, GET_START_TIME, IS_REGISTERED_HA_PROC, KILL_ALL_HA_PROCESS, KILL_MASTER_SERVER, KILL_SERVER_IMMEDIATE, KILL_SLAVE_SERVER, NO_ERRORS, NULL, rc, RECONFIG_HEARTBEAT, START_HA_UTIL_PROCESS, and START_SHUTDOWN.

Referenced by css_check_master_socket_input().

Here is the caller graph for this function:

static void css_process_is_registered_ha_proc ( CSS_CONN_ENTRY conn,
unsigned short  request_id,
char *  buf 
)
static
static void css_process_kill_all_ha_process ( CSS_CONN_ENTRY conn,
unsigned short  request_id 
)
static
static void css_process_reconfig_heartbeat ( CSS_CONN_ENTRY conn,
unsigned short  request_id 
)
static
static void css_process_register_ha_process ( CSS_CONN_ENTRY conn)
static

Definition at line 848 of file master_request.c.

References hb_register_new_process().

Referenced by css_process_heartbeat_request().

Here is the caller graph for this function:

static void css_process_request_count_info ( CSS_CONN_ENTRY conn,
unsigned short  request_id 
)
static

Definition at line 665 of file master_request.c.

References cubregex::count(), css_cleanup_info_connection(), css_send_data(), css_Total_request_count, htonl(), and NO_ERRORS.

Referenced by css_process_info_request().

Here is the caller graph for this function:

static void css_process_server_state ( CSS_CONN_ENTRY conn,
unsigned short  request_id,
char *  server_name 
)
static
static void css_process_shutdown_time_info ( CSS_CONN_ENTRY conn,
unsigned short  request_id 
)
static

Definition at line 183 of file master_request.c.

References css_cleanup_info_connection(), css_Master_timeout, css_send_data(), NO_ERRORS, NULL, rel_release_string(), and strlen.

Referenced by css_process_info_request().

Here is the caller graph for this function:

void css_process_start_shutdown ( SOCKET_QUEUE_ENTRY sock_entq,
int  timeout,
char *  buffer 
)
static void css_process_start_time_info ( CSS_CONN_ENTRY conn,
unsigned short  request_id 
)
static

Definition at line 165 of file master_request.c.

References css_cleanup_info_connection(), css_send_data(), css_Start_time, and NO_ERRORS.

Referenced by css_process_info_request().

Here is the caller graph for this function:

static void css_send_command_to_server ( const SOCKET_QUEUE_ENTRY sock_entry,
int  command 
)
static
static void css_send_message_to_server ( const SOCKET_QUEUE_ENTRY sock_entry,
const char *  message 
)
static

Definition at line 138 of file master_request.c.

References socket_queue_entry::conn_ptr, css_conn_entry::fd, socket_queue_entry::info_p, IS_INVALID_SOCKET, IS_MASTER_SOCKET_FD, and MASTER_TO_SRV_MSG_SIZE.

Referenced by css_process_start_shutdown().

Here is the caller graph for this function:

static void css_send_term_signal ( int  pid)
static

Definition at line 607 of file master_request.c.

References FALSE.