CUBRID Engine
latest
|
#include <fcntl.h>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "broker_recv_fd.h"
#include "cas_network.h"
#include "shard_proxy_common.h"
#include "shard_metadata.h"
Go to the source code of this file.
Macros | |
#define | CLOSESOCKET(fd) close(fd) |
#define | READSOCKET(fd, buf, len) read(fd, buf, (size_t)len) |
#define | WRITESOCKET(fd, buf, len) write(fd, buf, (size_t)len) |
#define | DEFAULT_POLL_INTERVAL 1 |
#define | PROTOCOL_SIZE sizeof(int) |
#define | PROXY_CONNECTION_REPLY_SIZE(con_reply_size) (PROTOCOL_SIZE + CAS_INFO_SIZE + (con_reply_size)) |
#define | SHARD_TEMPORARY_UNAVAILABLE (-1) |
#define | PROXY_IO_FROM_CAS (true) |
#define | PROXY_IO_FROM_CLIENT (false) |
#define | PROXY_CONV_ERR_TO_NEW (true) |
#define | PROXY_CONV_ERR_TO_OLD (false) |
Functions | |
void | set_data_length (char *buffer, int length) |
int | get_data_length (char *buffer) |
int | get_msg_length (char *buffer) |
char * | proxy_dup_msg (char *msg) |
void | proxy_set_con_status_in_tran (char *msg) |
void | proxy_set_con_status_out_tran (char *msg) |
void | proxy_set_force_out_tran (char *msg) |
void | proxy_unset_force_out_tran (char *msg) |
int | proxy_make_net_buf (T_NET_BUF *net_buf, int size, T_BROKER_VERSION client_version) |
int | proxy_io_make_error_msg (char *driver_info, char **buffer, int error_ind, int error_code, const char *error_msg, char is_in_tran) |
int | proxy_io_make_no_error (char *driver_info, char **buffer) |
int | proxy_io_make_con_close_ok (char *driver_info, char **buffer) |
int | proxy_io_make_end_tran_ok (char *driver_info, char **buffer) |
int | proxy_io_make_check_cas_ok (char *driver_info, char **buffer) |
int | proxy_io_make_set_db_parameter_ok (char *driver_info, char **buffer) |
int | proxy_io_make_ex_get_isolation_level (char *driver_info, char **buffer, void *argv) |
int | proxy_io_make_ex_get_lock_timeout (char *driver_info, char **buffer, void *argv) |
int | proxy_io_make_end_tran_request (char *driver_info, char **buffer, bool commit) |
int | proxy_io_make_end_tran_abort (char *driver_info, char **buffer) |
int | proxy_io_make_close_req_handle_ok (char *driver_info, char **buffer, bool is_in_tran) |
int | proxy_io_make_close_req_handle_out_tran_ok (char *driver_info, char **buffer) |
int | proxy_io_make_cursor_close_out_tran_ok (char *driver_info, char **buffer) |
int | proxy_io_make_get_db_version (char *driver_info, char **buffer) |
int | proxy_io_make_client_conn_ok (char *driver_info, char **buffer) |
int | proxy_io_make_client_proxy_alive (char *driver_info, char **buffer) |
int | proxy_io_make_client_dbinfo_ok (char *driver_info, char **buffer) |
int | proxy_io_make_client_acl_fail (char *driver_info, char **buffer) |
int | proxy_io_make_shard_info (char *driver_info, char **buffer) |
int | proxy_io_make_check_cas (char *driver_info, char **buffer) |
int | proxy_socket_set_write_event (T_SOCKET_IO *sock_io_p, T_PROXY_EVENT *event_p) |
void | proxy_io_buffer_clear (T_IO_BUFFER *io_buffer) |
void | proxy_socket_io_print (bool print_all) |
void | proxy_client_io_print (bool print_all) |
char * | proxy_str_client_io (T_CLIENT_IO *cli_io_p) |
void | proxy_shard_io_print (bool print_all) |
char * | proxy_str_cas_io (T_CAS_IO *cas_io_p) |
void | proxy_client_io_free (T_CLIENT_IO *cli_io_p) |
void | proxy_client_io_free_by_ctx (int client_id, int ctx_cid, int ctx_uid) |
T_CLIENT_IO * | proxy_client_io_find_by_ctx (int client_id, int ctx_cid, unsigned int ctx_uid) |
T_CLIENT_IO * | proxy_client_io_find_by_fd (int client_id, SOCKET fd) |
int | proxy_client_io_write (T_CLIENT_IO *cli_io_p, T_PROXY_EVENT *event_p) |
void | proxy_cas_io_free_by_ctx (int shard_id, int cas_id, int ctx_cid, unsigned int ctx_uid) |
T_CAS_IO * | proxy_cas_find_io_by_ctx (int shard_id, int cas_id, int ctx_cid, unsigned int ctx_uid) |
T_CAS_IO * | proxy_cas_alloc_by_ctx (int client_id, int shard_id, int cas_id, int ctx_cid, unsigned int ctx_uid, int timeout, int func_code) |
void | proxy_cas_release_by_ctx (int shard_id, int cas_id, int ctx_cid, unsigned int ctx_uid) |
int | proxy_cas_io_write (T_CAS_IO *cas_io_p, T_PROXY_EVENT *event_p) |
int | proxy_io_close_all_fd (void) |
int | proxy_io_process (void) |
int | proxy_io_initialize (void) |
void | proxy_io_destroy (void) |
int | proxy_socket_io_delete (SOCKET fd) |
int | proxy_io_set_established_by_ctx (T_PROXY_CONTEXT *ctx_p) |
char * | proxy_get_driver_info_by_ctx (T_PROXY_CONTEXT *ctx_p) |
char * | proxy_get_driver_info_by_fd (T_SOCKET_IO *sock_io_p) |
void | proxy_available_cas_wait_timer (void) |
int | proxy_convert_error_code (int error_ind, int error_code, char *driver_info, T_BROKER_VERSION client_version, bool to_new) |
Variables | |
fd_set | rset |
fd_set | wset |
fd_set | allset |
fd_set | wnewset |
fd_set | wallset |
int | maxfd |
T_CLIENT_IO_GLOBAL | proxy_Client_io |
T_SHARD_IO_GLOBAL | proxy_Shard_io |
#define CLOSESOCKET | ( | fd | ) | close(fd) |
Definition at line 49 of file shard_proxy_io.h.
Referenced by proxy_io_connect_to_broker(), proxy_io_register_to_broker(), and proxy_io_unixd_lsnr().
#define DEFAULT_POLL_INTERVAL 1 |
Definition at line 54 of file shard_proxy_io.h.
#define PROTOCOL_SIZE sizeof(int) |
Definition at line 64 of file shard_proxy_io.h.
Referenced by proxy_io_make_client_dbinfo_ok().
#define PROXY_CONNECTION_REPLY_SIZE | ( | con_reply_size | ) | (PROTOCOL_SIZE + CAS_INFO_SIZE + (con_reply_size)) |
Definition at line 65 of file shard_proxy_io.h.
Referenced by proxy_io_make_client_dbinfo_ok().
#define PROXY_CONV_ERR_TO_NEW (true) |
Definition at line 71 of file shard_proxy_io.h.
Referenced by proxy_convert_error_code(), and proxy_is_invalid_statement().
#define PROXY_CONV_ERR_TO_OLD (false) |
Definition at line 72 of file shard_proxy_io.h.
Referenced by proxy_io_make_error_msg().
#define PROXY_IO_FROM_CAS (true) |
Definition at line 69 of file shard_proxy_io.h.
Referenced by proxy_io_process().
#define PROXY_IO_FROM_CLIENT (false) |
Definition at line 70 of file shard_proxy_io.h.
Referenced by proxy_socket_io_new_client().
#define READSOCKET | ( | fd, | |
buf, | |||
len | |||
) | read(fd, buf, (size_t)len) |
Definition at line 50 of file shard_proxy_io.h.
Referenced by proxy_socket_io_read_internal().
#define SHARD_TEMPORARY_UNAVAILABLE (-1) |
Definition at line 67 of file shard_proxy_io.h.
Referenced by fn_proxy_client_close_req_handle(), fn_proxy_client_cursor(), fn_proxy_client_cursor_close(), fn_proxy_client_fetch(), fn_proxy_client_prepare(), fn_proxy_client_prepare_and_execute(), proxy_cas_alloc_by_ctx(), proxy_client_execute_internal(), proxy_send_request_to_cas(), proxy_send_request_to_cas_with_new_event(), and proxy_wakeup_context_by_shard().
#define WRITESOCKET | ( | fd, | |
buf, | |||
len | |||
) | write(fd, buf, (size_t)len) |
Definition at line 51 of file shard_proxy_io.h.
Referenced by proxy_io_register_to_broker(), proxy_socket_io_new_client(), and proxy_socket_io_write_internal().
int get_data_length | ( | char * | buffer | ) |
Definition at line 238 of file shard_proxy_io.c.
References assert, and ntohl().
Referenced by get_msg_length(), and proxy_handler_process_client_request().
int get_msg_length | ( | char * | buffer | ) |
Definition at line 250 of file shard_proxy_io.c.
References get_data_length(), and MSG_HEADER_SIZE.
Referenced by fn_proxy_cas_prepare(), proxy_client_execute_internal(), proxy_dup_msg(), proxy_process_cas_register(), proxy_send_prepared_stmt_to_client(), proxy_socket_io_read_internal(), and shard_stmt_save_prepare_request().
void proxy_available_cas_wait_timer | ( | void | ) |
Definition at line 4545 of file shard_proxy_io.c.
References t_shard_io_global::ent, i, t_shard_io_global::max_shard, NULL, PROXY_DEBUG_LOG, proxy_waiter_timeout(), t_shard_io::shard_id, shard_queue_peek_value(), shard_shm_find_shard_info(), t_shard_info::waiter_count, and t_shard_io::waitq.
Referenced by proxy_timer_process().
T_CAS_IO* proxy_cas_alloc_by_ctx | ( | int | client_id, |
int | shard_id, | ||
int | cas_id, | ||
int | ctx_cid, | ||
unsigned int | ctx_uid, | ||
int | timeout, | ||
int | func_code | ||
) |
Definition at line 3612 of file shard_proxy_io.c.
References assert, CAS_FC_CHECK_CAS, t_cas_io::cas_id, t_cas_io::ctx_cid, t_cas_io::ctx_uid, t_shard_io::cur_num_cas, t_shard_io_global::ent, error(), t_cas_io::is_in_tran, t_shard_io::max_num_cas, t_shard_io_global::max_shard, NULL, proxy_cas_alloc_anything(), proxy_cas_alloc_by_shard_and_cas_id(), proxy_client_add_waiter_by_shard(), proxy_find_idle_cas_by_asc(), proxy_find_idle_cas_by_conn_info(), proxy_find_idle_cas_by_desc(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_set_conn_info(), t_cas_io::shard_id, shard_shm_get_client_info(), shard_shm_set_as_client_info_with_db_param(), and SHARD_TEMPORARY_UNAVAILABLE.
Referenced by fn_proxy_client_close_req_handle(), fn_proxy_client_cursor(), fn_proxy_client_cursor_close(), fn_proxy_client_fetch(), fn_proxy_client_prepare(), fn_proxy_client_prepare_and_execute(), proxy_client_execute_internal(), proxy_send_request_to_cas(), proxy_send_request_to_cas_with_new_event(), and proxy_wakeup_context_by_shard().
T_CAS_IO* proxy_cas_find_io_by_ctx | ( | int | shard_id, |
int | cas_id, | ||
int | ctx_cid, | ||
unsigned int | ctx_uid | ||
) |
Definition at line 3581 of file shard_proxy_io.c.
References t_cas_io::ctx_cid, t_cas_io::ctx_uid, t_shard_io::ent, t_shard_io_global::ent, t_cas_io::is_in_tran, t_shard_io::max_num_cas, t_shard_io_global::max_shard, NULL, PROXY_DEBUG_LOG, PROXY_LOG, PROXY_LOG_MODE_ERROR, and proxy_str_cas_io().
void proxy_cas_io_free_by_ctx | ( | int | shard_id, |
int | cas_id, | ||
int | ctx_cid, | ||
unsigned int | ctx_uid | ||
) |
int proxy_cas_io_write | ( | T_CAS_IO * | cas_io_p, |
T_PROXY_EVENT * | event_p | ||
) |
Definition at line 3204 of file shard_proxy_io.c.
References assert, error(), t_cas_io::fd, NULL, PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_socket_io_find(), proxy_socket_set_write_event(), proxy_str_cas_io(), and proxy_str_event().
Referenced by fn_proxy_client_close_req_handle(), fn_proxy_client_cursor(), fn_proxy_client_cursor_close(), fn_proxy_client_fetch(), fn_proxy_client_prepare(), fn_proxy_client_prepare_and_execute(), proxy_client_execute_internal(), proxy_send_request_to_cas(), and proxy_send_request_to_cas_with_new_event().
void proxy_cas_release_by_ctx | ( | int | shard_id, |
int | cas_id, | ||
int | ctx_cid, | ||
unsigned int | ctx_uid | ||
) |
Definition at line 3719 of file shard_proxy_io.c.
References assert, t_cas_io::ctx_cid, t_cas_io::ctx_uid, t_shard_io::ent, t_shard_io_global::ent, ENTER_FUNC, EXIT_FUNC, t_cas_io::is_in_tran, t_shard_io::max_num_cas, t_shard_io_global::max_shard, t_shard_io::num_cas_in_tran, proxy_client_check_waiter_and_wakeup(), PROXY_DEBUG_LOG, PROXY_INVALID_CONTEXT, PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_str_cas_io(), and t_shard_io::shard_id.
Referenced by proxy_handler_process_cas_response().
T_CLIENT_IO* proxy_client_io_find_by_ctx | ( | int | client_id, |
int | ctx_cid, | ||
unsigned int | ctx_uid | ||
) |
Definition at line 3100 of file shard_proxy_io.c.
References t_client_io::ctx_cid, t_client_io::ctx_uid, t_client_io_global::ent, t_client_io::is_busy, t_client_io_global::max_context, NULL, PROXY_LOG, and PROXY_LOG_MODE_ERROR.
Referenced by proxy_client_io_free_by_ctx(), proxy_get_driver_info_by_ctx(), proxy_io_set_established_by_ctx(), and proxy_send_response_to_client().
T_CLIENT_IO* proxy_client_io_find_by_fd | ( | int | client_id, |
SOCKET | fd | ||
) |
Definition at line 3124 of file shard_proxy_io.c.
References assert, t_client_io_global::ent, t_client_io::fd, t_client_io::is_busy, t_client_io_global::max_context, NULL, PROXY_LOG, and PROXY_LOG_MODE_ERROR.
Referenced by proxy_context_find_by_socket_client_io(), and proxy_get_driver_info_by_fd().
void proxy_client_io_free | ( | T_CLIENT_IO * | cli_io_p | ) |
Definition at line 3049 of file shard_proxy_io.c.
References assert, t_client_io::ctx_cid, t_client_io::ctx_uid, t_client_io_global::cur_client, t_proxy_info::cur_client, t_client_io::driver_info, error(), t_client_io::fd, t_client_io_global::freeq, INVALID_SOCKET, t_client_io::is_busy, PROXY_INVALID_CONTEXT, proxy_socket_io_delete(), shard_cqueue_enqueue(), and SRV_CON_CLIENT_INFO_SIZE.
Referenced by proxy_client_io_free_by_ctx(), proxy_client_io_new(), and proxy_context_find_by_socket_client_io().
void proxy_client_io_free_by_ctx | ( | int | client_id, |
int | ctx_cid, | ||
int | ctx_uid | ||
) |
Definition at line 3083 of file shard_proxy_io.c.
References NULL, proxy_client_io_find_by_ctx(), and proxy_client_io_free().
Referenced by proxy_context_free_client().
void proxy_client_io_print | ( | bool | print_all | ) |
Referenced by proxy_client_io_destroy(), and proxy_client_io_new().
int proxy_client_io_write | ( | T_CLIENT_IO * | cli_io_p, |
T_PROXY_EVENT * | event_p | ||
) |
Definition at line 3144 of file shard_proxy_io.c.
References assert, error(), t_client_io::fd, NULL, PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_socket_io_find(), proxy_socket_set_write_event(), proxy_str_client_io(), and proxy_str_event().
Referenced by proxy_send_response_to_client().
int proxy_convert_error_code | ( | int | error_ind, |
int | error_code, | ||
char * | driver_info, | ||
T_BROKER_VERSION | client_version, | ||
bool | to_new | ||
) |
Definition at line 4885 of file shard_proxy_io.c.
References assert, CAS_CONV_ERROR_TO_NEW, CAS_CONV_ERROR_TO_OLD, cas_di_understand_renewed_error_code(), CAS_ER_NOT_AUTHORIZED_CLIENT, CAS_ERROR_INDICATOR, CAS_MAKE_VER, CLOSE_SOCKET, DOES_CLIENT_MATCH_THE_PROTOCOL, error(), INVALID_SOCKET, t_shard_info::max_appl_server, t_proxy_info::max_context, t_proxy_info::max_shard, NO_ERROR, NULL, PROTOCOL_V2, PROXY_CONV_ERR_TO_NEW, PROXY_LOG, PROXY_LOG_MODE_ERROR, and shard_shm_find_shard_info().
Referenced by proxy_io_make_error_msg(), and proxy_is_invalid_statement().
char* proxy_dup_msg | ( | char * | msg | ) |
Definition at line 440 of file shard_proxy_io.c.
References get_msg_length(), and p.
Referenced by fn_proxy_cas_prepare(), proxy_client_execute_internal(), proxy_send_prepared_stmt_to_client(), and shard_stmt_save_prepare_request().
char* proxy_get_driver_info_by_ctx | ( | T_PROXY_CONTEXT * | ctx_p | ) |
Definition at line 4485 of file shard_proxy_io.c.
References assert, BROKER_RENEWED_ERROR_CODE, BROKER_SUPPORT_HOLDABLE_RESULT, CAS_CLIENT_JDBC, CAS_PROTO_INDICATOR, t_proxy_context::cid, t_proxy_context::client_id, CURRENT_PROTOCOL, NULL, proxy_client_io_find_by_ctx(), SRV_CON_CLIENT_INFO_SIZE, and t_proxy_context::uid.
Referenced by fn_proxy_cas_check_cas(), fn_proxy_cas_prepare(), fn_proxy_cas_prepare_and_execute(), fn_proxy_cas_schema_info(), fn_proxy_client_check_cas(), fn_proxy_client_execute(), fn_proxy_client_execute_array(), fn_proxy_client_get_db_parameter(), fn_proxy_client_prepare(), fn_proxy_client_prepare_and_execute(), fn_proxy_client_schema_info(), fn_proxy_client_set_db_parameter(), proxy_cas_execute_internal(), proxy_context_send_error(), proxy_handler_process_client_request(), proxy_send_request_to_cas_with_new_event(), and proxy_send_response_to_client_with_new_event().
char* proxy_get_driver_info_by_fd | ( | T_SOCKET_IO * | sock_io_p | ) |
Definition at line 4515 of file shard_proxy_io.c.
References assert, BROKER_RENEWED_ERROR_CODE, BROKER_SUPPORT_HOLDABLE_RESULT, CAS_CLIENT_JDBC, CAS_PROTO_INDICATOR, t_socket_io::client_id, CURRENT_PROTOCOL, t_socket_io::fd, t_socket_io::id, NULL, proxy_client_io_find_by_fd(), and SRV_CON_CLIENT_INFO_SIZE.
Referenced by proxy_process_client_register(), and proxy_socket_io_read_from_client_first().
void proxy_io_buffer_clear | ( | T_IO_BUFFER * | io_buffer | ) |
Definition at line 1123 of file shard_proxy_io.c.
References assert, t_io_buffer::data, FREE_MEM, t_io_buffer::length, and t_io_buffer::offset.
Referenced by proxy_event_free().
int proxy_io_close_all_fd | ( | void | ) |
Definition at line 4254 of file shard_proxy_io.c.
References broker_conn_fd, cas_lsnr_fd, CLOSE_SOCKET, t_socket_io_global::ent, t_socket_io::fd, i, INVALID_SOCKET, and t_socket_io_global::max_socket.
Referenced by proxy_io_destroy().
void proxy_io_destroy | ( | void | ) |
Definition at line 4239 of file shard_proxy_io.c.
References FREE_MEM, proxy_client_io_destroy(), proxy_io_close_all_fd(), proxy_shard_io_destroy(), and proxy_socket_io_destroy().
Referenced by proxy_term().
int proxy_io_initialize | ( | void | ) |
Definition at line 4149 of file shard_proxy_io.c.
References allset, assert, broker_port, t_shm_appl_server::broker_port, error(), INVALID_SOCKET, NULL, proxy_client_io_initialize(), proxy_io_cas_lsnr(), proxy_io_register_to_broker(), PROXY_LOG, PROXY_LOG_MODE_ERROR, PROXY_RESERVED_FD, proxy_shard_io_initialize(), proxy_socket_io_initialize(), and wnewset.
Referenced by main().
int proxy_io_make_check_cas | ( | char * | driver_info, |
char ** | buffer | ||
) |
Definition at line 1089 of file shard_proxy_io.c.
References assert, CAS_FC_CHECK_CAS, CAS_MAKE_PROTO_VER, t_net_buf::data, t_net_buf::data_size, error(), MSG_HEADER_SIZE, net_buf_cp_byte(), NULL, proxy_init_net_buf(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_make_net_buf(), proxy_set_force_out_tran(), and set_data_length().
Referenced by proxy_process_client_register().
int proxy_io_make_check_cas_ok | ( | char * | driver_info, |
char ** | buffer | ||
) |
Definition at line 682 of file shard_proxy_io.c.
References proxy_io_make_no_error().
Referenced by fn_proxy_client_check_cas().
int proxy_io_make_client_acl_fail | ( | char * | driver_info, |
char ** | buffer | ||
) |
Definition at line 1025 of file shard_proxy_io.c.
References CAS_ER_NOT_AUTHORIZED_CLIENT, DBMS_ERROR_INDICATOR, and proxy_io_make_error_msg().
int proxy_io_make_client_conn_ok | ( | char * | driver_info, |
char ** | buffer | ||
) |
Definition at line 878 of file shard_proxy_io.c.
References NULL.
Referenced by proxy_socket_io_new_client().
int proxy_io_make_client_dbinfo_ok | ( | char * | driver_info, |
char ** | buffer | ||
) |
Definition at line 922 of file shard_proxy_io.c.
References t_proxy_info::appl_server, APPL_SERVER_CAS_MYSQL, APPL_SERVER_CAS_MYSQL51, APPL_SERVER_CAS_ORACLE, assert, broker_info, BROKER_INFO_SIZE, cas_bi_make_broker_info(), CAS_CONNECTION_REPLY_SIZE, CAS_CONNECTION_REPLY_SIZE_PRIOR_PROTOCOL_V3, CAS_CONNECTION_REPLY_SIZE_V3, CAS_DBMS_CUBRID, CAS_INFO_SIZE, cas_info_size, CAS_MAKE_PROTO_VER, CAS_PID_SIZE, CAS_PROXY_DBMS_CUBRID, CAS_PROXY_DBMS_MYSQL, CAS_PROXY_DBMS_ORACLE, t_shm_appl_server::cci_pconnect, DOES_CLIENT_UNDERSTAND_THE_PROTOCOL, DRIVER_SESSION_SIZE, htonl(), NULL, p, PROTOCOL_SIZE, PROTOCOL_V3, PROTOCOL_V4, PROTOCOL_V5, PROXY_CONNECTION_REPLY_SIZE, proxy_id, SESSION_ID_SIZE, and t_shm_appl_server::statement_pooling.
Referenced by fn_proxy_cas_check_cas(), and proxy_process_client_register().
int proxy_io_make_client_proxy_alive | ( | char * | driver_info, |
char ** | buffer | ||
) |
Definition at line 893 of file shard_proxy_io.c.
References assert, CAS_MAKE_PROTO_VER, t_net_buf::data, t_net_buf::data_size, error(), MSG_HEADER_SIZE, NULL, proxy_init_net_buf(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_make_net_buf(), and set_data_length().
Referenced by proxy_process_client_register().
int proxy_io_make_close_req_handle_ok | ( | char * | driver_info, |
char ** | buffer, | ||
bool | is_in_tran | ||
) |
Definition at line 765 of file shard_proxy_io.c.
References assert, CAS_INFO_STATUS, CAS_INFO_STATUS_ACTIVE, CAS_INFO_STATUS_INACTIVE, CAS_MAKE_PROTO_VER, t_net_buf::data, t_net_buf::data_size, error(), MSG_HEADER_MSG_SIZE, MSG_HEADER_SIZE, net_buf_cp_int(), NULL, p, proxy_init_net_buf(), proxy_io_make_close_req_handle_ok(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_make_net_buf(), set_data_length(), and SHARD_NET_BUF_ALLOC_SIZE.
Referenced by proxy_io_make_close_req_handle_ok(), proxy_io_make_close_req_handle_out_tran_ok(), and proxy_io_make_cursor_close_out_tran_ok().
int proxy_io_make_close_req_handle_out_tran_ok | ( | char * | driver_info, |
char ** | buffer | ||
) |
Definition at line 820 of file shard_proxy_io.c.
References proxy_io_make_close_req_handle_ok().
Referenced by fn_proxy_client_close_req_handle().
int proxy_io_make_con_close_ok | ( | char * | driver_info, |
char ** | buffer | ||
) |
Definition at line 670 of file shard_proxy_io.c.
References proxy_io_make_no_error().
Referenced by fn_proxy_cas_end_tran(), and fn_proxy_client_con_close().
int proxy_io_make_cursor_close_out_tran_ok | ( | char * | driver_info, |
char ** | buffer | ||
) |
Definition at line 826 of file shard_proxy_io.c.
References proxy_io_make_close_req_handle_ok().
Referenced by fn_proxy_client_cursor_close().
int proxy_io_make_end_tran_abort | ( | char * | driver_info, |
char ** | buffer | ||
) |
Definition at line 759 of file shard_proxy_io.c.
References proxy_io_make_end_tran_request().
Referenced by fn_proxy_client_con_close(), and fn_proxy_client_conn_error().
int proxy_io_make_end_tran_ok | ( | char * | driver_info, |
char ** | buffer | ||
) |
Definition at line 676 of file shard_proxy_io.c.
References proxy_io_make_no_error().
Referenced by fn_proxy_client_end_tran().
int proxy_io_make_end_tran_request | ( | char * | driver_info, |
char ** | buffer, | ||
bool | commit | ||
) |
Definition at line 706 of file shard_proxy_io.c.
References assert, CAS_FC_END_TRAN, CAS_MAKE_PROTO_VER, t_net_buf::data, t_net_buf::data_size, error(), MSG_HEADER_SIZE, net_buf_cp_byte(), net_buf_cp_int(), NET_SIZE_BYTE, NULL, proxy_init_net_buf(), proxy_io_make_end_tran_request(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_make_net_buf(), set_data_length(), SHARD_NET_BUF_ALLOC_SIZE, and tran_commit().
Referenced by proxy_io_make_end_tran_abort(), and proxy_io_make_end_tran_request().
int proxy_io_make_error_msg | ( | char * | driver_info, |
char ** | buffer, | ||
int | error_ind, | ||
int | error_code, | ||
const char * | error_msg, | ||
char | is_in_tran | ||
) |
Definition at line 601 of file shard_proxy_io.c.
References assert, CAS_MAKE_PROTO_VER, CAS_MAKE_VER, CAS_NO_ERROR, t_net_buf::data, t_net_buf::data_size, error(), MSG_HEADER_SIZE, net_buf_cp_int(), net_buf_cp_str(), NULL, PROXY_CONV_ERR_TO_OLD, proxy_convert_error_code(), PROXY_DEBUG_LOG, proxy_init_net_buf(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_make_net_buf(), proxy_set_con_status_in_tran(), set_data_length(), SHARD_NET_BUF_ALLOC_SIZE, and strlen.
Referenced by fn_proxy_cas_prepare(), proxy_context_send_error(), proxy_io_make_client_acl_fail(), and proxy_io_make_no_error().
int proxy_io_make_ex_get_isolation_level | ( | char * | driver_info, |
char ** | buffer, | ||
void * | argv | ||
) |
Definition at line 694 of file shard_proxy_io.c.
References proxy_io_make_ex_get_int().
Referenced by fn_proxy_client_get_db_parameter().
int proxy_io_make_ex_get_lock_timeout | ( | char * | driver_info, |
char ** | buffer, | ||
void * | argv | ||
) |
Definition at line 700 of file shard_proxy_io.c.
References proxy_io_make_ex_get_int().
Referenced by fn_proxy_client_get_db_parameter().
int proxy_io_make_get_db_version | ( | char * | driver_info, |
char ** | buffer | ||
) |
Definition at line 832 of file shard_proxy_io.c.
References assert, CAS_MAKE_PROTO_VER, t_net_buf::data, t_net_buf::data_size, error(), MSG_HEADER_SIZE, net_buf_cp_byte(), net_buf_cp_int(), net_buf_cp_str(), NULL, p, proxy_init_net_buf(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_make_net_buf(), rel_build_number(), set_data_length(), SHARD_NET_BUF_ALLOC_SIZE, and strlen.
Referenced by fn_proxy_client_get_db_version().
int proxy_io_make_no_error | ( | char * | driver_info, |
char ** | buffer | ||
) |
Definition at line 664 of file shard_proxy_io.c.
References CAS_NO_ERROR, NULL, and proxy_io_make_error_msg().
Referenced by proxy_io_make_check_cas_ok(), proxy_io_make_con_close_ok(), proxy_io_make_end_tran_ok(), and proxy_io_make_set_db_parameter_ok().
int proxy_io_make_set_db_parameter_ok | ( | char * | driver_info, |
char ** | buffer | ||
) |
Definition at line 688 of file shard_proxy_io.c.
References proxy_io_make_no_error().
Referenced by fn_proxy_client_set_db_parameter().
int proxy_io_make_shard_info | ( | char * | driver_info, |
char ** | buffer | ||
) |
Definition at line 1035 of file shard_proxy_io.c.
References assert, CAS_MAKE_PROTO_VER, t_net_buf::data, t_net_buf::data_size, t_shard_conn::db_conn_info, t_shard_conn::db_name, error(), t_proxy_info::max_shard, MSG_HEADER_SIZE, net_buf_cp_int(), net_buf_cp_str(), NULL, t_shm_shard_conn::num_shard_conn, proxy_init_net_buf(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_make_net_buf(), set_data_length(), t_shm_shard_conn::shard_conn, and strlen.
Referenced by fn_proxy_get_shard_info().
int proxy_io_process | ( | void | ) |
Definition at line 4300 of file shard_proxy_io.c.
References allset, assert, broker_conn_fd, cas_lsnr_fd, CLOSE_SOCKET, t_socket_io_global::ent, i, IS_INVALID_SOCKET, t_socket_io_global::max_socket, maxfd, NULL, PROXY_DEBUG_LOG, proxy_io_cas_accept(), PROXY_IO_FROM_CAS, proxy_Keep_running, PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_socket_io_add(), proxy_socket_io_new_client(), proxy_socket_io_read(), proxy_socket_io_read_error(), proxy_socket_io_write(), rset, sock_fd, wallset, wnewset, and wset.
Referenced by main().
int proxy_io_set_established_by_ctx | ( | T_PROXY_CONTEXT * | ctx_p | ) |
Definition at line 1425 of file shard_proxy_io.c.
References assert, t_proxy_context::cid, t_proxy_context::client_id, EXIT_FUNC, t_client_io::fd, NULL, proxy_client_io_find_by_ctx(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_socket_io_find(), SOCK_IO_ESTABLISHED, t_socket_io::status, and t_proxy_context::uid.
Referenced by fn_proxy_cas_check_cas().
int proxy_make_net_buf | ( | T_NET_BUF * | net_buf, |
int | size, | ||
T_BROKER_VERSION | client_version | ||
) |
Definition at line 513 of file shard_proxy_io.c.
References t_net_buf::alloc_size, t_net_buf::data, MALLOC, net_buf_init(), NULL, PROXY_LOG, and PROXY_LOG_MODE_ERROR.
Referenced by proxy_io_make_check_cas(), proxy_io_make_client_proxy_alive(), proxy_io_make_close_req_handle_ok(), proxy_io_make_end_tran_request(), proxy_io_make_error_msg(), proxy_io_make_ex_get_int(), proxy_io_make_get_db_version(), and proxy_io_make_shard_info().
void proxy_set_con_status_in_tran | ( | char * | msg | ) |
Definition at line 457 of file shard_proxy_io.c.
References assert, CAS_INFO_STATUS, CAS_INFO_STATUS_ACTIVE, and MSG_HEADER_INFO_SIZE.
Referenced by fn_proxy_cas_prepare(), fn_proxy_client_check_cas(), and proxy_io_make_error_msg().
void proxy_set_con_status_out_tran | ( | char * | msg | ) |
Definition at line 471 of file shard_proxy_io.c.
References assert, CAS_INFO_STATUS, CAS_INFO_STATUS_INACTIVE, and MSG_HEADER_INFO_SIZE.
void proxy_set_force_out_tran | ( | char * | msg | ) |
Definition at line 485 of file shard_proxy_io.c.
References assert, CAS_INFO_ADDITIONAL_FLAG, CAS_INFO_FLAG_MASK_FORCE_OUT_TRAN, and MSG_HEADER_INFO_SIZE.
Referenced by fn_proxy_client_check_cas(), fn_proxy_client_prepare(), and proxy_io_make_check_cas().
void proxy_shard_io_print | ( | bool | print_all | ) |
Referenced by proxy_cas_io_new(), and proxy_shard_io_destroy().
int proxy_socket_io_delete | ( | SOCKET | fd | ) |
Definition at line 1383 of file shard_proxy_io.c.
References allset, assert, CLOSE_SOCKET, t_socket_io_global::cur_socket, t_socket_io_global::ent, ENTER_FUNC, EXIT_FUNC, t_socket_io::fd, INVALID_SOCKET, t_socket_io_global::max_socket, PROXY_DEBUG_LOG, PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_socket_io_clear(), SOCK_IO_CLOSE_WAIT, t_socket_io::status, and wnewset.
Referenced by proxy_cas_io_free(), proxy_cas_io_free_by_ctx(), proxy_client_io_free(), proxy_context_find_by_socket_client_io(), proxy_process_cas_conn_error(), proxy_process_cas_register(), proxy_process_cas_response(), and proxy_socket_io_new_client().
void proxy_socket_io_print | ( | bool | print_all | ) |
Referenced by proxy_socket_io_add(), and proxy_socket_io_destroy().
int proxy_socket_set_write_event | ( | T_SOCKET_IO * | sock_io_p, |
T_PROXY_EVENT * | event_p | ||
) |
Definition at line 1460 of file shard_proxy_io.c.
References assert, t_proxy_event::buffer, error(), t_socket_io::fd, NULL, t_io_buffer::offset, proxy_event_free(), wnewset, and t_socket_io::write_event.
Referenced by proxy_cas_io_write(), proxy_client_io_write(), proxy_process_client_register(), and proxy_socket_io_new_client().
char* proxy_str_cas_io | ( | T_CAS_IO * | cas_io_p | ) |
Definition at line 3344 of file shard_proxy_io.c.
References t_cas_io::cas_id, t_cas_io::ctx_cid, t_cas_io::ctx_uid, t_cas_io::fd, t_cas_io::is_in_tran, NULL, t_cas_io::shard_id, and t_cas_io::status.
Referenced by proxy_cas_alloc_by_shard_and_cas_id(), proxy_cas_find_io_by_ctx(), proxy_cas_io_free_by_ctx(), proxy_cas_io_new(), proxy_cas_io_write(), proxy_cas_release_by_ctx(), proxy_client_execute_internal(), proxy_process_cas_conn_error(), proxy_process_cas_register(), proxy_process_cas_response(), proxy_send_request_to_cas(), and proxy_send_request_to_cas_with_new_event().
char* proxy_str_client_io | ( | T_CLIENT_IO * | cli_io_p | ) |
Definition at line 2979 of file shard_proxy_io.c.
References t_client_io::client_id, t_client_io::ctx_cid, t_client_io::ctx_uid, t_client_io::fd, t_client_io::is_busy, and NULL.
Referenced by proxy_client_io_new(), proxy_client_io_write(), proxy_context_find_by_socket_client_io(), and proxy_send_response_to_client().
void proxy_unset_force_out_tran | ( | char * | msg | ) |
Definition at line 499 of file shard_proxy_io.c.
References assert, CAS_INFO_ADDITIONAL_FLAG, CAS_INFO_FLAG_MASK_FORCE_OUT_TRAN, and MSG_HEADER_INFO_SIZE.
Referenced by proxy_client_execute_internal(), and proxy_handler_process_client_request().
void set_data_length | ( | char * | buffer, |
int | length | ||
) |
Definition at line 228 of file shard_proxy_io.c.
References assert, and htonl().
Referenced by proxy_io_make_check_cas(), proxy_io_make_client_proxy_alive(), proxy_io_make_close_req_handle_ok(), proxy_io_make_end_tran_request(), proxy_io_make_error_msg(), proxy_io_make_ex_get_int(), proxy_io_make_get_db_version(), proxy_io_make_shard_info(), and shard_stmt_save_prepare_request().
fd_set allset |
Definition at line 191 of file shard_proxy_io.c.
Referenced by proxy_io_cas_lsnr(), proxy_io_initialize(), proxy_io_process(), proxy_io_register_to_broker(), proxy_listener_thr_f(), proxy_process_cas_conn_error(), proxy_process_client_conn_error(), proxy_socket_io_add(), proxy_socket_io_delete(), and proxy_socket_io_destroy().
int maxfd |
Definition at line 190 of file shard_proxy_io.c.
Referenced by check_cas_log(), proxy_io_cas_lsnr(), proxy_io_process(), proxy_io_register_to_broker(), proxy_socket_io_add(), read_from_client_with_timeout(), and write_to_client_with_timeout().
T_CLIENT_IO_GLOBAL proxy_Client_io |
Definition at line 204 of file shard_proxy_io.c.
T_SHARD_IO_GLOBAL proxy_Shard_io |
Definition at line 205 of file shard_proxy_io.c.
fd_set rset |
Definition at line 191 of file shard_proxy_io.c.
Referenced by proxy_io_process(), and proxy_listener_thr_f().
fd_set wallset |
Definition at line 191 of file shard_proxy_io.c.
Referenced by proxy_io_process().
fd_set wnewset |
Definition at line 191 of file shard_proxy_io.c.
Referenced by proxy_io_initialize(), proxy_io_process(), proxy_process_cas_conn_error(), proxy_process_client_conn_error(), proxy_socket_io_delete(), proxy_socket_io_destroy(), proxy_socket_io_write(), proxy_socket_io_write_internal(), and proxy_socket_set_write_event().
fd_set wset |
Definition at line 191 of file shard_proxy_io.c.
Referenced by proxy_io_process().