CUBRID Engine
latest
|
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include "porting.h"
#include "shard_proxy.h"
#include "shard_proxy_handler.h"
#include "shard_proxy_function.h"
#include "shard_statement.h"
#include "shard_parser.h"
#include "shard_key_func.h"
#include "system_parameter.h"
#include "dbtype.h"
Go to the source code of this file.
Variables | |
T_SHM_SHARD_KEY * | shm_key_p |
T_PROXY_INFO * | proxy_info_p |
T_PROXY_HANDLER | proxy_Handler |
T_PROXY_CONTEXT | proxy_Context |
int fn_proxy_cas_check_cas | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p | ||
) |
Definition at line 3739 of file shard_proxy_function.c.
References assert, t_proxy_event::buffer, CAS_MAKE_PROTO_VER, t_io_buffer::data, error(), t_proxy_context::free_context, t_proxy_context::free_on_client_io_write, t_proxy_context::is_connected, t_io_buffer::length, MSG_HEADER_SIZE, NULL, proxy_check_cas_error(), proxy_event_free(), PROXY_EVENT_FROM_CLIENT, PROXY_EVENT_IO_WRITE, proxy_event_new_with_rsp(), proxy_get_cas_error_code(), proxy_get_driver_info_by_ctx(), proxy_io_make_client_dbinfo_ok(), proxy_io_set_established_by_ctx(), PROXY_LOG, PROXY_LOG_MODE_ERROR, PROXY_LOG_MODE_NOTICE, proxy_send_response_to_client(), proxy_str_context(), proxy_str_event(), and t_proxy_context::waiting_event.
int fn_proxy_cas_conn_error | ( | T_PROXY_CONTEXT * | ctx_p | ) |
Definition at line 3912 of file shard_proxy_function.c.
int fn_proxy_cas_end_tran | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p | ||
) |
Definition at line 2958 of file shard_proxy_function.c.
References t_proxy_context::dont_free_statement, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, t_proxy_context::free_on_client_io_write, t_proxy_context::free_on_end_tran, NULL, PROXY_DEBUG_LOG, proxy_event_free(), PROXY_EVENT_FROM_CLIENT, PROXY_EVENT_IO_WRITE, proxy_io_make_con_close_ok(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_send_response_to_client(), proxy_send_response_to_client_with_new_event(), proxy_str_context(), and proxy_str_event().
int fn_proxy_cas_execute | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p | ||
) |
Definition at line 3279 of file shard_proxy_function.c.
References proxy_cas_execute_internal().
int fn_proxy_cas_execute_array | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p | ||
) |
Definition at line 3402 of file shard_proxy_function.c.
References proxy_cas_execute_internal().
int fn_proxy_cas_fetch | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p | ||
) |
Definition at line 3427 of file shard_proxy_function.c.
References t_proxy_context::cas_id, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, t_proxy_context::is_client_in_tran, NULL, proxy_event_free(), proxy_handler_is_cas_in_tran(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_send_response_to_client(), proxy_str_context(), proxy_str_event(), and t_proxy_context::shard_id.
int fn_proxy_cas_prepare | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p | ||
) |
Definition at line 3016 of file shard_proxy_function.c.
References assert, t_proxy_event::buffer, CAS_ER_STMT_POOLING, CAS_ERROR_INDICATOR, t_proxy_context::cas_id, CAS_MAKE_PROTO_VER, t_proxy_handler::cli_ret_q, t_io_buffer::data, t_proxy_context::dont_free_statement, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, get_msg_length(), htonl(), t_proxy_context::is_client_in_tran, t_proxy_context::is_prepare_for_execute, t_io_buffer::length, MSG_HEADER_SIZE, NET_SIZE_INT, NULL, t_proxy_context::prepared_stmt, proxy_check_cas_error(), proxy_dup_msg(), proxy_event_free(), PROXY_EVENT_FROM_CLIENT, PROXY_EVENT_IO_WRITE, proxy_event_new_with_error(), proxy_get_cas_error_code(), proxy_get_driver_info_by_ctx(), proxy_has_different_column_info(), proxy_io_make_error_msg(), PROXY_LOG, PROXY_LOG_MODE_DEBUG, PROXY_LOG_MODE_ERROR, PROXY_LOG_MODE_NOTICE, PROXY_LOG_MODE_SHARD_DETAIL, proxy_send_response_to_client(), proxy_set_con_status_in_tran(), proxy_str_context(), proxy_str_event(), t_shard_stmt::reply_buffer, t_shard_stmt::reply_buffer_length, t_proxy_context::shard_id, shard_queue_enqueue(), shard_stmt_add_srv_h_id_for_shard_cas(), shard_stmt_check_waiter_and_wakeup(), shard_stmt_free(), shard_stmt_set_status_invalid(), SHARD_STMT_STATUS_COMPLETE, SHARD_STMT_STATUS_IN_PROGRESS, shard_str_stmt(), t_shard_stmt::status, t_shard_stmt::stmt_h_id, and t_proxy_context::waiting_event.
int fn_proxy_cas_prepare_and_execute | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p | ||
) |
Definition at line 3584 of file shard_proxy_function.c.
References assert, t_proxy_event::buffer, t_proxy_context::cas_id, CAS_MAKE_PROTO_VER, t_io_buffer::data, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, HT_ALL, HT_ID, HT_INVAL, HT_KEY, HT_NONE, htonl(), t_proxy_info::ignore_shard_hint, t_proxy_context::is_client_in_tran, MSG_HEADER_SIZE, NET_SIZE_INT, NULL, t_proxy_info::num_hint_all_queries_processed, t_proxy_info::num_hint_id_queries_processed, t_proxy_info::num_hint_key_queries_processed, t_proxy_info::num_hint_none_queries_processed, OFF, t_proxy_context::prepared_stmt, proxy_check_cas_error(), proxy_event_free(), proxy_get_cas_error_code(), proxy_get_driver_info_by_ctx(), proxy_handler_is_cas_in_tran(), PROXY_LOG, PROXY_LOG_MODE_ERROR, PROXY_LOG_MODE_NOTICE, PROXY_LOG_MODE_SHARD_DETAIL, proxy_send_response_to_client(), proxy_str_context(), proxy_str_event(), t_proxy_context::shard_id, shard_stmt_add_srv_h_id_for_shard_cas(), shard_stmt_free(), SHARD_STMT_INVALID_HANDLE_ID, shard_str_stmt(), t_shard_stmt::stmt_h_id, t_proxy_context::stmt_h_id, t_proxy_context::stmt_hint_type, and t_proxy_context::waiting_event.
int fn_proxy_cas_relay_only | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p | ||
) |
Definition at line 3837 of file shard_proxy_function.c.
References ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, NULL, proxy_event_free(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_send_response_to_client(), proxy_str_context(), and proxy_str_event().
int fn_proxy_cas_schema_info | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p | ||
) |
Definition at line 3467 of file shard_proxy_function.c.
References assert, t_proxy_event::buffer, t_proxy_context::cas_id, CAS_MAKE_PROTO_VER, t_io_buffer::data, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, htonl(), MSG_HEADER_SIZE, NET_SIZE_INT, NULL, t_proxy_context::prepared_stmt, proxy_check_cas_error(), proxy_event_free(), proxy_get_cas_error_code(), proxy_get_driver_info_by_ctx(), PROXY_LOG, PROXY_LOG_MODE_ERROR, PROXY_LOG_MODE_NOTICE, PROXY_LOG_MODE_SHARD_DETAIL, proxy_send_response_to_client(), proxy_str_context(), proxy_str_event(), t_proxy_context::shard_id, shard_stmt_add_srv_h_id_for_shard_cas(), shard_stmt_check_waiter_and_wakeup(), shard_stmt_free(), SHARD_STMT_STATUS_IN_PROGRESS, shard_str_stmt(), t_shard_stmt::status, t_shard_stmt::stmt_h_id, and t_proxy_context::waiting_event.
int fn_proxy_client_check_cas | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 2254 of file shard_proxy_function.c.
References assert, t_proxy_event::buffer, CAS_FC_CHECK_CAS, t_io_buffer::data, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, t_proxy_context::func_code, t_proxy_context::is_client_in_tran, t_proxy_context::is_connected, NULL, proxy_event_dup(), proxy_event_free(), PROXY_EVENT_FROM_CLIENT, PROXY_EVENT_IO_WRITE, proxy_event_new_with_rsp(), proxy_get_driver_info_by_ctx(), proxy_io_make_check_cas_ok(), PROXY_LOG, PROXY_LOG_MODE_DEBUG, PROXY_LOG_MODE_ERROR, proxy_send_request_to_cas(), proxy_send_response_to_client(), proxy_set_con_status_in_tran(), proxy_set_force_out_tran(), proxy_str_context(), proxy_str_event(), and t_proxy_context::waiting_event.
int fn_proxy_client_close_req_handle | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 1849 of file shard_proxy_function.c.
References assert, CAS_FC_CLOSE_REQ_HANDLE, t_cas_io::cas_id, t_proxy_context::cas_id, t_proxy_context::cid, t_proxy_context::client_id, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, t_proxy_context::func_code, t_proxy_context::is_in_tran, net_arg_get_int(), net_arg_put_int(), NULL, proxy_cas_alloc_by_ctx(), proxy_cas_io_write(), proxy_context_set_in_tran(), proxy_event_free(), PROXY_EVENT_FROM_CLIENT, PROXY_EVENT_IO_WRITE, proxy_io_make_close_req_handle_out_tran_ok(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_send_response_to_client_with_new_event(), proxy_str_context(), t_cas_io::shard_id, t_proxy_context::shard_id, shard_stmt_del_srv_h_id_for_shard_cas(), shard_stmt_find_srv_h_id_for_shard_cas(), SHARD_TEMPORARY_UNAVAILABLE, t_proxy_context::uid, and t_proxy_context::wait_timeout.
int fn_proxy_client_con_close | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 2352 of file shard_proxy_function.c.
References assert, CAS_FC_END_TRAN, t_proxy_context::dont_free_statement, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, t_proxy_context::free_on_client_io_write, t_proxy_context::func_code, t_proxy_context::is_client_in_tran, t_proxy_context::is_in_tran, NULL, proxy_context_free_stmt(), proxy_event_free(), PROXY_EVENT_FROM_CAS, PROXY_EVENT_FROM_CLIENT, PROXY_EVENT_IO_WRITE, proxy_io_make_con_close_ok(), proxy_io_make_end_tran_abort(), proxy_send_request_to_cas_with_new_event(), and proxy_send_response_to_client_with_new_event().
int fn_proxy_client_conn_error | ( | T_PROXY_CONTEXT * | ctx_p | ) |
Definition at line 3871 of file shard_proxy_function.c.
References assert, CAS_FC_END_TRAN, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, t_proxy_context::free_on_end_tran, t_proxy_context::func_code, t_proxy_context::is_in_tran, IS_VALID_CAS_FC, PROXY_EVENT_FROM_CAS, PROXY_EVENT_IO_WRITE, proxy_io_make_end_tran_abort(), and proxy_send_request_to_cas_with_new_event().
Referenced by proxy_handler_process_client_conn_error().
int fn_proxy_client_cursor | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 1943 of file shard_proxy_function.c.
References assert, CAS_ER_SRV_HANDLE, CAS_ERROR_INDICATOR, CAS_FC_CURSOR, t_cas_io::cas_id, t_proxy_context::cas_id, t_proxy_context::cid, t_proxy_context::client_id, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, t_proxy_context::func_code, t_proxy_context::is_in_tran, net_arg_get_int(), net_arg_put_int(), NULL, proxy_cas_alloc_by_ctx(), proxy_cas_io_write(), proxy_context_set_error(), proxy_event_free(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_str_context(), proxy_str_event(), t_cas_io::shard_id, t_proxy_context::shard_id, shard_stmt_find_srv_h_id_for_shard_cas(), SHARD_TEMPORARY_UNAVAILABLE, t_proxy_context::uid, and t_proxy_context::wait_timeout.
int fn_proxy_client_cursor_close | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 2466 of file shard_proxy_function.c.
References assert, CAS_FC_CURSOR_CLOSE, t_cas_io::cas_id, t_proxy_context::cas_id, t_proxy_context::cid, t_proxy_context::client_id, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, t_proxy_context::func_code, t_proxy_context::is_in_tran, net_arg_get_int(), net_arg_put_int(), NULL, proxy_cas_alloc_by_ctx(), proxy_cas_io_write(), proxy_context_set_in_tran(), proxy_event_free(), PROXY_EVENT_FROM_CLIENT, PROXY_EVENT_IO_WRITE, proxy_io_make_cursor_close_out_tran_ok(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_send_response_to_client_with_new_event(), proxy_str_context(), t_cas_io::shard_id, t_proxy_context::shard_id, shard_stmt_find_srv_h_id_for_shard_cas(), SHARD_TEMPORARY_UNAVAILABLE, t_proxy_context::uid, and t_proxy_context::wait_timeout.
int fn_proxy_client_end_tran | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 829 of file shard_proxy_function.c.
References assert, CAS_FC_END_TRAN, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, t_proxy_context::func_code, t_proxy_context::is_client_in_tran, t_proxy_context::is_in_tran, NULL, proxy_context_free_stmt(), proxy_event_free(), PROXY_EVENT_FROM_CLIENT, PROXY_EVENT_IO_WRITE, proxy_io_make_end_tran_ok(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_send_request_to_cas(), proxy_send_response_to_client_with_new_event(), proxy_str_context(), and proxy_str_event().
int fn_proxy_client_execute | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 1304 of file shard_proxy_function.c.
References CAS_FC_EXECUTE, CAS_MAKE_PROTO_VER, CAS_PROTO_MAKE_VER, DOES_CLIENT_UNDERSTAND_THE_PROTOCOL, net_arg_get_int(), PROTOCOL_V1, PROTOCOL_V2, proxy_client_execute_internal(), proxy_get_driver_info_by_ctx(), and query_timeout.
int fn_proxy_client_execute_array | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 2556 of file shard_proxy_function.c.
References CAS_FC_EXECUTE_ARRAY, CAS_MAKE_PROTO_VER, CAS_PROTO_MAKE_VER, net_arg_get_int(), PROTOCOL_V4, proxy_client_execute_internal(), proxy_get_driver_info_by_ctx(), and query_timeout.
int fn_proxy_client_fetch | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 2033 of file shard_proxy_function.c.
References assert, CAS_ER_SRV_HANDLE, CAS_ERROR_INDICATOR, CAS_FC_FETCH, t_cas_io::cas_id, t_proxy_context::cas_id, t_proxy_context::cid, t_proxy_context::client_id, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, t_proxy_context::func_code, t_proxy_context::is_in_tran, net_arg_get_int(), net_arg_put_int(), NULL, proxy_cas_alloc_by_ctx(), proxy_cas_io_write(), proxy_context_set_error(), proxy_context_set_in_tran(), proxy_event_free(), t_cas_io::shard_id, t_proxy_context::shard_id, shard_stmt_find_srv_h_id_for_shard_cas(), SHARD_TEMPORARY_UNAVAILABLE, t_proxy_context::uid, and t_proxy_context::wait_timeout.
int fn_proxy_client_get_db_parameter | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 1770 of file shard_proxy_function.c.
References CAS_ER_ARGS, CAS_ER_INTERNAL, CAS_ERROR_INDICATOR, t_proxy_context::cid, t_proxy_context::client_id, error(), t_proxy_context::free_context, t_client_info::isolation_level, net_arg_get_int(), NULL, proxy_context_set_error(), proxy_event_free(), PROXY_EVENT_FROM_CLIENT, PROXY_EVENT_IO_WRITE, proxy_event_new_with_rsp_ex(), proxy_get_driver_info_by_ctx(), proxy_io_make_ex_get_isolation_level(), proxy_io_make_ex_get_lock_timeout(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_send_response_to_client(), proxy_str_context(), proxy_str_event(), shard_shm_get_client_info(), and t_proxy_context::uid.
int fn_proxy_client_get_db_version | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 2414 of file shard_proxy_function.c.
References CAS_ER_ARGS, CAS_ERROR_INDICATOR, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, net_arg_get_char, NULL, proxy_context_set_error(), proxy_event_free(), PROXY_EVENT_FROM_CLIENT, PROXY_EVENT_IO_WRITE, proxy_io_make_get_db_version(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_send_response_to_client_with_new_event(), and proxy_str_context().
int fn_proxy_client_not_supported | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 2937 of file shard_proxy_function.c.
References assert, CAS_ER_NOT_IMPLEMENTED, CAS_ERROR_INDICATOR, ENTER_FUNC, EXIT_FUNC, NULL, proxy_context_set_error(), and proxy_event_free().
int fn_proxy_client_prepare | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
this statement has been used previously. if we use it, we will get the corrupted result of statement.
Definition at line 891 of file shard_proxy_function.c.
References t_proxy_info::appl_server, argc, assert, t_proxy_event::buffer, CAS_ER_ARGS, CAS_ER_INTERNAL, CAS_ERROR_INDICATOR, CAS_FC_PREPARE, t_cas_io::cas_id, t_proxy_context::cas_id, CAS_MAKE_PROTO_VER, t_proxy_context::cid, t_proxy_context::client_id, t_shard_stmt::ctx_cid, t_shard_stmt::ctx_uid, t_io_buffer::data, t_proxy_context::database_user, ENTER_FUNC, error(), EXIT_FUNC, FALSE, t_proxy_context::free_context, FREE_MEM, t_proxy_context::func_code, i, t_proxy_info::ignore_shard_hint, t_shard_stmt::index, t_proxy_context::is_client_in_tran, t_proxy_context::is_in_tran, t_proxy_context::is_prepare_for_execute, t_io_buffer::length, net_arg_get_char, net_arg_get_int(), net_arg_get_str(), NULL, t_proxy_info::num_request_stmt, t_proxy_info::num_request_stmt_in_pool, OFF, t_shard_stmt::parser, t_proxy_context::prepared_stmt, proxy_cas_alloc_by_ctx(), proxy_cas_io_write(), proxy_context_add_stmt(), proxy_context_find_stmt(), proxy_context_set_error(), proxy_context_set_in_tran(), PROXY_DEBUG_LOG, proxy_event_dup(), proxy_event_free(), proxy_get_driver_info_by_ctx(), proxy_get_shard_id(), PROXY_INVALID_SHARD, PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_send_prepared_stmt_to_client(), proxy_set_force_out_tran(), proxy_str_context(), proxy_waiter_comp_fn(), proxy_waiter_free(), proxy_waiter_new(), t_cas_io::shard_id, t_proxy_context::shard_id, shard_queue_ordered_enqueue(), shard_stmt_check_waiter_and_wakeup(), shard_stmt_find_by_sql(), shard_stmt_free(), shard_stmt_new_exclusive(), shard_stmt_new_prepared_stmt(), shard_stmt_rewrite_sql(), shard_stmt_save_prepare_request(), shard_stmt_set_hint_list(), SHARD_STMT_STATUS_COMPLETE, SHARD_STMT_STATUS_IN_PROGRESS, SHARD_STMT_TYPE_PREPARED, shard_str_sqls(), shard_str_stmt(), SHARD_TEMPORARY_UNAVAILABLE, sp_is_hint_static(), t_shard_stmt::status, t_shard_stmt::stmt_h_id, t_shard_stmt::stmt_type, t_proxy_info::stmt_waiter_count, t_proxy_context::uid, t_proxy_context::wait_timeout, t_proxy_context::waiting_dummy_prepare, t_proxy_context::waiting_event, and t_shard_stmt::waitq.
int fn_proxy_client_prepare_and_execute | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 2616 of file shard_proxy_function.c.
References assert, t_proxy_event::buffer, CAS_ER_ARGS, CAS_ER_INTERNAL, CAS_ERROR_INDICATOR, CAS_FC_PREPARE_AND_EXECUTE, t_cas_io::cas_id, t_proxy_context::cas_id, CAS_MAKE_PROTO_VER, CAS_PROTO_MAKE_VER, t_proxy_context::cid, t_proxy_context::client_id, t_io_buffer::data, DOES_CLIENT_UNDERSTAND_THE_PROTOCOL, error(), EXIT_FUNC, FALSE, t_proxy_context::free_context, t_proxy_context::func_code, HT_EOF, HT_INVAL, i, t_proxy_info::ignore_shard_hint, t_proxy_context::is_client_in_tran, net_arg_get_char, net_arg_get_int(), net_arg_get_str(), NULL, OFF, t_proxy_context::prepared_stmt, PROTOCOL_V1, PROTOCOL_V2, proxy_cas_alloc_by_ctx(), proxy_cas_io_write(), proxy_context_add_stmt(), proxy_context_set_error(), proxy_context_set_in_tran(), PROXY_DEBUG_LOG, proxy_event_dup(), proxy_event_free(), proxy_get_driver_info_by_ctx(), proxy_get_shard_id(), PROXY_INVALID_SHARD, PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_set_wait_timeout(), proxy_str_context(), proxy_update_shard_stats(), proxy_update_shard_stats_without_hint(), query_timeout, t_cas_io::shard_id, t_proxy_context::shard_id, shard_stmt_check_waiter_and_wakeup(), shard_stmt_free(), shard_stmt_get_hint_type(), shard_stmt_new_exclusive(), shard_stmt_set_hint_list(), SHARD_STMT_TYPE_EXCLUSIVE, SHARD_STMT_TYPE_SCHEMA_INFO, shard_str_sqls(), shard_str_stmt(), SHARD_TEMPORARY_UNAVAILABLE, t_shard_stmt::stmt_h_id, t_proxy_context::stmt_h_id, t_proxy_context::stmt_hint_type, t_shard_stmt::stmt_type, t_proxy_context::uid, t_proxy_context::wait_timeout, and t_proxy_context::waiting_event.
int fn_proxy_client_schema_info | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 2122 of file shard_proxy_function.c.
References assert, CAS_ER_INTERNAL, CAS_ERROR_INDICATOR, CAS_FC_SCHEMA_INFO, CAS_MAKE_PROTO_VER, t_proxy_context::cid, DOES_CLIENT_UNDERSTAND_THE_PROTOCOL, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, t_proxy_context::func_code, t_proxy_info::max_shard, net_arg_get_int(), NULL, t_proxy_context::prepared_stmt, PROTOCOL_V5, proxy_context_add_stmt(), proxy_context_set_error(), proxy_event_free(), proxy_get_driver_info_by_ctx(), PROXY_INVALID_SHARD, PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_send_request_to_cas(), proxy_str_context(), proxy_str_event(), t_proxy_context::shard_id, shard_stmt_free(), shard_stmt_new_schema_info(), SHARD_STMT_TYPE_SCHEMA_INFO, shard_str_stmt(), t_shard_stmt::stmt_type, t_proxy_context::uid, and t_proxy_context::waiting_event.
int fn_proxy_client_set_db_parameter | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 1673 of file shard_proxy_function.c.
References CAS_ER_ARGS, CAS_ER_INTERNAL, CAS_ERROR_INDICATOR, CAS_USE_DEFAULT_DB_PARAM, t_proxy_context::cid, t_proxy_context::client_id, error(), t_proxy_context::free_context, IS_VALID_ISOLATION_LEVEL, t_client_info::isolation_level, t_client_info::lock_timeout, net_arg_get_int(), NULL, proxy_context_set_error(), proxy_event_free(), PROXY_EVENT_FROM_CLIENT, PROXY_EVENT_IO_WRITE, proxy_event_new_with_rsp(), proxy_get_driver_info_by_ctx(), proxy_io_make_set_db_parameter_ok(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_send_response_to_client(), proxy_str_context(), proxy_str_event(), shard_shm_get_client_info(), and t_proxy_context::uid.
int fn_proxy_get_shard_info | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | argc, | ||
char ** | argv | ||
) |
Definition at line 2582 of file shard_proxy_function.c.
References ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, NULL, proxy_event_free(), PROXY_EVENT_FROM_CLIENT, PROXY_EVENT_IO_WRITE, proxy_io_make_shard_info(), and proxy_send_response_to_client_with_new_event().
int make_header_info | ( | T_NET_BUF * | net_buf, |
MSG_HEADER * | client_msg_header | ||
) |
int make_net_buf | ( | T_NET_BUF * | net_buf, |
int | size | ||
) |
|
static |
Definition at line 3299 of file shard_proxy_function.c.
References assert, t_proxy_event::buffer, t_proxy_context::cas_id, CAS_MAKE_PROTO_VER, t_io_buffer::data, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, HT_ALL, HT_ID, HT_INVAL, HT_KEY, HT_NONE, t_proxy_info::ignore_shard_hint, t_proxy_context::is_client_in_tran, NULL, t_proxy_info::num_hint_all_queries_processed, t_proxy_info::num_hint_id_queries_processed, t_proxy_info::num_hint_key_queries_processed, t_proxy_info::num_hint_none_queries_processed, OFF, proxy_check_cas_error(), proxy_event_free(), proxy_get_cas_error_code(), proxy_get_driver_info_by_ctx(), proxy_handler_is_cas_in_tran(), proxy_is_invalid_statement(), PROXY_LOG, PROXY_LOG_MODE_ERROR, PROXY_LOG_MODE_NOTICE, proxy_send_response_to_client(), proxy_str_context(), proxy_str_event(), t_proxy_context::shard_id, shard_stmt_del_srv_h_id_for_shard_cas(), SHARD_STMT_INVALID_HANDLE_ID, shard_stmt_set_status_invalid(), t_proxy_context::stmt_h_id, t_proxy_context::stmt_hint_type, and t_proxy_context::waiting_event.
Referenced by fn_proxy_cas_execute(), and fn_proxy_cas_execute_array().
int proxy_check_cas_error | ( | char * | read_msg | ) |
Definition at line 90 of file shard_proxy_function.c.
References MSG_HEADER_SIZE, and ntohl().
Referenced by fn_proxy_cas_check_cas(), fn_proxy_cas_prepare(), fn_proxy_cas_prepare_and_execute(), fn_proxy_cas_schema_info(), proxy_cas_execute_internal(), and proxy_handler_process_cas_response().
|
static |
Definition at line 1335 of file shard_proxy_function.c.
References argc, assert, sp_parser_ctx::bind_count, t_proxy_event::buffer, CAS_ER_ARGS, CAS_ER_INTERNAL, CAS_ER_STMT_POOLING, CAS_ERROR_INDICATOR, CAS_FC_EXECUTE_ARRAY, CAS_FC_PREPARE, t_cas_io::cas_id, t_proxy_context::cas_id, t_proxy_context::cid, t_proxy_context::client_id, t_io_buffer::data, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, FREE_MEM, t_proxy_context::func_code, get_msg_length(), HT_EOF, HT_NONE, i, t_proxy_info::ignore_shard_hint, t_proxy_context::is_prepare_for_execute, net_arg_get_int(), net_arg_put_int(), NULL, OFF, t_shard_stmt::parser, t_proxy_context::prepared_stmt, proxy_cas_alloc_by_ctx(), proxy_cas_io_write(), proxy_context_add_stmt(), proxy_context_set_error(), proxy_context_set_in_tran(), proxy_dup_msg(), proxy_event_dup(), proxy_event_free(), PROXY_EVENT_FROM_CAS, PROXY_EVENT_IO_WRITE, proxy_event_new(), proxy_event_set_buffer(), proxy_get_shard_id(), PROXY_INVALID_SHARD, PROXY_LOG, PROXY_LOG_MODE_ERROR, PROXY_LOG_MODE_SHARD_DETAIL, proxy_set_wait_timeout(), proxy_str_cas_io(), proxy_str_context(), proxy_unset_force_out_tran(), proxy_update_shard_stats(), proxy_update_shard_stats_without_hint(), t_shard_stmt::request_buffer, t_cas_io::shard_id, t_proxy_context::shard_id, shard_stmt_find_by_stmt_h_id(), shard_stmt_find_srv_h_id_for_shard_cas(), shard_stmt_get_hint_type(), SHARD_STMT_STATUS_COMPLETE, SHARD_STMT_STATUS_INVALID, shard_str_stmt(), SHARD_TEMPORARY_UNAVAILABLE, t_shard_stmt::status, t_proxy_context::stmt_h_id, t_proxy_context::stmt_hint_type, t_proxy_context::uid, t_proxy_context::wait_timeout, and t_proxy_context::waiting_event.
Referenced by fn_proxy_client_execute(), and fn_proxy_client_execute_array().
int proxy_get_cas_error_code | ( | char * | read_msg, |
T_BROKER_VERSION | client_version | ||
) |
Definition at line 104 of file shard_proxy_function.c.
References CAS_MAKE_VER, MSG_HEADER_SIZE, and ntohl().
Referenced by fn_proxy_cas_check_cas(), fn_proxy_cas_prepare(), fn_proxy_cas_prepare_and_execute(), fn_proxy_cas_schema_info(), and proxy_cas_execute_internal().
|
static |
Definition at line 670 of file shard_proxy_function.c.
References assert, sp_parser_hint::bind_position, sp_parser_hint::bind_type, BT_DYNAMIC, BT_STATIC, t_shard_key::key_column, net_arg_get_bigint(), net_arg_get_char, net_arg_get_int(), net_arg_get_short(), net_arg_get_size(), net_arg_get_str(), NULL, t_shm_shard_key::num_shard_key, proxy_find_shard_id_by_hint_value(), PROXY_LOG, PROXY_LOG_MODE_ERROR, PROXY_LOG_MODE_SHARD_DETAIL, t_shard_key_range::shard_id, t_shm_shard_key::shard_key, shard_metadata_find_shard_range(), SHARD_U_TYPE_STRING, and sp_parser_hint::value.
Referenced by proxy_get_shard_id().
|
static |
Definition at line 574 of file shard_proxy_function.c.
References sp_parser_hint::arg, assert, sp_parser_hint::hint_type, HT_ID, HT_KEY, sp_value::integer, MAX_SHARD_CONN, NULL, t_proxy_info::num_hint_err_queries_processed, t_shard_stmt::parser, proxy_get_range_by_param(), PROXY_INVALID_SHARD, PROXY_LOG, PROXY_LOG_MODE_ERROR, t_shard_key_range::shard_id, sp_get_first_hint(), sp_get_next_hint(), sp_value::type, and VT_INTEGER.
Referenced by fn_proxy_client_prepare(), fn_proxy_client_prepare_and_execute(), and proxy_client_execute_internal().
|
static |
Definition at line 3938 of file shard_proxy_function.c.
References MSG_HEADER_SIZE, and NET_SIZE_INT.
Referenced by fn_proxy_cas_prepare().
|
static |
Definition at line 3919 of file shard_proxy_function.c.
References CAS_ER_STMT_POOLING, CAS_ERROR_INDICATOR, CAS_MAKE_VER, PROXY_CONV_ERR_TO_NEW, and proxy_convert_error_code().
Referenced by proxy_cas_execute_internal().
|
static |
Definition at line 376 of file shard_proxy_function.c.
References error(), EXIT_FUNC, FREE_MEM, get_msg_length(), NULL, proxy_dup_msg(), proxy_event_free(), PROXY_EVENT_FROM_CLIENT, PROXY_EVENT_IO_WRITE, proxy_event_new(), proxy_event_set_buffer(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_send_response_to_client(), proxy_str_context(), proxy_str_event(), and t_shard_stmt::reply_buffer.
Referenced by fn_proxy_client_prepare().
int proxy_send_request_to_cas | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p, | ||
int | func_code | ||
) |
Definition at line 123 of file shard_proxy_function.c.
References assert, t_cas_io::cas_id, t_proxy_context::cas_id, t_proxy_context::cid, t_proxy_context::client_id, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::is_in_tran, NULL, proxy_cas_alloc_by_ctx(), proxy_cas_io_write(), proxy_context_set_in_tran(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_str_cas_io(), proxy_str_event(), t_cas_io::shard_id, t_proxy_context::shard_id, SHARD_TEMPORARY_UNAVAILABLE, t_proxy_context::uid, and t_proxy_context::wait_timeout.
Referenced by fn_proxy_client_check_cas(), fn_proxy_client_end_tran(), fn_proxy_client_schema_info(), and proxy_send_request_to_cas_with_new_event().
|
static |
Definition at line 169 of file shard_proxy_function.c.
References argc, argv, assert, CAS_ER_SRV_HANDLE, CAS_ERROR_INDICATOR, t_cas_io::cas_id, t_proxy_context::cas_id, t_proxy_context::cid, ENTER_FUNC, error(), EXIT_FUNC, t_proxy_context::free_context, t_proxy_context::func_code, t_proxy_context::is_in_tran, net_arg_get_int(), net_arg_put_int(), NULL, proxy_cas_alloc_by_ctx(), proxy_cas_io_write(), proxy_context_set_error(), proxy_context_set_in_tran(), proxy_event_free(), proxy_event_new_with_req(), proxy_get_driver_info_by_ctx(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_send_request_to_cas(), proxy_str_cas_io(), proxy_str_context(), proxy_str_event(), t_cas_io::shard_id, t_proxy_context::shard_id, shard_stmt_find_srv_h_id_for_shard_cas(), SHARD_TEMPORARY_UNAVAILABLE, t_proxy_context::uid, and t_proxy_context::wait_timeout.
Referenced by fn_proxy_client_con_close(), and fn_proxy_client_conn_error().
int proxy_send_response_to_client | ( | T_PROXY_CONTEXT * | ctx_p, |
T_PROXY_EVENT * | event_p | ||
) |
Definition at line 295 of file shard_proxy_function.c.
References t_proxy_context::cid, t_proxy_context::client_id, ENTER_FUNC, error(), EXIT_FUNC, NULL, proxy_client_io_find_by_ctx(), proxy_client_io_write(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_str_client_io(), proxy_str_event(), and t_proxy_context::uid.
Referenced by fn_proxy_cas_check_cas(), fn_proxy_cas_end_tran(), fn_proxy_cas_fetch(), fn_proxy_cas_prepare(), fn_proxy_cas_prepare_and_execute(), fn_proxy_cas_relay_only(), fn_proxy_cas_schema_info(), fn_proxy_client_check_cas(), fn_proxy_client_get_db_parameter(), fn_proxy_client_set_db_parameter(), proxy_cas_execute_internal(), proxy_context_send_error(), proxy_send_prepared_stmt_to_client(), and proxy_send_response_to_client_with_new_event().
int proxy_send_response_to_client_with_new_event | ( | T_PROXY_CONTEXT * | ctx_p, |
unsigned int | type, | ||
int | from, | ||
T_PROXY_EVENT_FUNC | resp_func | ||
) |
Definition at line 327 of file shard_proxy_function.c.
References t_proxy_context::client_id, error(), NULL, proxy_event_free(), proxy_event_new_with_rsp(), proxy_get_driver_info_by_ctx(), PROXY_LOG, PROXY_LOG_MODE_ERROR, proxy_send_response_to_client(), proxy_str_context(), proxy_str_event(), t_client_info::res_time, and shard_shm_get_client_info().
Referenced by fn_proxy_cas_end_tran(), fn_proxy_client_close_req_handle(), fn_proxy_client_con_close(), fn_proxy_client_cursor_close(), fn_proxy_client_end_tran(), fn_proxy_client_get_db_version(), and fn_proxy_get_shard_info().
|
static |
Definition at line 65 of file shard_proxy_function.c.
References t_proxy_context::wait_timeout.
Referenced by fn_proxy_client_prepare_and_execute(), and proxy_client_execute_internal().
|
static |
Definition at line 434 of file shard_proxy_function.c.
References sp_parser_hint::arg, assert, sp_parser_hint::hint_type, HT_ID, HT_KEY, sp_value::integer, t_shard_key_range::key_index, MAX_SHARD_CONN, NULL, t_shm_shard_conn_stat::num_hint_id_queries_requested, t_shm_shard_conn_stat::num_hint_key_queries_requested, t_shm_shard_key_range_stat::num_range_queries_requested, t_proxy_info::num_shard_conn, t_shard_stmt::parser, t_proxy_info::proxy_id, PROXY_INVALID_SHARD, PROXY_LOG, PROXY_LOG_MODE_ERROR, t_shard_key_range::range_index, t_shard_key_range::shard_id, shard_shm_get_key_stat(), shard_shm_get_shard_stat(), sp_get_first_hint(), t_shm_shard_key_stat::stat, sp_value::type, and VT_INTEGER.
Referenced by fn_proxy_client_prepare_and_execute(), and proxy_client_execute_internal().
|
static |
Definition at line 549 of file shard_proxy_function.c.
References assert, NULL, t_shm_shard_conn_stat::num_no_hint_queries_requested, PROXY_LOG, PROXY_LOG_MODE_ERROR, and shard_shm_get_shard_stat().
Referenced by fn_proxy_client_prepare_and_execute(), and proxy_client_execute_internal().
T_PROXY_CONTEXT proxy_Context |
Definition at line 55 of file shard_proxy_handler.c.
T_PROXY_HANDLER proxy_Handler |
Definition at line 54 of file shard_proxy_handler.c.
T_PROXY_INFO* proxy_info_p |
Definition at line 48 of file shard_proxy.c.
T_SHM_SHARD_KEY* shm_key_p |
Definition at line 51 of file shard_proxy.c.