CUBRID Engine  latest
broker.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
#include <assert.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/file.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netinet/tcp.h>
#include <sys/time.h>
#include <sys/un.h>
#include "connection_defs.h"
#include "connection_cl.h"
#include "system_parameter.h"
#include "databases_file.h"
#include "util_func.h"
#include "cas_error.h"
#include "cas_common.h"
#include "broker_error.h"
#include "broker_env_def.h"
#include "broker_shm.h"
#include "broker_msg.h"
#include "broker_process_size.h"
#include "broker_util.h"
#include "broker_access_list.h"
#include "broker_filename.h"
#include "broker_er_html.h"
#include "broker_send_fd.h"
#include "error_manager.h"
#include "shard_shm.h"
#include "shard_metadata.h"
#include "broker_proxy_conn.h"
#include "dbtype_def.h"

Go to the source code of this file.

Classes

struct  t_clt_table
 

Macros

#define PS_CHK_PERIOD   600
 
#define IP_ADDR_STR_LEN   20
 
#define BUFFER_SIZE   ONE_K
 
#define ENV_BUF_INIT_SIZE   512
 
#define ALIGN_ENV_BUF_SIZE(X)   ((((X) + ENV_BUF_INIT_SIZE) / ENV_BUF_INIT_SIZE) * ENV_BUF_INIT_SIZE)
 
#define MONITOR_SERVER_INTERVAL   5
 
#define V3_WRITE_HEADER_OK_FILE_SOCK(sock_fd)
 
#define V3_WRITE_HEADER_ERR_SOCK(sockfd)
 
#define SET_BROKER_ERR_CODE()
 
#define SET_BROKER_OK_CODE()
 
#define CAS_SEND_ERROR_CODE(FD, VAL)
 
#define JOB_COUNT_MAX   1000000
 
#define NUM_COLLECT_COUNT_PER_INTVL   4
 
#define HANG_COUNT_THRESHOLD_RATIO   0.5
 
#define SOCKET_TIMEOUT_SEC   2
 

Typedefs

typedef struct t_clt_table T_CLT_TABLE
 

Enumerations

enum  SERVER_STATE {
  SERVER_STATE_UNKNOWN = 0, SERVER_STATE_DEAD = 1, SERVER_STATE_DEREGISTERED = 2, SERVER_STATE_STARTED = 3,
  SERVER_STATE_NOT_REGISTERED = 4, SERVER_STATE_REGISTERED = 5, SERVER_STATE_REGISTERED_AND_TO_BE_STANDBY = 6, SERVER_STATE_REGISTERED_AND_ACTIVE = 7,
  SERVER_STATE_REGISTERED_AND_TO_BE_ACTIVE = 8
}
 

Functions

static void shard_broker_process (void)
 
static void cleanup (int signo)
 
static int init_env (void)
 
static int init_proxy_env (void)
 
static int broker_init_shm (void)
 
static void cas_monitor_worker (T_APPL_SERVER_INFO *as_info_p, int br_index, int as_index, int *busy_uts)
 
static void psize_check_worker (T_APPL_SERVER_INFO *as_info_p, int br_index, int as_index)
 
static void proxy_check_worker (int br_index, T_PROXY_INFO *proxy_info_p)
 
static void proxy_monitor_worker (T_PROXY_INFO *proxy_info_p, int br_index, int proxy_index)
 
static THREAD_FUNC receiver_thr_f (void *arg)
 
static THREAD_FUNC dispatch_thr_f (void *arg)
 
static THREAD_FUNC shard_dispatch_thr_f (void *arg)
 
static THREAD_FUNC psize_check_thr_f (void *arg)
 
static THREAD_FUNC cas_monitor_thr_f (void *arg)
 
static THREAD_FUNC hang_check_thr_f (void *arg)
 
static THREAD_FUNC proxy_monitor_thr_f (void *arg)
 
static THREAD_FUNC proxy_listener_thr_f (void *arg)
 
static THREAD_FUNC server_monitor_thr_f (void *arg)
 
static int read_nbytes_from_client (SOCKET sock_fd, char *buf, int size)
 
static int write_to_client (SOCKET sock_fd, char *buf, int size)
 
static int write_to_client_with_timeout (SOCKET sock_fd, char *buf, int size, int timeout_sec)
 
