CUBRID Engine
latest
|
#include "connection_defs.h"
Go to the source code of this file.
Classes | |
struct | hbp_header |
struct | hbp_proc_register |
Typedefs | |
typedef enum hb_proc_type | HB_PROC_TYPE |
typedef enum HB_NODE_STATE | HB_NODE_STATE_TYPE |
typedef struct hbp_header | HBP_HEADER |
typedef struct hbp_proc_register | HBP_PROC_REGISTER |
Enumerations | |
enum | hb_proc_type { HB_PTYPE_SERVER = 0, HB_PTYPE_COPYLOGDB = 1, HB_PTYPE_APPLYLOGDB = 2, HB_PTYPE_MAX } |
enum | HBP_CLUSTER_MESSAGE { HBP_CLUSTER_HEARTBEAT = 0, HBP_CLUSTER_MSG_MAX } |
enum | HB_NODE_STATE { HB_NSTATE_UNKNOWN = 0, HB_NSTATE_SLAVE = 1, HB_NSTATE_TO_BE_MASTER = 2, HB_NSTATE_TO_BE_SLAVE = 3, HB_NSTATE_MASTER = 4, HB_NSTATE_REPLICA = 5, HB_NSTATE_MAX } |
Functions | |
const char * | hb_process_type_string (int ptype) |
void | hb_set_exec_path (char *exec_path) |
void | hb_set_argv (char **argv) |
int | css_send_heartbeat_request (CSS_CONN_ENTRY *conn, int command) |
int | css_send_heartbeat_data (CSS_CONN_ENTRY *conn, const char *data, int size) |
int | css_receive_heartbeat_request (CSS_CONN_ENTRY *conn, int *command) |
int | css_receive_heartbeat_data (CSS_CONN_ENTRY *conn, char *data, int size) |
int | hb_process_master_request (void) |
int | hb_register_to_master (CSS_CONN_ENTRY *conn, int type) |
int | hb_deregister_from_master (void) |
int | hb_process_init (const char *server_name, const char *log_path, HB_PROC_TYPE type) |
void | hb_process_term (void) |
const char * | hb_node_state_string (HB_NODE_STATE_TYPE nstate) |
Variables | |
bool | hb_Proc_shutdown |
#define HB_DEFAULT_APPLY_MAX_MEM_SIZE (500) |
Definition at line 33 of file heartbeat.h.
#define HB_DEFAULT_CALC_SCORE_INTERVAL_IN_MSECS (3*1000) |
Definition at line 37 of file heartbeat.h.
#define HB_DEFAULT_CHANGEMODE_INTERVAL_IN_MSECS (5*1000) |
Definition at line 46 of file heartbeat.h.
#define HB_DEFAULT_CHECK_VALID_PING_SERVER_INTERVAL_IN_MSECS (1*60*60*1000) |
Definition at line 38 of file heartbeat.h.
Referenced by hb_cluster_job_check_valid_ping_server().
#define HB_DEFAULT_DEREG_CONFIRM_INTERVAL_IN_MSECS (500) |
Definition at line 42 of file heartbeat.h.
#define HB_DEFAULT_FAILOVER_WAIT_TIME_IN_MSECS (3*1000) |
Definition at line 40 of file heartbeat.h.
#define HB_DEFAULT_HA_PORT_ID (59901) |
Definition at line 32 of file heartbeat.h.
#define HB_DEFAULT_HEARTBEAT_INTERVAL_IN_MSECS (500) |
Definition at line 36 of file heartbeat.h.
#define HB_DEFAULT_INIT_TIMER_IN_MSECS (10*1000) |
Definition at line 35 of file heartbeat.h.
#define HB_DEFAULT_MAX_HEARTBEAT_GAP (5) |
Definition at line 47 of file heartbeat.h.
#define HB_DEFAULT_MAX_PROCESS_DEREG_CONFIRM (120) |
Definition at line 44 of file heartbeat.h.
#define HB_DEFAULT_MAX_PROCESS_START_CONFIRM (20) |
Definition at line 43 of file heartbeat.h.
#define HB_DEFAULT_START_CONFIRM_INTERVAL_IN_MSECS (3*1000) |
Definition at line 41 of file heartbeat.h.
#define HB_DEFAULT_UNACCEPTABLE_PROC_RESTART_TIMEDIFF_IN_MSECS (2*60*1000) |
Definition at line 45 of file heartbeat.h.
#define HB_DISK_FAILURE_CHECK_TIMER_IN_MSECS (1*100) |
Definition at line 54 of file heartbeat.h.
Referenced by hb_thread_check_disk_failure().
#define HB_JOB_TIMER_IMMEDIATELY (0) |
Definition at line 50 of file heartbeat.h.
Referenced by hb_cleanup_conn_and_start_process(), hb_cluster_job_calc_score(), hb_cluster_job_check_ping(), hb_cluster_job_failover(), hb_cluster_job_init(), hb_cluster_job_initialize(), hb_cluster_receive_heartbeat(), hb_deregister_by_args(), hb_deregister_by_pid(), hb_get_ping_host_info_string(), hb_prepare_deactivate_heartbeat(), hb_reload_config(), hb_resource_job_confirm_start(), hb_resource_job_demote_confirm_shutdown(), and hb_thread_check_disk_failure().
#define HB_JOB_TIMER_WAIT_100_MILLISECOND (1*100) |
Definition at line 53 of file heartbeat.h.
Referenced by hb_cluster_job_calc_score().
#define HB_JOB_TIMER_WAIT_500_MILLISECOND (5*100) |
Definition at line 52 of file heartbeat.h.
Referenced by hb_cluster_job_calc_score(), hb_cluster_job_check_ping(), and hb_resource_job_cleanup_all().
#define HB_JOB_TIMER_WAIT_A_SECOND (1*1000) |
Definition at line 51 of file heartbeat.h.
Referenced by hb_cleanup_conn_and_start_process(), hb_cluster_job_demote(), hb_resource_job_confirm_start(), and hb_resource_job_proc_start().
#define HB_MAX_GROUP_ID_LEN (64) |
Definition at line 79 of file heartbeat.h.
Referenced by hb_get_node_info_string().
#define HB_MAX_NUM_PROC_ARGV (16) |
Definition at line 81 of file heartbeat.h.
Referenced by hb_resource_job_proc_start(), and hb_start_util_process().
#define HB_MAX_SZ_PROC_ARGS (HB_MAX_NUM_PROC_ARGV*HB_MAX_SZ_PROC_ARGV) |
Definition at line 83 of file heartbeat.h.
Referenced by hb_get_process_info_string(), process_ha_deregister_by_args(), process_ha_start_util_process(), process_is_registered_proc(), us_hb_applylogdb_start(), us_hb_applylogdb_stop(), us_hb_copylogdb_start(), and us_hb_copylogdb_stop().
#define HB_MAX_SZ_PROC_ARGV (64) |
Definition at line 82 of file heartbeat.h.
Referenced by hb_start_util_process().
#define HB_MAX_SZ_PROC_EXEC_PATH (128) |
Definition at line 80 of file heartbeat.h.
Referenced by hb_get_process_info_string().
#define HB_MIN_DIFF_CHECK_DISK_FAILURE_INTERVAL_IN_SECS (10) |
Definition at line 48 of file heartbeat.h.
Referenced by prm_tune_parameters().
#define HB_NSTATE_MASTER_STR "master" |
Definition at line 101 of file heartbeat.h.
Referenced by hb_node_state_string().
#define HB_NSTATE_REPLICA_STR "replica" |
Definition at line 102 of file heartbeat.h.
Referenced by hb_node_state_string().
#define HB_NSTATE_SLAVE_STR "slave" |
Definition at line 98 of file heartbeat.h.
Referenced by hb_node_state_string().
#define HB_NSTATE_STR_SZ (32) |
Definition at line 104 of file heartbeat.h.
Referenced by hb_get_node_info_string(), and hb_get_process_info_string().
#define HB_NSTATE_TO_BE_MASTER_STR "to-be-master" |
Definition at line 99 of file heartbeat.h.
Referenced by hb_node_state_string().
#define HB_NSTATE_TO_BE_SLAVE_STR "to-be-slave" |
Definition at line 100 of file heartbeat.h.
Referenced by hb_node_state_string().
#define HB_NSTATE_UNKNOWN_STR "unknown" |
Definition at line 97 of file heartbeat.h.
Referenced by hb_node_state_string().
#define HB_PTYPE_APPLYLOGDB_STR "HA-applylogdb" |
Definition at line 70 of file heartbeat.h.
Referenced by hb_process_type_string().
#define HB_PTYPE_COPYLOGDB_STR "HA-copylogdb" |
Definition at line 69 of file heartbeat.h.
Referenced by hb_process_type_string().
#define HB_PTYPE_SERVER_STR "HA-server" |
Definition at line 68 of file heartbeat.h.
Referenced by hb_process_type_string().
#define HB_PTYPE_STR_SZ (16) |
Definition at line 71 of file heartbeat.h.
#define HB_START_WAITING_TIME_IN_SECS (10) |
Definition at line 56 of file heartbeat.h.
Referenced by la_check_mem_size(), la_commit_transaction(), us_hb_process_applylogdb(), us_hb_process_copylogdb(), and us_hb_process_start().
#define HB_STOP_WAITING_TIME_IN_SECS (1) |
Definition at line 57 of file heartbeat.h.
Referenced by process_heartbeat_stop().
#define HB_TEMP_CHECK_VALID_PING_SERVER_INTERVAL_IN_MSECS (5*60*1000) |
Definition at line 39 of file heartbeat.h.
Referenced by hb_cluster_job_check_valid_ping_server().
typedef enum HB_NODE_STATE HB_NODE_STATE_TYPE |
Definition at line 106 of file heartbeat.h.
typedef enum hb_proc_type HB_PROC_TYPE |
Definition at line 67 of file heartbeat.h.
typedef struct hbp_header HBP_HEADER |
Definition at line 113 of file heartbeat.h.
typedef struct hbp_proc_register HBP_PROC_REGISTER |
Definition at line 137 of file heartbeat.h.
enum HB_NODE_STATE |
Enumerator | |
---|---|
HB_NSTATE_UNKNOWN | |
HB_NSTATE_SLAVE | |
HB_NSTATE_TO_BE_MASTER | |
HB_NSTATE_TO_BE_SLAVE | |
HB_NSTATE_MASTER | |
HB_NSTATE_REPLICA | |
HB_NSTATE_MAX |
Definition at line 86 of file heartbeat.h.
enum hb_proc_type |
Enumerator | |
---|---|
HB_PTYPE_SERVER | |
HB_PTYPE_COPYLOGDB | |
HB_PTYPE_APPLYLOGDB | |
HB_PTYPE_MAX |
Definition at line 60 of file heartbeat.h.
enum HBP_CLUSTER_MESSAGE |
Enumerator | |
---|---|
HBP_CLUSTER_HEARTBEAT | |
HBP_CLUSTER_MSG_MAX |
Definition at line 73 of file heartbeat.h.
int css_receive_heartbeat_data | ( | CSS_CONN_ENTRY * | conn, |
char * | data, | ||
int | size | ||
) |
Definition at line 230 of file heartbeat.c.
References CONNECTION_CLOSED, css_readn(), ERROR_ON_READ, css_conn_entry::fd, IS_INVALID_SOCKET, NO_ERRORS, THREAD_CALLING_CONVENTION, and THREAD_RET_T.
Referenced by css_process_deregister_ha_process(), hb_register_new_process(), hb_resource_receive_changemode(), and hb_resource_receive_get_eof().
int css_receive_heartbeat_request | ( | CSS_CONN_ENTRY * | conn, |
int * | command | ||
) |
Definition at line 202 of file heartbeat.c.
References CONNECTION_CLOSED, css_readn(), ERROR_ON_READ, css_conn_entry::fd, IS_INVALID_SOCKET, NO_ERRORS, and ntohl().
Referenced by css_process_heartbeat_request(), and hb_process_master_request_info().
int css_send_heartbeat_data | ( | CSS_CONN_ENTRY * | conn, |
const char * | data, | ||
int | size | ||
) |
Definition at line 178 of file heartbeat.c.
References CONNECTION_CLOSED, ERROR_ON_WRITE, css_conn_entry::fd, IS_INVALID_SOCKET, and NO_ERRORS.
Referenced by css_process_change_server_ha_mode_request(), css_process_get_eof_request(), hb_deregister_from_master(), hb_register_to_master(), and hb_resource_send_changemode().
int css_send_heartbeat_request | ( | CSS_CONN_ENTRY * | conn, |
int | command | ||
) |
Definition at line 151 of file heartbeat.c.
References CONNECTION_CLOSED, ERROR_ON_WRITE, css_conn_entry::fd, htonl(), IS_INVALID_SOCKET, and NO_ERRORS.
Referenced by css_process_change_server_ha_mode_request(), css_process_get_eof_request(), hb_deregister_from_master(), hb_register_to_master(), hb_resource_send_changemode(), and hb_resource_send_get_eof().
int hb_deregister_from_master | ( | void | ) |
Definition at line 321 of file heartbeat.c.
References css_send_heartbeat_data(), css_send_heartbeat_request(), ER_FAILED, css_conn_entry::fd, htonl(), IS_INVALID_SOCKET, NO_ERROR, NO_ERRORS, NULL, pid, and SERVER_DEREGISTER_HA_PROCESS.
const char* hb_node_state_string | ( | HB_NODE_STATE_TYPE | nstate | ) |
Definition at line 752 of file heartbeat.c.
References HB_NSTATE_MASTER, HB_NSTATE_MASTER_STR, HB_NSTATE_REPLICA, HB_NSTATE_REPLICA_STR, HB_NSTATE_SLAVE, HB_NSTATE_SLAVE_STR, HB_NSTATE_TO_BE_MASTER, HB_NSTATE_TO_BE_MASTER_STR, HB_NSTATE_TO_BE_SLAVE, HB_NSTATE_TO_BE_SLAVE_STR, HB_NSTATE_UNKNOWN, and HB_NSTATE_UNKNOWN_STR.
int hb_process_init | ( | const char * | server_name, |
const char * | log_path, | ||
HB_PROC_TYPE | type | ||
) |
Definition at line 682 of file heartbeat.c.
References ARG_FILE_LINE, ER_FAILED, er_log_debug, error(), hb_Argv, hb_connect_to_master(), hb_create_master_reader(), hb_Exec_path, hb_register_to_master(), hb_type_to_str(), and NO_ERROR.
Referenced by applylogdb(), and copylogdb().
int hb_process_master_request | ( | void | ) |
Definition at line 447 of file heartbeat.c.
References ARG_FILE_LINE, css_platform_independent_poll(), ER_FAILED, er_log_debug, error(), css_conn_entry::fd, hb_Proc_shutdown, hb_process_master_request_info(), IS_INVALID_SOCKET, NO_ERROR, NULL, prm_get_integer_value(), and PRM_ID_TCP_CONNECTION_TIMEOUT.
Referenced by hb_thread_master_reader().
void hb_process_term | ( | void | ) |
Definition at line 735 of file heartbeat.c.
References css_shutdown_conn(), hb_Proc_shutdown, and NULL.
Referenced by hb_thread_master_reader().
const char* hb_process_type_string | ( | int | ptype | ) |
Definition at line 104 of file heartbeat.c.
References HB_PTYPE_APPLYLOGDB, HB_PTYPE_APPLYLOGDB_STR, HB_PTYPE_COPYLOGDB, HB_PTYPE_COPYLOGDB_STR, HB_PTYPE_SERVER, and HB_PTYPE_SERVER_STR.
Referenced by hb_help_sprint_processes_info().
int hb_register_to_master | ( | CSS_CONN_ENTRY * | conn, |
int | type | ||
) |
Definition at line 355 of file heartbeat.c.
References ARG_FILE_LINE, css_send_heartbeat_data(), css_send_heartbeat_request(), ER_FAILED, er_log_debug, error(), css_conn_entry::fd, free_and_init, hb_make_set_hbp_register(), IS_INVALID_SOCKET, NO_ERROR, NO_ERRORS, NULL, and SERVER_REGISTER_HA_PROCESS.
Referenced by css_init(), and hb_process_init().
void hb_set_argv | ( | char ** | argv | ) |
Definition at line 137 of file heartbeat.c.
Referenced by applylogdb(), copylogdb(), and main().
void hb_set_exec_path | ( | char * | exec_path | ) |
Definition at line 125 of file heartbeat.c.
References hb_Exec_path.
Referenced by applylogdb(), copylogdb(), and main().
bool hb_Proc_shutdown |
Definition at line 93 of file heartbeat.c.
Referenced by applylogdb(), copylogdb(), hb_process_master_request(), hb_process_term(), and la_apply_log_file().