CUBRID Engine  latest
heartbeat.c File Reference
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <assert.h>
#include <signal.h>
#include <fcntl.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/uio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "environment_variable.h"
#include "error_context.hpp"
#include "porting.h"
#include "system_parameter.h"
#include "error_manager.h"
#include "connection_defs.h"
#include "connection_support.h"
#include "tcp.h"
#include "release_string.h"
#include "heartbeat.h"

Go to the source code of this file.

Functions

CSS_CONN_ENTRYcss_connect_to_master_server (int master_port_id, const char *server_name, int name_length)
 
void css_shutdown_conn (CSS_CONN_ENTRY *conn)
 
static THREAD_RET_T THREAD_CALLING_CONVENTION hb_thread_master_reader (void *arg)
 
static char * hb_pack_server_name (const char *server_name, int *name_length, const char *log_path, HB_PROC_TYPE type)
 
static CSS_CONN_ENTRYhb_connect_to_master (const char *server_name, const char *log_path, HB_PROC_TYPE type)
 
static int hb_create_master_reader (void)
 
static int hb_process_master_request_info (CSS_CONN_ENTRY *conn)
 
static const char * hb_type_to_str (HB_PROC_TYPE type)
 
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)
 
static HBP_PROC_REGISTERhb_make_set_hbp_register (int type)
 
int hb_deregister_from_master (void)
 
int hb_register_to_master (CSS_CONN_ENTRY *conn, int type)
 
int hb_process_master_request (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

static pthread_t hb_Master_mon_th
 
static CSS_CONN_ENTRYhb_Conn = NULL
 
static char hb_Exec_path [PATH_MAX]
 
static char ** hb_Argv
 
bool hb_Proc_shutdown = false
 
SOCKET hb_Pipe_to_master = INVALID_SOCKET
 

Function Documentation

int css_receive_heartbeat_data ( CSS_CONN_ENTRY conn,
char *  data,
int  size 
)
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().

Here is the caller graph for this function:

int css_send_heartbeat_data ( CSS_CONN_ENTRY conn,
const char *  data,
int  size 
)
int css_send_heartbeat_request ( CSS_CONN_ENTRY conn,
int  command 
)
static CSS_CONN_ENTRY * hb_connect_to_master ( const char *  server_name,
const char *  log_path,
HB_PROC_TYPE  type 
)
static

Definition at line 579 of file heartbeat.c.

References css_connect_to_master_server(), css_conn_entry::fd, free_and_init, hb_pack_server_name(), hb_Pipe_to_master, NULL, and prm_get_master_port_id().

Referenced by hb_process_init().

Here is the caller graph for this function:

static HBP_PROC_REGISTER* hb_make_set_hbp_register ( int  type)
static
static char * hb_pack_server_name ( const char *  server_name,
int *  name_length,
const char *  log_path,
HB_PROC_TYPE  type 
)
static
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().

Here is the caller graph for this function:

int hb_process_master_request ( void  )
static int hb_process_master_request_info ( CSS_CONN_ENTRY conn)
static

Definition at line 402 of file heartbeat.c.

References ARG_FILE_LINE, css_receive_heartbeat_request(), ER_FAILED, er_log_debug, NO_ERROR, NO_ERRORS, NULL, and rc.

Referenced by hb_process_master_request().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

int hb_register_to_master ( CSS_CONN_ENTRY conn,
int  type 
)
void hb_set_argv ( char **  argv)

Definition at line 137 of file heartbeat.c.

References argv, and hb_Argv.

Referenced by applylogdb(), copylogdb(), and main().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

static THREAD_RET_T THREAD_CALLING_CONVENTION hb_thread_master_reader ( void *  arg)
static

Definition at line 253 of file heartbeat.c.

References error(), hb_process_master_request(), hb_process_term(), NO_ERROR, and THREAD_RET_T.

Referenced by hb_create_master_reader().

Here is the caller graph for this function:

static const char * hb_type_to_str ( HB_PROC_TYPE  type)
static

Definition at line 424 of file heartbeat.c.

References HB_PTYPE_APPLYLOGDB, and HB_PTYPE_COPYLOGDB.

Referenced by hb_process_init().

Here is the caller graph for this function:

Variable Documentation

char** hb_Argv
static

Definition at line 91 of file heartbeat.c.

Referenced by hb_make_set_hbp_register(), hb_process_init(), and hb_set_argv().

CSS_CONN_ENTRY* hb_Conn = NULL
static

Definition at line 89 of file heartbeat.c.

char hb_Exec_path[PATH_MAX]
static

Definition at line 90 of file heartbeat.c.

Referenced by hb_make_set_hbp_register(), hb_process_init(), and hb_set_exec_path().

pthread_t hb_Master_mon_th
static

Definition at line 87 of file heartbeat.c.

SOCKET hb_Pipe_to_master = INVALID_SOCKET

Definition at line 95 of file heartbeat.c.

Referenced by hb_connect_to_master().

bool hb_Proc_shutdown = false