static int read_from_client (SOCKET sock_fd, char *buf, int size)
 
static int read_from_client_with_timeout (SOCKET sock_fd, char *buf, int size, int timeout_sec)
 
static int run_appl_server (T_APPL_SERVER_INFO *as_info_p, int br_index, int as_index)
 
static int stop_appl_server (T_APPL_SERVER_INFO *as_info_p, int br_index, int as_index)
 
static void restart_appl_server (T_APPL_SERVER_INFO *as_info_p, int br_index, int as_index)
 
static int run_proxy_server (T_PROXY_INFO *proxy_info_p, int br_index, int proxy_index)
 
static int stop_proxy_server (T_PROXY_INFO *proxy_info_p, int br_index, int proxy_index)
 
static void restart_proxy_server (T_PROXY_INFO *proxy_info_p, int br_index, int proxy_index)
 
static SOCKET connect_srv (char *br_name, int as_index)
 
static int find_idle_cas (void)
 
static int find_drop_as_index (void)
 
static int find_add_as_index (void)
 
static bool broker_add_new_cas (void)
 
static void check_cas_log (char *br_name, T_APPL_SERVER_INFO *as_info_p, int as_index)
 
static void check_proxy_log (char *br_name, T_PROXY_INFO *proxy_info_p)
 
static void check_proxy_access_log (T_PROXY_INFO *proxy_info_p)
 
static void get_as_sql_log_filename (char *log_filename, int len, char *broker_name, T_APPL_SERVER_INFO *as_info_p, int as_index)
 
static void get_as_slow_log_filename (char *log_filename, int len, char *broker_name, T_APPL_SERVER_INFO *as_info_p, int as_index)
 
static CSS_CONN_ENTRYconnect_to_master_for_server_monitor (const char *db_name, const char *db_host)
 
static int get_server_state_from_master (CSS_CONN_ENTRY *conn, const char *db_name)
 
static int insert_db_server_check_list (T_DB_SERVER *list_p, int check_list_cnt, const char *db_name, const char *db_host)
 
static bool broker_drop_one_cas_by_time_to_kill (void)
 
int main (int argc, char *argv[])
 
static void send_error_to_driver (int sock, int error, char *driver_info)
 

Variables

static SOCKET sock_fd
 
static struct sockaddr_in sock_addr
 
static int sock_addr_len
 
static SOCKET proxy_sock_fd
 
static struct sockaddr_un shard_sock_addr
 
static T_SHM_BROKERshm_br = NULL
 
static T_SHM_APPL_SERVERshm_appl
 
static T_BROKER_INFObr_info_p = NULL
 
static T_SHM_PROXYshm_proxy_p = NULL
 
static int br_index = -1
 
static int br_shard_flag = OFF
 
static pthread_cond_t clt_table_cond
 
static pthread_mutex_t clt_table_mutex
 
static pthread_mutex_t run_appl_mutex
 
static pthread_mutex_t broker_shm_mutex
 
static pthread_mutex_t run_proxy_mutex
 
static char run_proxy_flag = 0
 
static char run_appl_server_flag = 0
 
static int current_dropping_as_index = -1
 
static int process_flag = 1
 
static int num_busy_uts = 0
 
static int max_open_fd = 128
 
static int hold_job = 0
 
static const char * cas_client_type_str []
 

Macro Definition Documentation

#define ALIGN_ENV_BUF_SIZE (   X)    ((((X) + ENV_BUF_INIT_SIZE) / ENV_BUF_INIT_SIZE) * ENV_BUF_INIT_SIZE)

Definition at line 109 of file broker.c.

#define BUFFER_SIZE   ONE_K

Definition at line 106 of file broker.c.

Referenced by db_fprint_value(), db_print_value(), and pr_valstring().

#define CAS_SEND_ERROR_CODE (   FD,
  VAL 
)
Value:
do { \
int write_val; \
write_val = htonl(VAL); \
write_to_client(FD, (char*) &write_val, 4); \
} while (0)
unsigned int htonl(unsigned int from)
static int write_to_client(SOCKET sock_fd, char *buf, int size)
Definition: broker.c:1457

Definition at line 190 of file broker.c.

Referenced by dispatch_thr_f(), receiver_thr_f(), and shard_dispatch_thr_f().

#define ENV_BUF_INIT_SIZE   512

