CUBRID Engine
latest
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>
#include "dbi.h"
#include "cas_common.h"
#include "broker_env_def.h"
#include "broker_filename.h"
#include "broker_shm.h"
#include "broker_admin_pub.h"
#include "shard_metadata.h"
#include "shard_shm.h"
Go to the source code of this file.
Macros | |
#define | BLANK_3 " " |
#define | BLANK_6 " " |
#define | BLANK_9 " " |
#define | LINE_70 |
#define BLANK_3 " " |
Definition at line 44 of file shard_shm.c.
Referenced by shard_shm_dump_proxy(), and shard_shm_dump_proxy_info().
#define BLANK_6 " " |
Definition at line 45 of file shard_shm.c.
Referenced by shard_shm_dump_proxy_info(), and shard_shm_dump_shard().
#define BLANK_9 " " |
Definition at line 46 of file shard_shm.c.
Referenced by shard_shm_dump_shard(), and shard_shm_dump_shard_appl_server().
#define LINE_70 |
Definition at line 48 of file shard_shm.c.
Referenced by shard_shm_dump_proxy(), shard_shm_dump_proxy_info(), and shard_shm_dump_shard().
void shard_shm_dump_appl_server | ( | FILE * | fp, |
int | shmid | ||
) |
Definition at line 651 of file shard_shm.c.
References NULL, SHARD_ERR, shard_shm_dump_appl_server_internal(), SHM_MODE_MONITOR, SHM_PROXY, uw_shm_detach(), and uw_shm_open().
Referenced by broker_config_dump().
void shard_shm_dump_appl_server_internal | ( | FILE * | fp, |
T_SHM_PROXY * | shm_proxy_p | ||
) |
Definition at line 641 of file shard_shm.c.
References assert, and shard_shm_dump_proxy().
Referenced by shard_shm_dump_appl_server().
|
static |
Definition at line 609 of file shard_shm.c.
References assert, BLANK_3, LINE_70, t_shm_proxy::max_client, t_shm_proxy::max_context, t_shm_proxy::num_proxy, proxy_info_p, t_shm_proxy::shard_key_function_name, t_shm_proxy::shard_key_library_name, t_shm_proxy::shard_key_modular, shard_shm_dump_proxy_info(), and shard_shm_find_proxy_info().
Referenced by shard_shm_dump_appl_server_internal().
|
static |
Definition at line 572 of file shard_shm.c.
References t_proxy_info::access_log_file, t_proxy_info::appl_server_shm_id, assert, BLANK_3, BLANK_6, LINE_70, t_proxy_info::max_shard, t_proxy_info::num_shard_conn, t_proxy_info::pid, t_proxy_info::port_name, t_proxy_info::proxy_id, shard_shm_dump_shard(), shard_shm_find_shard_info(), SHM_APPL_SERVER, shm_as_p, SHM_MODE_MONITOR, t_proxy_info::status, uw_shm_detach(), and uw_shm_open().
Referenced by shard_shm_dump_proxy().
|
static |
Definition at line 547 of file shard_shm.c.
References t_shm_appl_server::as_info, t_shard_info::as_info_index_base, assert, BLANK_6, BLANK_9, LINE_70, t_shard_info::max_appl_server, t_shard_info::min_appl_server, t_shard_info::num_appl_server, t_shard_info::shard_id, shard_shm_dump_shard_appl_server(), and t_shard_info::waiter_count.
Referenced by shard_shm_dump_proxy_info().
|
static |
Definition at line 493 of file shard_shm.c.
References t_appl_server_info::auto_commit_mode, BLANK_9, t_appl_server_info::cas_client_type, t_appl_server_info::con_status, t_appl_server_info::cur_keep_con, t_appl_server_info::cur_sql_log_mode, t_appl_server_info::cur_statement_pooling, t_appl_server_info::database_host, t_appl_server_info::database_name, t_appl_server_info::database_user, t_appl_server_info::last_access_time, t_appl_server_info::last_connect_time, NULL, t_appl_server_info::num_error_queries, t_appl_server_info::num_long_queries, t_appl_server_info::num_long_transactions, t_appl_server_info::num_queries_processed, t_appl_server_info::num_request, t_appl_server_info::num_requests_received, t_appl_server_info::num_transactions_processed, t_appl_server_info::pid, t_appl_server_info::reset_flag, t_appl_server_info::service_flag, t_appl_server_info::service_ready_flag, and t_appl_server_info::uts_status.
Referenced by shard_shm_dump_shard().
T_PROXY_INFO* shard_shm_find_proxy_info | ( | T_SHM_PROXY * | proxy_p, |
int | proxy_id | ||
) |
Definition at line 419 of file shard_shm.c.
References assert, NULL, proxy_id, t_shm_proxy::proxy_info, and proxy_info_p.
Referenced by admin_reset_cmd(), br_inactivate(), broker_find_available_proxy(), cas_monitor_worker(), check_shard_conn(), client_monitor(), hang_check_thr_f(), metadata_monitor(), proxy_activate(), proxy_activate_internal(), proxy_check_worker(), proxy_monitor_thr_f(), proxy_shm_initialize(), psize_check_thr_f(), shard_broker_process(), shard_shm_check_max_file_open_limit(), shard_shm_dump_proxy(), shard_shm_initialize_shm_proxy(), shard_shm_set_param_as_in_proxy(), shard_shm_set_param_proxy(), and shard_shm_set_param_proxy_internal().
T_SHARD_INFO* shard_shm_find_shard_info | ( | T_PROXY_INFO * | proxy_info_p, |
int | shard_id | ||
) |
Definition at line 433 of file shard_shm.c.
References assert, NULL, and t_proxy_info::shard_info.
Referenced by admin_reset_cmd(), cas_monitor_worker(), check_shard_conn(), metadata_monitor(), proxy_activate_internal(), proxy_available_cas_wait_timer(), proxy_client_add_waiter_by_shard(), proxy_client_check_waiter_and_wakeup(), proxy_convert_error_code(), proxy_shard_io_initialize(), shard_broker_process(), shard_shm_check_max_file_open_limit(), shard_shm_dump_proxy_info(), shard_shm_get_as_info(), shard_shm_set_param_as_in_shard(), and shard_stmt_initialize().
T_APPL_SERVER_INFO* shard_shm_get_as_info | ( | T_PROXY_INFO * | proxy_info_p, |
T_SHM_APPL_SERVER * | shm_as_p, | ||
int | shard_id, | ||
int | as_id | ||
) |
Definition at line 671 of file shard_shm.c.
References t_shm_appl_server::as_info, t_shard_info::as_info_index_base, assert, NULL, and shard_shm_find_shard_info().
Referenced by proxy_find_idle_cas_by_conn_info(), proxy_handler_is_cas_in_tran(), proxy_set_conn_info(), shard_shm_set_as_client_info(), and shard_shm_set_as_client_info_with_db_param().
T_CLIENT_INFO* shard_shm_get_client_info | ( | T_PROXY_INFO * | proxy_info_p, |
int | idx | ||
) |
Definition at line 448 of file shard_shm.c.
References assert, t_proxy_info::client_info, CLIENT_INFO_SIZE_LIMIT, and NULL.
Referenced by client_monitor(), fn_proxy_client_get_db_parameter(), fn_proxy_client_set_db_parameter(), proxy_cas_alloc_by_ctx(), proxy_context_free_client(), proxy_context_send_error(), proxy_handler_process_cas_response(), proxy_handler_process_client_request(), proxy_handler_process_client_wakeup_by_shard(), proxy_process_client_register(), proxy_send_response_to_client_with_new_event(), proxy_socket_io_new_client(), and proxy_socket_io_write_to_client().
T_SHM_SHARD_KEY_STAT* shard_shm_get_key_stat | ( | T_PROXY_INFO * | proxy_info_p, |
int | idx | ||
) |
Definition at line 478 of file shard_shm.c.
References assert, t_proxy_info::key_stat, and NULL.
Referenced by metadata_monitor(), and proxy_update_shard_stats().
|
static |
Definition at line 845 of file shard_shm.c.
References MAX_FD, and PROXY_RESERVED_FD.
Referenced by shard_shm_init_shard_stat(), shard_shm_initialize_shm_proxy(), and shard_shm_set_shm_proxy().
T_SHM_SHARD_CONN_STAT* shard_shm_get_shard_stat | ( | T_PROXY_INFO * | proxy_info_p, |
int | idx | ||
) |
Definition at line 463 of file shard_shm.c.
References assert, NULL, and t_proxy_info::shard_stat.
Referenced by metadata_monitor(), proxy_update_shard_stats(), and proxy_update_shard_stats_without_hint().
void shard_shm_init_client_info | ( | T_CLIENT_INFO * | client_info_p | ) |
Definition at line 756 of file shard_shm.c.
References assert, CAS_USE_DEFAULT_DB_PARAM, t_client_info::client_id, t_client_info::client_ip, t_client_info::connect_time, t_client_info::driver_info, t_client_info::func_code, t_client_info::isolation_level, t_client_info::lock_timeout, t_client_info::req_time, t_client_info::res_time, and SRV_CON_CLIENT_INFO_SIZE.
Referenced by proxy_context_free_client(), proxy_socket_io_write_to_client(), and shard_shm_initialize_shm_proxy().
void shard_shm_init_client_info_request | ( | T_CLIENT_INFO * | client_info_p | ) |
Definition at line 773 of file shard_shm.c.
References assert, t_client_info::func_code, t_client_info::req_time, and t_client_info::res_time.
Referenced by proxy_context_send_error(), and proxy_handler_process_client_request().
|
static |
Definition at line 801 of file shard_shm.c.
References assert, i, t_shard_key_range::max, t_shm_shard_key_range_stat::max, t_shard_key_range::min, t_shm_shard_key_range_stat::min, t_shard_key::num_key_range, t_shm_shard_key_stat::num_key_range, t_shm_shard_key_range_stat::num_range_queries_requested, t_shard_key::range, t_shard_key_range::shard_id, t_shm_shard_key_range_stat::shard_id, and t_shm_shard_key_stat::stat.
Referenced by shard_shm_initialize_shm_proxy().
|
static |
Definition at line 820 of file shard_shm.c.
References assert, t_shm_shard_conn_stat::num_hint_id_queries_requested, t_shm_shard_conn_stat::num_hint_key_queries_requested, t_shm_shard_conn_stat::num_no_hint_queries_requested, PROXY_RESERVED_FD, t_shard_conn::shard_id, t_shm_shard_conn_stat::shard_id, and shard_shm_get_max_context().
Referenced by shard_shm_initialize_shm_proxy().
T_SHM_PROXY* shard_shm_initialize_shm_proxy | ( | T_BROKER_INFO * | br_info_p | ) |
Definition at line 261 of file shard_shm.c.
References t_broker_info::appl_server, t_proxy_info::appl_server, t_broker_info::appl_server_max_num, t_broker_info::appl_server_min_num, t_broker_info::appl_server_num, t_broker_info::appl_server_shm_id, t_proxy_info::appl_server_shm_id, t_shard_info::as_info_index_base, t_proxy_info::client_info, t_proxy_info::cur_client, i, t_broker_info::ignore_shard_hint, t_proxy_info::ignore_shard_hint, t_proxy_info::key_stat, t_shard_info::max_appl_server, t_broker_info::max_client, t_proxy_info::max_client, t_shm_proxy::max_client, t_proxy_info::max_context, t_shm_proxy::max_context, t_proxy_info::max_prepared_stmt_count, t_proxy_info::max_shard, t_shard_info::min_appl_server, NULL, t_shard_info::num_appl_server, t_broker_info::num_proxy, t_shm_proxy::num_proxy, t_shm_shard_conn::num_shard_conn, t_proxy_info::num_shard_conn, t_shm_shard_key::num_shard_key, t_proxy_info::num_shard_key, t_proxy_info::pid, t_proxy_info::proxy_access_log_reset, t_proxy_info::proxy_id, proxy_info_p, t_proxy_info::proxy_log_reset, t_broker_info::proxy_max_prepared_stmt_count, t_broker_info::proxy_shm_id, PROXY_STATUS_START, t_broker_info::proxy_timeout, t_proxy_info::service_flag, SERVICE_ON, t_shm_shard_conn::shard_conn, t_shard_conn::shard_id, t_shard_info::shard_id, t_proxy_info::shard_info, t_shm_shard_key::shard_key, shard_metadata_get_conn(), shard_metadata_get_key(), shard_metadata_initialize(), shard_shm_find_proxy_info(), shard_shm_get_max_context(), shard_shm_init_client_info(), shard_shm_init_key_stat(), shard_shm_init_shard_stat(), shard_shm_set_shm_proxy(), t_proxy_info::shard_stat, shm_conn_p, shm_key_p, SHM_PROXY, shm_proxy_p, t_shm_proxy::shm_shard_conn, t_shm_proxy::shm_shard_key, t_proxy_info::status, uw_shm_create(), uw_shm_destroy(), and t_proxy_info::wait_timeout.
Referenced by admin_on_cmd(), and admin_start_cmd().
bool shard_shm_set_as_client_info | ( | T_PROXY_INFO * | proxy_info_p, |
T_SHM_APPL_SERVER * | shm_as_p, | ||
int | shard_id, | ||
int | as_id, | ||
unsigned int | ip_addr, | ||
char * | driver_info, | ||
char * | driver_version | ||
) |
Definition at line 689 of file shard_shm.c.
References t_appl_server_info::cas_clt_ip, CAS_MAKE_PROTO_VER, t_appl_server_info::clt_version, t_appl_server_info::driver_info, t_appl_server_info::driver_version, NULL, shard_shm_get_as_info(), SRV_CON_CLIENT_INFO_SIZE, and SRV_CON_VER_STR_MAX_SIZE.
Referenced by proxy_handler_process_client_wakeup_by_shard().
bool shard_shm_set_as_client_info_with_db_param | ( | T_PROXY_INFO * | proxy_info_p, |
T_SHM_APPL_SERVER * | shm_as_p, | ||
int | shard_id, | ||
int | as_id, | ||
T_CLIENT_INFO * | client_info_p | ||
) |
Definition at line 724 of file shard_shm.c.
References assert, t_appl_server_info::cas_clt_ip, CAS_MAKE_PROTO_VER, t_client_info::client_ip, t_appl_server_info::clt_version, t_appl_server_info::driver_info, t_client_info::driver_info, t_appl_server_info::driver_version, t_client_info::driver_version, t_appl_server_info::isolation_level, t_client_info::isolation_level, t_appl_server_info::lock_timeout, t_client_info::lock_timeout, NULL, shard_shm_get_as_info(), SRV_CON_CLIENT_INFO_SIZE, and SRV_CON_VER_STR_MAX_SIZE.
Referenced by proxy_cas_alloc_by_ctx().
void shard_shm_set_client_info_request | ( | T_CLIENT_INFO * | client_info_p, |
int | func_code | ||
) |
Definition at line 783 of file shard_shm.c.
References assert, t_client_info::func_code, NULL, t_client_info::req_time, and t_client_info::res_time.
Referenced by proxy_handler_process_client_request().
void shard_shm_set_client_info_response | ( | T_CLIENT_INFO * | client_info_p | ) |
Definition at line 793 of file shard_shm.c.
References assert, NULL, and t_client_info::res_time.
Referenced by proxy_handler_process_cas_response().
|
static |
Definition at line 234 of file shard_shm.c.
References t_broker_info::appl_server_max_num, assert, t_broker_info::max_client, t_shm_proxy::max_client, t_shm_proxy::max_context, t_broker_info::num_proxy, t_shm_proxy::num_proxy, t_broker_info::shard_key_function_name, t_shm_proxy::shard_key_function_name, t_broker_info::shard_key_library_name, t_shm_proxy::shard_key_library_name, t_broker_info::shard_key_modular, t_shm_proxy::shard_key_modular, shard_shm_get_max_context(), and strncpy_bufsize.
Referenced by shard_shm_initialize_shm_proxy().