CUBRID Engine
latest
|
#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_ENTRY * | connect_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_BROKER * | shm_br = NULL |
static T_SHM_APPL_SERVER * | shm_appl |
static T_BROKER_INFO * | br_info_p = NULL |
static T_SHM_PROXY * | shm_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 [] |
#define ALIGN_ENV_BUF_SIZE | ( | X | ) | ((((X) + ENV_BUF_INIT_SIZE) / ENV_BUF_INIT_SIZE) * ENV_BUF_INIT_SIZE) |
#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 | |||
) |
Definition at line 190 of file broker.c.
Referenced by dispatch_thr_f(), receiver_thr_f(), and shard_dispatch_thr_f().
#define HANG_COUNT_THRESHOLD_RATIO 0.5 |
Definition at line 201 of file broker.c.
Referenced by hang_check_thr_f().
#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 SET_BROKER_ERR_CODE | ( | ) |
Definition at line 175 of file broker.c.
Referenced by broker_init_shm(), and main().
#define SET_BROKER_OK_CODE | ( | ) |
#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 | ) |
#define V3_WRITE_HEADER_OK_FILE_SOCK | ( | sock_fd | ) |
typedef struct t_clt_table T_CLT_TABLE |
enum SERVER_STATE |
|
static |
Definition at line 348 of file broker.c.
References t_broker_info::appl_server_max_num, t_broker_info::appl_server_num, t_shm_appl_server::as_info, br_index, t_shm_broker::br_info, broker_shm_mutex, t_appl_server_info::cas_clt_ip, t_appl_server_info::cas_clt_port, t_appl_server_info::driver_version, FALSE, find_add_as_index(), getsize(), NULL, t_shm_appl_server::num_appl_server, t_appl_server_info::pid, pid, t_appl_server_info::psize, t_appl_server_info::psize_time, pthread_mutex_lock, pthread_mutex_unlock, t_appl_server_info::reset_flag, run_appl_server(), t_appl_server_info::service_flag, SERVICE_ON, t_appl_server_info::uts_status, and UTS_STATUS_IDLE.
Referenced by dispatch_thr_f().
|
static |
Definition at line 394 of file broker.c.
References t_broker_info::appl_server_num, t_shm_appl_server::as_info, br_index, t_shm_broker::br_info, broker_shm_mutex, t_appl_server_info::con_status, CON_STATUS_CLOSE, CON_STATUS_LOCK, CON_STATUS_LOCK_BROKER, CON_STATUS_OUT_TRAN, CON_STATUS_UNLOCK, t_appl_server_info::cur_keep_con, current_dropping_as_index, find_drop_as_index(), hold_job, t_max_heap_node::id, t_shm_appl_server::job_queue, KEEP_CON_AUTO, t_appl_server_info::last_access_time, NULL, t_shm_appl_server::num_appl_server, num_busy_uts, pthread_mutex_lock, pthread_mutex_unlock, t_appl_server_info::service_flag, SERVICE_OFF_ACK, SERVICE_ON, stop_appl_server(), t_broker_info::time_to_kill, t_appl_server_info::uts_status, UTS_STATUS_BUSY, and UTS_STATUS_IDLE.
Referenced by main().
|
static |
Definition at line 2937 of file broker.c.
References t_broker_info::appl_server_shm_id, br_index, t_shm_broker::br_info, i, MASTER_SHM_KEY_ENV_STR, NULL, t_shm_broker::num_broker, ON, p, parse_int(), t_broker_info::port, PORT_NUMBER_ENV_STR, proxy_shm_id, t_broker_info::proxy_shm_id, SET_BROKER_ERR_CODE, SHARD_ERR, t_shm_appl_server::shard_flag, SHM_APPL_SERVER, SHM_BROKER, SHM_MODE_ADMIN, SHM_PROXY, UW_ER_CANT_CREATE_SOCKET, UW_ER_SHM_OPEN, UW_SET_ERROR_CODE, and uw_shm_open().
Referenced by main().
|
static |
Definition at line 1940 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, cas_monitor_worker(), i, NULL, t_broker_info::num_busy_count, num_busy_uts, process_flag, and SLEEP_MILISEC.
Referenced by main().
|
static |
Definition at line 1825 of file broker.c.
References t_broker_info::appl_server_hard_limit, t_shm_appl_server::appl_server_hard_limit, t_broker_info::appl_server_num, assert, br_index, t_shm_broker::br_info, br_shard_flag, t_appl_server_info::con_status, CON_STATUS_CLOSE, CON_STATUS_LOCK_DESTROY, FALSE, t_appl_server_info::last_access_time, NULL, t_shard_info::num_appl_server, t_shm_appl_server::num_appl_server, t_appl_server_info::num_request, OFF, ON, t_appl_server_info::pid, t_appl_server_info::proxy_id, proxy_info_p, t_appl_server_info::psize, t_appl_server_info::reset_flag, restart_appl_server(), run_appl_server(), t_appl_server_info::service_flag, SERVICE_OFF, SERVICE_ON, t_appl_server_info::shard_id, shard_shm_find_proxy_info(), shard_shm_find_shard_info(), stop_appl_server(), THREAD_FUNC, TRUE, t_appl_server_info::uts_status, UTS_STATUS_BUSY, UTS_STATUS_IDLE, UTS_STATUS_RESTART, UTS_STATUS_START, and UTS_STATUS_STOP.
Referenced by cas_monitor_thr_f().
|
static |
Definition at line 2529 of file broker.c.
References t_broker_info::appl_server, t_shm_appl_server::as_info, br_index, t_shm_broker::br_info, BROKER_PATH_MAX, t_appl_server_info::cas_log_reset, CAS_LOG_RESET_REOPEN, t_appl_server_info::cas_slow_log_reset, t_clt_table::clt_sock_fd, t_appl_server_info::cur_slow_log_mode, t_appl_server_info::cur_sql_log_mode, get_as_slow_log_filename(), get_as_sql_log_filename(), IS_NOT_APPL_SERVER_TYPE_CAS, maxfd, ntohl(), NULL, t_appl_server_info::pid, READ_FROM_SOCKET, SELECT_MASK, SLOW_LOG_MODE_OFF, sock_fd, SQL_LOG_MODE_NONE, SRV_CON_DB_INFO_SIZE, srv_sock_fd, and write_to_client().
Referenced by psize_check_worker().
|
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().
|
static |
Definition at line 2341 of file broker.c.
References BROKER_PATH_MAX, t_proxy_info::cur_proxy_log_mode, log_filepath, NULL, t_proxy_info::proxy_id, t_shm_appl_server::proxy_log_dir, PROXY_LOG_MODE_NONE, t_proxy_info::proxy_log_reset, and PROXY_LOG_RESET_REOPEN.
Referenced by proxy_check_worker().
|
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 |
Definition at line 1754 of file broker.c.
References t_shm_appl_server::as_info, br_index, t_shm_broker::br_info, br_shard_flag, CLOSE_SOCKET, htons(), INVALID_SOCKET, IS_INVALID_SOCKET, t_shm_broker::my_ip_addr, t_broker_info::name, t_appl_server_info::pid, run_appl_server(), sock_addr_len, srv_sock_fd, strlen, ut_get_as_port_name(), and ut_kill_as_process().
Referenced by dispatch_thr_f().
|
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().
|
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().
|
static |
Definition at line 2875 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, broker_shm_mutex, current_dropping_as_index, i, pthread_mutex_lock, pthread_mutex_unlock, t_appl_server_info::service_flag, and SERVICE_OFF_ACK.
Referenced by broker_add_new_cas().
|
static |
Definition at line 2814 of file broker.c.
References t_broker_info::appl_server, t_broker_info::appl_server_max_num, t_broker_info::appl_server_num, t_shm_appl_server::as_info, br_index, t_shm_broker::br_info, broker_shm_mutex, t_appl_server_info::cas_change_mode, CAS_CHANGE_MODE_AUTO, t_appl_server_info::con_status, CON_STATUS_OUT_TRAN, i, IS_NOT_APPL_SERVER_TYPE_CAS, t_appl_server_info::last_access_time, NULL, t_appl_server_info::num_holdable_results, pthread_mutex_lock, pthread_mutex_unlock, t_appl_server_info::service_flag, SERVICE_ON, t_broker_info::time_to_kill, t_appl_server_info::uts_status, UTS_STATUS_BUSY, and UTS_STATUS_IDLE.
Referenced by broker_drop_one_cas_by_time_to_kill().
|
static |
Definition at line 2728 of file broker.c.
References t_broker_info::appl_server_max_num, t_broker_info::appl_server_num, t_shm_appl_server::as_info, br_index, t_shm_broker::br_info, broker_shm_mutex, t_appl_server_info::cas_change_mode, CAS_CHANGE_MODE_AUTO, t_appl_server_info::con_status, CON_STATUS_CLOSE_AND_CONNECT, CON_STATUS_LOCK, CON_STATUS_LOCK_BROKER, CON_STATUS_OUT_TRAN, CON_STATUS_UNLOCK, t_appl_server_info::cur_keep_con, FALSE, i, KEEP_CON_AUTO, t_appl_server_info::last_access_time, NULL, t_appl_server_info::num_holdable_results, t_appl_server_info::pid, pthread_mutex_lock, pthread_mutex_unlock, t_appl_server_info::service_flag, SERVICE_ON, t_appl_server_info::uts_status, UTS_STATUS_BUSY, UTS_STATUS_IDLE, and UTS_STATUS_RESTART.
Referenced by dispatch_thr_f().
|
static |
Definition at line 3335 of file broker.c.
References br_shard_flag, BROKER_PATH_MAX, dirname(), FID_SLOW_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().
|
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().
|
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().
|
static |
Definition at line 2179 of file broker.c.
References t_broker_info::appl_server_max_num, t_broker_info::appl_server_num, t_shm_appl_server::as_info, br_index, t_shm_broker::br_info, br_info_p, br_shard_flag, t_appl_server_info::claimed_alive_time, t_proxy_info::claimed_alive_time, HANG_COUNT_THRESHOLD_RATIO, t_broker_info::hang_timeout, i, t_broker_info::monitor_hang_interval, NULL, NUM_COLLECT_COUNT_PER_INTVL, t_shm_proxy::num_proxy, OFF, process_flag, proxy_info_p, t_broker_info::reject_client_flag, t_appl_server_info::service_flag, t_proxy_info::service_flag, SERVICE_ON, shard_shm_find_proxy_info(), SLEEP_MILISEC, and ut_get_avg_from_array().
Referenced by main().
|
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().
|
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().
|
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().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 463 of file broker.c.
References t_broker_info::acl_file, t_broker_info::appl_server_max_num, t_shm_appl_server::as_info, t_broker_info::auto_add_appl_server, br_index, t_shm_broker::br_info, br_shard_flag, broker_destroy_proxy_conn(), broker_drop_one_cas_by_time_to_kill(), broker_init_proxy_conn(), broker_init_shm(), broker_shm_mutex, cas_monitor_thr_f(), cleanup(), t_max_heap_node::clt_sock_fd, clt_table_cond, clt_table_mutex, dispatch_thr_f(), t_broker_info::err_code, error(), FID_SLOW_LOG_DIR, FID_SQL_LOG_DIR, hang_check_thr_f(), i, init_env(), init_proxy_env(), INVALID_SOCKET, t_appl_server_info::last_access_time, t_shm_appl_server::log_dir, t_broker_info::monitor_hang_flag, NULL, t_broker_info::num_proxy, OFF, ON, process_flag, proxy_listener_thr_f(), proxy_monitor_thr_f(), psize_check_thr_f(), pthread_mutex_init, t_broker_info::ready_to_service, receiver_thr_f(), run_appl_mutex, run_proxy_mutex, server_monitor_thr_f(), t_appl_server_info::service_flag, SERVICE_OFF_ACK, SERVICE_ON, SET_BROKER_ERR_CODE, SET_BROKER_OK_CODE, set_cubrid_file(), shard_broker_process(), shard_dispatch_thr_f(), t_broker_info::shard_flag, SLEEP_MILISEC, t_shm_appl_server::slow_log_dir, THREAD_BEGIN, t_appl_server_info::transaction_start_time, uw_acl_make(), UW_ER_CANT_CREATE_SOCKET, UW_ER_NO_MORE_MEMORY, UW_SET_ERROR_CODE, and wsa_initialize().
|
static |
Definition at line 2388 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, check_proxy_access_log(), check_proxy_log(), FALSE, i, t_broker_info::name, NULL, t_shm_proxy::num_proxy, ON, t_broker_info::pid, pid, process_flag, proxy_info_p, psize_check_thr_f(), psize_check_worker(), shard_shm_find_proxy_info(), SLEEP_MILISEC, THREAD_FUNC, and TRUE.
Referenced by psize_check_thr_f().
|
static |
Definition at line 3093 of file broker.c.
References allset, broker_add_proxy_conn(), broker_delete_proxy_conn_by_fd(), broker_get_proxy_conn_maxfd(), broker_get_readable_proxy_conn(), broker_register_proxy_conn(), broker_set_proxy_fds(), CLOSE_SOCKET, htonl(), INVALID_SOCKET, NULL, process_flag, proxy_id, proxy_sock_fd, read_from_client(), rset, and SELECT_MASK.
Referenced by main().
|
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().
|
static |
Definition at line 3016 of file broker.c.
References t_proxy_info::cur_client, FALSE, NULL, t_proxy_info::pid, PROXY_STATUS_RESTART, PROXY_STATUS_START, restart_proxy_server(), run_proxy_server(), t_proxy_info::service_flag, SERVICE_ON, SLEEP_MILISEC, t_proxy_info::status, t_proxy_info::stmt_waiter_count, stop_proxy_server(), and THREAD_FUNC.
Referenced by proxy_monitor_thr_f().
|
static |
Definition at line 2489 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, i, NULL, t_shm_proxy::num_proxy, ON, process_flag, proxy_check_worker(), proxy_info_p, psize_check_worker(), shard_shm_find_proxy_info(), and SLEEP_MILISEC.
Referenced by main(), and proxy_check_worker().
|
static |
Definition at line 2281 of file broker.c.
References t_shm_broker::br_info, check_cas_log(), FALSE, getsize(), t_broker_info::name, NULL, t_appl_server_info::pid, pid, t_appl_server_info::psize, t_appl_server_info::service_flag, and SERVICE_ON.
Referenced by proxy_check_worker(), and psize_check_thr_f().
|
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().
|
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().
|
static |
Definition at line 1736 of file broker.c.
References read_from_client().
Referenced by receiver_thr_f().
|
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().
|
static |
Definition at line 1674 of file broker.c.
References t_appl_server_info::as_id, t_shm_broker::br_info, br_shard_flag, BROKER_PATH_MAX, getsize(), t_broker_info::name, NULL, t_appl_server_info::pid, t_appl_server_info::psize, t_appl_server_info::psize_time, run_appl_server(), SLEEP_MILISEC, ut_get_as_pid_name(), and ut_kill_as_process().
Referenced by cas_monitor_worker().
|
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().
|
static |
Definition at line 1526 of file broker.c.
References t_broker_info::appl_server, APPL_SERVER_CAS_ORACLE, t_shm_appl_server::appl_server_name, APPL_SERVER_NAME_MAX_SIZE, t_broker_info::appl_server_shm_id, APPL_SERVER_SHM_KEY_STR, AS_ID_ENV_STR, t_shm_broker::br_info, br_shard_flag, BROKER_PATH_MAX, CON_STATUS_LOCK_DESTROY, CON_STATUS_LOCK_INIT, environ, FALSE, i, max_open_fd, t_broker_info::name, NULL, t_appl_server_info::num_restarts, OFF, ON, pid, t_appl_server_info::proxy_id, pthread_mutex_lock, pthread_mutex_unlock, run_appl_mutex, run_appl_server_flag, t_appl_server_info::service_ready_flag, t_appl_server_info::shard_cas_id, t_appl_server_info::shard_id, SLEEP_MILISEC, t_appl_server_info::transaction_start_time, ut_get_as_port_name(), ut_is_appl_server_ready(), t_appl_server_info::uts_status, and UTS_STATUS_CON_WAIT.
Referenced by broker_add_new_cas(), cas_monitor_worker(), connect_srv(), restart_appl_server(), and shard_broker_process().
|
static |
Definition at line 3179 of file broker.c.
References APPL_SERVER_NAME_MAX_SIZE, assert, t_shm_broker::br_info, t_shm_appl_server::broker_name, t_proxy_info::cur_client, environ, i, max_open_fd, NAME_PROXY, NULL, pid, t_proxy_info::port_name, PROXY_ID_ENV_STR, t_broker_info::proxy_shm_id, PROXY_SHM_KEY_STR, pthread_mutex_lock, pthread_mutex_unlock, run_proxy_flag, run_proxy_mutex, and SLEEP_MILISEC.
Referenced by proxy_monitor_worker(), and restart_proxy_server().
|
static |
Definition at line 736 of file broker.c.
References CAS_CONV_ERROR_TO_OLD, cas_di_understand_renewed_error_code(), CAS_MAKE_PROTO_VER, CAS_PROTO_MAKE_VER, htonl(), NO_ERROR, PROTOCOL_V2, and write_to_client().
Referenced by dispatch_thr_f(), receiver_thr_f(), and shard_dispatch_thr_f().
|
static |
Definition at line 2050 of file broker.c.
References t_broker_info::appl_server, APPL_SERVER_CAS, t_broker_info::appl_server_max_num, t_shm_appl_server::as_info, br_index, t_shm_broker::br_info, br_shard_flag, cfg_find_db(), cfg_free_directory(), connect_to_master_for_server_monitor(), css_free_conn(), CUB_MAXHOSTNAMELEN, t_db_server::database_host, t_appl_server_info::database_name, database_name, t_db_server::database_name, ER_ALL_FINAL, er_final(), er_init(), ER_NEVER_EXIT, free_and_init, get_server_state_from_master(), database_info::hosts, i, insert_db_server_check_list(), t_shm_appl_server::monitor_server_flag, MONITOR_SERVER_INTERVAL, NULL, database_info::num_hosts, ON, t_shm_appl_server::preferred_hosts, process_flag, SERVER_STATE_REGISTERED, SERVER_STATE_UNKNOWN, SLEEP_MILISEC, SRV_CON_DBNAME_SIZE, t_db_server::state, THREAD_FUNC, UNUSABLE_DATABASE_MAX, t_shm_appl_server::unusable_databases, t_shm_appl_server::unusable_databases_cnt, t_shm_appl_server::unusable_databases_seq, util_free_string_array(), util_split_string(), t_appl_server_info::uts_status, and UTS_STATUS_BUSY.
Referenced by main().
|
static |
Definition at line 655 of file broker.c.
References t_broker_info::appl_server_num, t_shm_appl_server::as_info, t_shard_info::as_info_index_base, t_broker_info::auto_add_appl_server, br_index, t_shm_broker::br_info, t_appl_server_info::cur_slow_log_mode, t_appl_server_info::cur_sql_log_mode, FALSE, getsize(), i, t_shard_info::max_appl_server, t_shard_info::min_appl_server, NULL, t_shard_info::num_appl_server, t_shm_appl_server::num_appl_server, t_shm_proxy::num_proxy, t_proxy_info::num_shard_conn, OFF, t_appl_server_info::pid, pid, process_flag, proxy_info_p, t_appl_server_info::psize, t_appl_server_info::psize_time, t_appl_server_info::reset_flag, run_appl_server(), t_appl_server_info::service_flag, SERVICE_OFF, SERVICE_ON, shard_shm_find_proxy_info(), shard_shm_find_shard_info(), SLEEP_MILISEC, t_shm_appl_server::slow_log_mode, t_shm_appl_server::sql_log_mode, t_appl_server_info::uts_status, UTS_STATUS_START, and t_shard_info::waiter_count.
Referenced by main().
|
static |
Definition at line 1066 of file broker.c.
References broker_delete_proxy_conn_by_fd(), broker_find_available_proxy(), CAS_ER_FREE_SERVER, CAS_SEND_ERROR_CODE, CLOSE_SOCKET, t_max_heap_node::clt_sock_fd, clt_table_mutex, t_max_heap_node::clt_version, t_max_heap_node::driver_info, INVALID_SOCKET, t_max_heap_node::ip_addr, t_clt_table::ip_addr, t_shm_appl_server::job_queue, max_heap_delete(), max_heap_incr_priority(), NULL, process_flag, pthread_mutex_lock, pthread_mutex_unlock, read_from_client_with_timeout(), send_error_to_driver(), send_fd(), SLEEP_MILISEC, SOCKET_TIMEOUT_SEC, and THREAD_FUNC.
Referenced by main().
|
static |
Definition at line 1647 of file broker.c.
References t_shm_broker::br_info, br_shard_flag, t_appl_server_info::last_access_time, t_broker_info::name, NULL, t_appl_server_info::pid, SLEEP_MILISEC, t_appl_server_info::transaction_start_time, and ut_kill_as_process().
Referenced by broker_drop_one_cas_by_time_to_kill(), and cas_monitor_worker().
|
static |
Definition at line 3269 of file broker.c.
References t_shm_broker::br_info, broker_delete_proxy_conn_by_proxy_id(), t_proxy_info::cur_client, t_broker_info::name, t_proxy_info::pid, t_proxy_info::proxy_id, SLEEP_MILISEC, and ut_kill_proxy_process().
Referenced by proxy_monitor_worker(), and restart_proxy_server().
|
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().
|
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().
|
static |
Definition at line 315 of file broker.c.
Referenced by admin_acl_reload_cmd(), admin_acl_status_cmd(), admin_add_cmd(), admin_conf_change(), admin_del_cas_log(), admin_drop_cmd(), admin_getid_cmd(), admin_reset_cmd(), admin_restart_cmd(), brief_monitor(), broker_add_new_cas(), broker_drop_one_cas_by_time_to_kill(), broker_init_shm(), cas_monitor_thr_f(), cas_monitor_worker(), check_cas_log(), connect_srv(), dispatch_thr_f(), find_add_as_index(), find_drop_as_index(), find_idle_cas(), hang_check_thr_f(), main(), proxy_check_worker(), proxy_monitor_thr_f(), psize_check_thr_f(), receiver_thr_f(), server_monitor_thr_f(), shard_broker_process(), uc_as_info(), and uc_get_as_num_with_opened_shm().
|
static |
Definition at line 312 of file broker.c.
Referenced by admin_conf_change(), admin_getid_cmd(), brief_monitor(), and hang_check_thr_f().
|
static |
Definition at line 316 of file broker.c.
Referenced by cas_monitor_worker(), cleanup(), connect_srv(), get_as_slow_log_filename(), get_as_sql_log_filename(), hang_check_thr_f(), main(), proxy_check_worker(), psize_check_thr_f(), receiver_thr_f(), restart_appl_server(), run_appl_server(), server_monitor_thr_f(), and stop_appl_server().
|
static |
Definition at line 325 of file broker.c.
Referenced by broker_add_new_cas(), broker_drop_one_cas_by_time_to_kill(), find_add_as_index(), find_drop_as_index(), find_idle_cas(), and main().
|
static |
|
static |
Definition at line 322 of file broker.c.
Referenced by dispatch_thr_f(), main(), and receiver_thr_f().
|
static |
Definition at line 323 of file broker.c.
Referenced by dispatch_thr_f(), main(), receiver_thr_f(), and shard_dispatch_thr_f().
|
static |
Definition at line 331 of file broker.c.
Referenced by broker_drop_one_cas_by_time_to_kill(), and find_add_as_index().
|
static |
Definition at line 345 of file broker.c.
Referenced by broker_drop_one_cas_by_time_to_kill(), and dispatch_thr_f().
|
static |
Definition at line 337 of file broker.c.
Referenced by receiver_thr_f(), run_appl_server(), and run_proxy_server().
|
static |
Definition at line 335 of file broker.c.
Referenced by broker_drop_one_cas_by_time_to_kill(), and cas_monitor_thr_f().
|
static |
Definition at line 333 of file broker.c.
Referenced by cas_monitor_thr_f(), cleanup(), dispatch_thr_f(), hang_check_thr_f(), log_top_query(), main(), proxy_check_worker(), proxy_listener_thr_f(), proxy_monitor_thr_f(), psize_check_thr_f(), receiver_thr_f(), server_monitor_thr_f(), shard_broker_process(), and shard_dispatch_thr_f().
|
static |
Definition at line 306 of file broker.c.
Referenced by broker_get_proxy_conn_maxfd(), cleanup(), init_proxy_env(), proxy_listener_thr_f(), and shard_cas_main().
|
static |
Definition at line 324 of file broker.c.
Referenced by main(), and run_appl_server().
|
static |
Definition at line 329 of file broker.c.
Referenced by run_appl_server().
|
static |
Definition at line 327 of file broker.c.
Referenced by run_proxy_server().
|
static |
Definition at line 326 of file broker.c.
Referenced by main(), and run_proxy_server().
|
static |
Definition at line 307 of file broker.c.
Referenced by init_proxy_env(), and proxy_io_accept().
|
static |
Definition at line 311 of file broker.c.
Referenced by admin_acl_reload_cmd(), admin_acl_status_cmd(), admin_del_cas_log(), admin_restart_cmd(), appl_monitor(), br_activate(), br_inactivate(), brief_monitor(), cas_access_log(), cas_error_log_write(), cas_log_debug(), cas_log_end(), cas_log_open(), cas_log_write(), cas_log_write2(), cas_log_write2_nonl(), cas_log_write_and_end(), cas_log_write_nonl(), cas_log_write_query_string_internal(), cas_log_write_value_string(), cas_slow_log_end(), cas_slow_log_open(), cas_slow_log_write(), cas_slow_log_write2(), cas_slow_log_write_and_end(), cas_slow_log_write_query_string(), cas_slow_log_write_value_string(), cfg_get_dbinfo(), cfg_read_dbinfo(), fn_end_tran(), fn_execute_array(), fn_execute_internal(), fn_get_db_parameter(), get_client_result_cache_lifetime(), hm_new_srv_handle(), need_reconnect_on_rctime(), net_connect_proxy(), prepare_column_list_info_set(), report_abnormal_host_status(), set_query_timeout(), uc_as_info(), uc_br_info(), unusable_databases_monitor(), ux_auto_commit(), ux_database_connect(), and ux_make_out_rs().
|
static |
Definition at line 310 of file broker.c.
Referenced by admin_acl_reload_cmd(), admin_acl_status_cmd(), admin_add_cmd(), admin_conf_change(), admin_del_cas_log(), admin_drop_cmd(), admin_getid_cmd(), admin_info_cmd(), admin_off_cmd(), admin_on_cmd(), admin_reset_cmd(), admin_restart_cmd(), admin_start_cmd(), admin_stop_cmd(), broker_create_dir(), broker_shm_initialize_shm_broker(), init_tester_info(), main(), uc_as_info(), uc_br_info(), and uc_get_active_session_with_opened_shm().
|
static |
Definition at line 313 of file broker.c.
Referenced by brief_monitor(), broker_register_proxy_conn(), client_monitor(), metadata_monitor(), shard_metadata_dump(), and shard_shm_initialize_shm_proxy().
|
static |
Definition at line 301 of file broker.c.
Referenced by init_env().
|
static |
Definition at line 302 of file broker.c.
Referenced by connect_srv(), init_env(), and net_init_env().
|
static |
Definition at line 300 of file broker.c.
Referenced by check_cas_log(), cleanup(), fn_make_out_rs(), init_env(), jsp_execute_stored_procedure(), net_init_env(), process_request(), proxy_io_process(), read_buffer(), receiver_thr_f(), and write_buffer().