Definition at line 108 of file broker.c.

#define HANG_COUNT_THRESHOLD_RATIO   0.5

Definition at line 201 of file broker.c.

Referenced by hang_check_thr_f().

#define IP_ADDR_STR_LEN   20

Definition at line 105 of file broker.c.

#define JOB_COUNT_MAX   1000000

Definition at line 197 of file broker.c.

Referenced by receiver_thr_f().

#define MONITOR_SERVER_INTERVAL   5

Definition at line 112 of file broker.c.

Referenced by server_monitor_thr_f().

#define NUM_COLLECT_COUNT_PER_INTVL   4

Definition at line 200 of file broker.c.

Referenced by hang_check_thr_f().

#define PS_CHK_PERIOD   600

Definition at line 94 of file broker.c.

#define SET_BROKER_ERR_CODE ( )
Value:
do { \
if (shm_br && br_index >= 0) { \
} \
} while (0)
T_BROKER_INFO br_info[1]
Definition: broker_shm.h:661
int uw_get_error_code(void)
Definition: broker_error.c:83
int uw_get_os_error_code(void)
Definition: broker_error.c:89
if(extra_options)
Definition: dynamic_load.c:958
static T_SHM_BROKER * shm_br
Definition: broker.c:310
static int br_index
Definition: broker.c:315

Definition at line 175 of file broker.c.

Referenced by broker_init_shm(), and main().

#define SET_BROKER_OK_CODE ( )
Value:
do { \
if (shm_br && br_index >= 0) { \
} \
} while (0)
T_BROKER_INFO br_info[1]
Definition: broker_shm.h:661
if(extra_options)
Definition: dynamic_load.c:958
static T_SHM_BROKER * shm_br
Definition: broker.c:310
static int br_index
Definition: broker.c:315

Definition at line 183 of file broker.c.

Referenced by main().

#define SOCKET_TIMEOUT_SEC   2

Definition at line 206 of file broker.c.

Referenced by dispatch_thr_f(), and shard_dispatch_thr_f().

#define V3_WRITE_HEADER_ERR_SOCK (   sockfd)
Value:
do { \
memset(buf, '\0', sizeof(buf)); \
sprintf(buf, V3_HEADER_ERR); \
write_to_client(sockfd, buf, sizeof(buf)); \
} while(0);
#define V3_HEADER_ERR
Definition: broker_msg.h:49
#define V3_RESPONSE_HEADER_SIZE
Definition: broker_msg.h:50
static int write_to_client(SOCKET sock_fd, char *buf, int size)
Definition: broker.c:1457

Definition at line 167 of file broker.c.

#define V3_WRITE_HEADER_OK_FILE_SOCK (   sock_fd)
Value:
do { \
memset(buf, '\0', sizeof(buf)); \
sprintf(buf, V3_HEADER_OK); \
write_to_client(sock_fd, buf, sizeof(buf)); \
} while(0);
#define V3_RESPONSE_HEADER_SIZE
Definition: broker_msg.h:50
#define V3_HEADER_OK
Definition: broker_msg.h:48
static int write_to_client(SOCKET sock_fd, char *buf, int size)
Definition: broker.c:1457
static SOCKET sock_fd
Definition: broker.c:300

Definition at line 159 of file broker.c.

Typedef Documentation

typedef struct t_clt_table T_CLT_TABLE

Definition at line 223 of file broker.c.

Enumeration Type Documentation

Enumerator
SERVER_STATE_UNKNOWN 
SERVER_STATE_DEAD 
SERVER_STATE_DEREGISTERED 
SERVER_STATE_STARTED 
SERVER_STATE_NOT_REGISTERED 
SERVER_STATE_REGISTERED 
SERVER_STATE_REGISTERED_AND_TO_BE_STANDBY 
SERVER_STATE_REGISTERED_AND_ACTIVE 
SERVER_STATE_REGISTERED_AND_TO_BE_ACTIVE 

Definition at line 210 of file broker.c.

Function Documentation

static THREAD_FUNC cas_monitor_thr_f ( void *  arg)
static
static void check_proxy_access_log ( T_PROXY_INFO proxy_info_p)
static

Definition at line 2367 of file broker.c.

References t_proxy_info::access_log_file, NULL, t_proxy_info::proxy_access_log_reset, and PROXY_LOG_RESET_REOPEN.

Referenced by proxy_check_worker().

Here is the caller graph for this function:

static void check_proxy_log ( char *  br_name,
T_PROXY_INFO proxy_info_p 
)
static
static void cleanup ( int  signo)
static

Definition at line 717 of file broker.c.

References br_shard_flag, CLOSE_SOCKET, ON, process_flag, proxy_sock_fd, SLEEP_MILISEC, and sock_fd.

Referenced by add_using_index(), bf2df_str_cmpdisk(), btree_find_multi_uniques(), btree_index_next_scan(), btree_index_start_scan(), btree_node_common_prefix(), btree_scan_for_show_index_capacity(), csession_create_prepared_statement(), csession_drop_session_variables(), csession_get_last_insert_id(), csession_get_variable(), csession_set_session_variables(), cursor_fetch_page_having_tuple(), db_set_system_parameters(), db_string_rlike(), delete_list_by_oids(), dl_is_valid_image_file(), dl_validate_candidates(), do_alter_trigger(), do_check_for_empty_classes_in_delete(), do_create_partition_constraint(), do_drop_session_variables(), do_find_unique_constraint_violations(), do_get_prepared_statement_info(), do_insert_template(), do_on_duplicate_key_update(), do_prepare_insert(), do_prepare_merge(), do_process_prepare_statement(), do_replace_into(), do_set_session_variables(), filter_local_constraints(), heap_capacity_next_scan(), heap_class_get_partition_info(), heap_get_class_partitions(), heap_get_partition_attributes(), heap_get_partitions_from_subclasses(), heap_header_capacity_start_scan(), heap_header_next_scan(), heap_rv_postpone_append_pages_to_heap(), insert_subquery_results(), logtb_tran_load_global_stats_func(), main(), make_sort_limit_proc(), mr_data_cmpdisk_string(), mr_data_cmpdisk_varnchar(), mr_readval_string_internal(), mr_readval_varnchar_internal(), or_put_varchar_internal(), partition_attrinfo_get_key(), partition_cache_init(), partition_find_inherited_btid(), partition_find_partition_for_record(), partition_get_partition_oids(), partition_load_aggregate_helper(), partition_prune_hash(), partition_prune_insert(), partition_prune_range(), partition_prune_update(), pr_get_compression_length(), pr_get_size_and_write_string_to_buffer(), prm_get_next_param_value(), pruningset_to_spec_list(), pt_class_pre_fetch(), pt_get_query_limit_from_limit(), pt_to_merge_insert_xasl(), pt_to_merge_update_xasl(), pt_to_update_xasl(), qdata_evaluate_aggregate_hierarchy(), qdata_save_agg_hentry_to_list(), qexec_analytic_finalize_group(), qexec_analytic_update_group_result(), qexec_evaluate_partition_aggregates(), qexec_get_orderbynum_upper_bound(), qexec_topn_tuples_to_list_id(), qfile_set_tuple_column_value(), qmgr_execute_query(), qo_plan_is_orderby_skip_candidate(), sbtree_find_multi_uniques(), sort_listfile(), sqmgr_prepare_and_execute_query(), ssession_drop_session_variables(), ssession_get_prepared_statement(), ssession_set_session_variables(), stats_update_partitioned_statistics(), sysprm_obtain_server_parameters(), tde_decrypt_internal(), tde_encrypt_internal(), and xsysprm_get_force_server_parameters().

static SOCKET connect_srv ( char *  br_name,
int  as_index 
)
static
static CSS_CONN_ENTRY * connect_to_master_for_server_monitor ( const char *  db_name,
const char *  db_host 
)
static

Definition at line 1963 of file broker.c.

References css_connect_to_master_timeout(), NO_ERROR, NULL, prm_get_master_port_id(), SYSPRM_IGNORE_INTL_PARAMS, and sysprm_load_and_init().

Referenced by server_monitor_thr_f().

Here is the caller graph for this function:

static THREAD_FUNC dispatch_thr_f ( void *  arg)
static

Definition at line 1141 of file broker.c.

References t_broker_info::appl_server_max_num, t_shm_appl_server::as_info, assert, br_index, t_shm_broker::br_info, broker_add_new_cas(), t_max_heap_node::cas_client_type, t_appl_server_info::cas_client_type, t_appl_server_info::cas_clt_ip, t_appl_server_info::cas_clt_port, CAS_ER_FREE_SERVER, CAS_SEND_ERROR_CODE, CLOSE_SOCKET, t_max_heap_node::clt_sock_fd, t_clt_table::clt_sock_fd, clt_table_cond, clt_table_mutex, t_max_heap_node::clt_version, t_appl_server_info::clt_version, t_appl_server_info::con_status, CON_STATUS_IN_TRAN, connect_srv(), t_max_heap_node::driver_info, t_appl_server_info::driver_info, find_idle_cas(), hold_job, htonl(), i, INVALID_SOCKET, t_max_heap_node::ip_addr, t_clt_table::ip_addr, IS_INVALID_SOCKET, t_shm_appl_server::job_queue, t_appl_server_info::last_access_time, max_heap_delete(), max_heap_incr_priority(), t_broker_info::name, ntohl(), NULL, t_appl_server_info::num_connect_requests, t_appl_server_info::num_request, t_appl_server_info::pid, t_max_heap_node::port, process_flag, pthread_mutex_lock, pthread_mutex_unlock, read_from_client_with_timeout(), send_error_to_driver(), send_fd(), t_appl_server_info::service_flag, SERVICE_OFF, SERVICE_OFF_ACK, SLEEP_MILISEC, SOCKET_TIMEOUT_SEC, SRV_CON_CLIENT_INFO_SIZE, srv_sock_fd, THREAD_FUNC, t_appl_server_info::transaction_start_time, t_appl_server_info::uts_status, UTS_STATUS_IDLE, and write_to_client_with_timeout().

Referenced by main().

Here is the caller graph for this function:

static int find_add_as_index ( void  )
static
static void get_as_slow_log_filename ( char *  log_filename,
int  len,
char *  broker_name,
T_APPL_SERVER_INFO as_info_p,
int  as_index 
)
static
static void get_as_sql_log_filename ( char *  log_filename,
int  len,
char *  broker_name,
T_APPL_SERVER_INFO as_info_p,
int  as_index 
)
static

Definition at line 3311 of file broker.c.

References br_shard_flag, BROKER_PATH_MAX, dirname(), FID_SQL_LOG_DIR, get_cubrid_file(), ON, t_appl_server_info::proxy_id, t_appl_server_info::shard_cas_id, and t_appl_server_info::shard_id.

Referenced by check_cas_log().

Here is the caller graph for this function:

static int get_server_state_from_master ( CSS_CONN_ENTRY conn,
const char *  db_name 
)
static

Definition at line 1984 of file broker.c.

References css_receive_data(), css_send_request(), error(), free_and_init, GET_SERVER_STATE, NO_ERROR, NO_ERRORS, ntohl(), NULL, SERVER_STATE_DEAD, SERVER_STATE_UNKNOWN, and strlen.

Referenced by server_monitor_thr_f().

Here is the caller graph for this function:

static int init_env ( void  )
static

Definition at line 1355 of file broker.c.

References htons(), IS_INVALID_SOCKET, t_shm_appl_server::job_queue_size, NULL, PORT_NUMBER_ENV_STR, sock_addr, sock_addr_len, sock_fd, UW_ER_CANT_BIND, UW_ER_CANT_CREATE_SOCKET, and UW_SET_ERROR_CODE.

Referenced by main().

Here is the caller graph for this function:

static int init_proxy_env ( void  )
static

Definition at line 2895 of file broker.c.

References CLOSE_SOCKET, t_shm_appl_server::port_name, proxy_sock_fd, SHARD_ERR, shard_sock_addr, strlen, and strncpy_bufsize.

Referenced by main().

Here is the caller graph for this function:

static int insert_db_server_check_list ( T_DB_SERVER list_p,
int  check_list_cnt,
const char *  db_name,
const char *  db_host 
)
static

Definition at line 2025 of file broker.c.

References database_name, i, t_db_server::state, strncpy_bufsize, THREAD_FUNC, and UNUSABLE_DATABASE_MAX.

Referenced by server_monitor_thr_f().

Here is the caller graph for this function:

static THREAD_FUNC proxy_monitor_thr_f ( void *  arg)
static

Definition at line 3068 of file broker.c.

References br_index, NULL, t_shm_proxy::num_proxy, process_flag, proxy_info_p, proxy_monitor_worker(), shard_shm_find_proxy_info(), SLEEP_MILISEC, and THREAD_FUNC.

Referenced by main().

Here is the caller graph for this function:

static void proxy_monitor_worker ( T_PROXY_INFO proxy_info_p,
int  br_index,
int  proxy_index 
)
static
static THREAD_FUNC psize_check_thr_f ( void *  arg)
static
static void psize_check_worker ( T_APPL_SERVER_INFO as_info_p,
int  br_index,
int  as_index 
)
static
static int read_from_client ( SOCKET  sock_fd,
char *  buf,
int  size 
)
static

Definition at line 1402 of file broker.c.

References read_from_client_with_timeout().

Referenced by proxy_listener_thr_f(), and read_nbytes_from_client().

Here is the caller graph for this function:

static int read_from_client_with_timeout ( SOCKET  sock_fd,
char *  buf,
int  size,
int  timeout_sec 
)
static

Definition at line 1408 of file broker.c.

References maxfd, NULL, READ_FROM_SOCKET, and SELECT_MASK.

Referenced by dispatch_thr_f(), read_from_client(), and shard_dispatch_thr_f().

Here is the caller graph for this function:

static int read_nbytes_from_client ( SOCKET  sock_fd,
char *  buf,
int  size 
)
static

Definition at line 1736 of file broker.c.

References read_from_client().

Referenced by receiver_thr_f().

Here is the caller graph for this function:

static THREAD_FUNC receiver_thr_f ( void *  arg)
static

Definition at line 773 of file broker.c.

References t_broker_info::appl_server_max_num, t_shm_appl_server::as_info, br_index, t_shm_broker::br_info, br_shard_flag, CAS_CLIENT_NONE, t_max_heap_node::cas_client_type, cas_client_type, CAS_CLIENT_TYPE_MAX, t_appl_server_info::cas_clt_ip, t_appl_server_info::cas_clt_port, CAS_CONV_ERROR_TO_OLD, CAS_ER_COMMUNICATION, CAS_ER_FREE_SERVER, CAS_ER_NOT_AUTHORIZED_CLIENT, CAS_ER_QUERY_CANCEL, CAS_ER_SSL_TYPE_NOT_ALLOWED, CAS_MAKE_VER, CAS_PROTO_INDICATOR, CAS_PROTO_UNPACK_NET_VER, CAS_SEND_ERROR_CODE, CLOSE_SOCKET, t_max_heap_node::clt_sock_fd, t_clt_table::clt_sock_fd, clt_table_cond, clt_table_mutex, t_max_heap_node::clt_version, t_max_heap_node::driver_info, t_appl_server_info::fn_status, FN_STATUS_NONE, i, t_max_heap_node::id, t_max_heap_node::ip_addr, t_clt_table::ip_addr, IS_INVALID_SOCKET, IS_SSL_CLIENT, JOB_COUNT_MAX, t_shm_appl_server::job_queue, t_shm_appl_server::job_queue_size, max_heap_insert(), max_open_fd, t_broker_info::monitor_hang_flag, ntohl(), ntohs(), NULL, OFF, ON, t_appl_server_info::pid, pid, t_max_heap_node::port, t_max_heap_node::prg_name, t_max_heap_node::priority, process_flag, pthread_mutex_lock, pthread_mutex_unlock, read_nbytes_from_client(), t_max_heap_node::recv_time, t_broker_info::reject_client_count, t_broker_info::reject_client_flag, t_max_heap_node::script, send_error_to_driver(), t_appl_server_info::service_flag, SERVICE_ON, t_appl_server_info::session_id, t_broker_info::shard_flag, SLEEP_MILISEC, sock_fd, SRV_CON_CLIENT_INFO_SIZE, SRV_CON_CLIENT_MAGIC_LEN, SRV_CON_CLIENT_MAGIC_STR, SRV_CON_CLIENT_MAGIC_STR_SSL, SRV_CON_MSG_IDX_CLIENT_TYPE, SRV_CON_MSG_IDX_FUNCTION_FLAG, SRV_CON_MSG_IDX_MAJOR_VER, SRV_CON_MSG_IDX_MINOR_VER, SRV_CON_MSG_IDX_PATCH_VER, SRV_CON_MSG_IDX_PROTO_VERSION, THREAD_FUNC, t_broker_info::use_SSL, ut_set_keepalive(), t_appl_server_info::uts_status, UTS_STATUS_BUSY, uw_acl_check(), and v3_acl.

Referenced by main().

Here is the caller graph for this function:

static void restart_appl_server ( T_APPL_SERVER_INFO as_info_p,
int  br_index,
int  as_index 
)
static
static void restart_proxy_server ( T_PROXY_INFO proxy_info_p,
int  br_index,
int  proxy_index 
)
static

Definition at line 3299 of file broker.c.

References t_proxy_info::num_restarts, t_proxy_info::pid, run_proxy_server(), and stop_proxy_server().

Referenced by proxy_monitor_worker().

Here is the caller graph for this function:

static void send_error_to_driver ( int  sock,
int  error,
char *  driver_info 
)
static
static int stop_appl_server ( T_APPL_SERVER_INFO as_info_p,
int  br_index,
int  as_index 
)
static
static int stop_proxy_server ( T_PROXY_INFO proxy_info_p,
int  br_index,
int  proxy_index 
)
static
static int write_to_client ( SOCKET  sock_fd,
char *  buf,
int  size 
)
static

Definition at line 1457 of file broker.c.

References write_to_client_with_timeout().

Referenced by check_cas_log(), and send_error_to_driver().

Here is the caller graph for this function:

static int write_to_client_with_timeout ( SOCKET  sock_fd,
char *  buf,
int  size,
int  timeout_sec 
)
static

Definition at line 1463 of file broker.c.

References IS_INVALID_SOCKET, maxfd, NULL, SELECT_MASK, and WRITE_TO_SOCKET.

Referenced by dispatch_thr_f(), and write_to_client().

Here is the caller graph for this function:

Variable Documentation

T_BROKER_INFO* br_info_p = NULL
static

Definition at line 312 of file broker.c.

Referenced by admin_conf_change(), admin_getid_cmd(), brief_monitor(), and hang_check_thr_f().

pthread_mutex_t broker_shm_mutex
static
const char* cas_client_type_str[]
static
Initial value:
= {
"UNKNOWN",
"CCI",
"ODBC",
"JDBC",
"PHP",
"OLEDB",
"INTERNAL_JDBC"
}

Definition at line 762 of file broker.c.

pthread_cond_t clt_table_cond
static

Definition at line 322 of file broker.c.

Referenced by dispatch_thr_f(), main(), and receiver_thr_f().

pthread_mutex_t clt_table_mutex
static

Definition at line 323 of file broker.c.

Referenced by dispatch_thr_f(), main(), receiver_thr_f(), and shard_dispatch_thr_f().

int current_dropping_as_index = -1
static

Definition at line 331 of file broker.c.

Referenced by broker_drop_one_cas_by_time_to_kill(), and find_add_as_index().

int hold_job = 0
static

Definition at line 345 of file broker.c.

Referenced by broker_drop_one_cas_by_time_to_kill(), and dispatch_thr_f().

int max_open_fd = 128
static

Definition at line 337 of file broker.c.

Referenced by receiver_thr_f(), run_appl_server(), and run_proxy_server().

int num_busy_uts = 0
static

Definition at line 335 of file broker.c.

Referenced by broker_drop_one_cas_by_time_to_kill(), and cas_monitor_thr_f().

SOCKET proxy_sock_fd
static
pthread_mutex_t run_appl_mutex
static

Definition at line 324 of file broker.c.

Referenced by main(), and run_appl_server().

char run_appl_server_flag = 0
static

Definition at line 329 of file broker.c.

Referenced by run_appl_server().

char run_proxy_flag = 0
static

Definition at line 327 of file broker.c.

Referenced by run_proxy_server().

pthread_mutex_t run_proxy_mutex
static

Definition at line 326 of file broker.c.

Referenced by main(), and run_proxy_server().

struct sockaddr_un shard_sock_addr
static

Definition at line 307 of file broker.c.

Referenced by init_proxy_env(), and proxy_io_accept().

struct sockaddr_in sock_addr
static

Definition at line 301 of file broker.c.

Referenced by init_env().

int sock_addr_len
static

Definition at line 302 of file broker.c.

Referenced by connect_srv(), init_env(), and net_init_env().