File server_support.c
FileList > connection > server_support.c
Go to the source code of this file
#include "server_support.h"
#include "config.h"
#include "load_worker_manager.hpp"
#include "log_append.hpp"
#include "session.h"
#include "thread_entry_task.hpp"
#include "thread_entry.hpp"
#include "thread_manager.hpp"
#include "master_connector.hpp"
#include "connection_pool.hpp"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <assert.h>
#include "porting.h"
#include "memory_alloc.h"
#include "boot_sr.h"
#include "connection_defs.h"
#include "connection_globals.h"
#include "release_string.h"
#include "system_parameter.h"
#include "environment_variable.h"
#include "error_manager.h"
#include "connection_error.h"
#include "message_catalog.h"
#include "critical_section.h"
#include "lock_manager.h"
#include "log_lsa.hpp"
#include "log_manager.h"
#include "network.h"
#include "object_representation.h"
#include "pl_sr.h"
#include "show_scan.h"
#include "tcp.h"
#include "connection_sr.h"
#include "xserver_interface.h"
#include "utility.h"
#include "vacuum.h"
#include "heartbeat.h"
#include "dbtype.h"
#include "memory_wrapper.hpp"
Classes
Public Types
Public Static Attributes
Public Functions
| Type |
Name |
|
REGISTER_WORKERPOOL (transaction, () { return(int) prm_get_integer_value(PRM_ID_TASK_WORKER);})
|
| char * |
css_add_client_version_string (THREAD_ENTRY * thread_p, const char * version_string)
|
| bool |
css_are_all_request_handlers_suspended (void)
|
| void |
css_block_all_active_conn (unsigned short stop_phase)
|
| int |
css_change_ha_server_state (THREAD_ENTRY * thread_p, HA_SERVER_STATE state, bool force, int timeout, bool heartbeat)
|
| int |
css_check_accessibility (SOCKET new_fd)
|
| int |
css_check_conn (CSS_CONN_ENTRY * p)
|
| int |
css_check_ha_server_state_for_client (THREAD_ENTRY * thread_p, int whence)
|
| void |
css_cleanup_server_queues (unsigned int eid)
|
| size_t |
css_count_transaction_worker_threads (THREAD_ENTRY * thread_p, int tran_index, int client_id)
|
| void |
css_end_server_request (CSS_CONN_ENTRY * conn)
|
| int |
css_free_accessible_ip_info (void)
|
| int |
css_get_client_id (THREAD_ENTRY * thread_p)
|
| char * |
css_get_client_version_string (void)
|
| unsigned int |
css_get_comm_request_id (THREAD_ENTRY * thread_p)
|
| CSS_CONN_ENTRY * |
css_get_current_conn_entry (void)
|
| int |
css_get_ha_num_of_hosts (void)
|
| size_t |
css_get_max_connections ()
|
| size_t |
css_get_max_task_count ()
|
| size_t |
css_get_max_workers ()
|
| size_t |
css_get_num_request_workers (void)
|
| struct timeval * |
css_get_shutdown_timeout (void)
|
| void |
css_get_task_stats (UINT64 * stats_out)
|
| void |
css_get_thread_stats (UINT64 * stats_out)
|
| HA_SERVER_STATE |
css_ha_server_state (void)
|
| int |
css_init (THREAD_ENTRY * thread_p, char * server_name, int name_length, int port_id)
|
| void |
css_initialize_server_interfaces (int(*)(THREAD_ENTRY *thrd, unsigned int eid, int request, int size, char *buffer) request_handler)
|
| bool |
css_is_ha_repl_delayed (void)
|
| bool |
css_is_shutdown_timeout_expired (void)
|
| bool |
css_is_shutdowning_server ()
|
| int |
css_job_queues_start_scan (THREAD_ENTRY * thread_p, int show_type, DB_VALUE ** arg_values, int arg_cnt, void ** ptr)
|
| int |
css_notify_ha_log_applier_state (THREAD_ENTRY * thread_p, HA_LOG_APPLIER_STATE state)
|
| char * |
css_pack_server_name (const char * server_name, int * name_length)
|
| void |
css_push_external_task (CSS_CONN_ENTRY * conn, cubthread::entry_task * task)
|
| void |
css_push_server_task (CSS_CONN_ENTRY & conn_ref)
|
| unsigned int |
css_receive_data_from_client (CSS_CONN_ENTRY * conn, unsigned int eid, char ** buffer, int * size)
|
| unsigned int |
css_receive_data_from_client_with_timeout (CSS_CONN_ENTRY * conn, unsigned int eid, char ** buffer, int * size, int timeout)
|
| unsigned int |
css_send_abort_to_client (CSS_CONN_ENTRY * conn, unsigned int eid)
|
| unsigned int |
css_send_data_to_client (CSS_CONN_ENTRY * conn, unsigned int eid, char * buffer, int buffer_size, int wait_time)
|
| unsigned int |
css_send_error_to_client (CSS_CONN_ENTRY * conn, unsigned int eid, char * buffer, int buffer_size)
|
| unsigned int |
css_send_reply_and_2_data_to_client (CSS_CONN_ENTRY * conn, unsigned int eid, char * reply, int reply_size, char * buffer1, int buffer1_size, char * buffer2, int buffer2_size, std::function< void() > && deleter)
|
| unsigned int |
css_send_reply_and_3_data_to_client (CSS_CONN_ENTRY * conn, unsigned int eid, char * reply, int reply_size, char * buffer1, int buffer1_size, char * buffer2, int buffer2_size, char * buffer3, int buffer3_size, std::function< void() > && deleter)
|
| unsigned int |
css_send_reply_and_data_to_client (CSS_CONN_ENTRY * conn, unsigned int eid, char * reply, int reply_size, char * buffer, int buffer_size, std::function< void() > && deleter)
|
| unsigned int |
css_send_reply_and_data_to_client_direct (CSS_CONN_ENTRY * conn, unsigned int eid, char * reply, int reply_size, char * buffer, int buffer_size)
|
| int |
css_set_accessible_ip_info (void)
|
| void |
css_set_ha_num_of_hosts (int num)
|
| void |
css_set_ha_repl_delayed (void)
|
| void |
css_set_thread_info (THREAD_ENTRY * thread_p, int client_id, int rid, int tran_index, int net_request_index)
|
| void |
css_start_shutdown_server ()
|
| void |
css_unset_ha_repl_delayed (void)
|
| void |
xacl_dump (THREAD_ENTRY * thread_p, FILE * outfp)
|
| int |
xacl_reload (THREAD_ENTRY * thread_p)
|
Public Static Functions
| Type |
Name |
| bool |
css_check_ha_log_applier_done (void)
|
| bool |
css_check_ha_log_applier_working (void)
|
| void |
css_count_transaction_worker_threads_mapfunc (THREAD_ENTRY & thread_ref, bool & stop_mapper, THREAD_ENTRY * caller_thread, int tran_index, int client_id, size_t & count)
|
| unsigned int |
css_enqueue_and_notify (cubconn::connection::worker::queue_type type, cubconn::connection::worker::message && item, int wait_time=0)
|
| void |
css_find_not_stopped (THREAD_ENTRY & thread_ref, bool & stop, bool is_log_writer, bool & found)
|
| int |
css_get_master_request (SOCKET master_fd)
|
| bool |
css_get_server_request_thread_pooling_configuration (void)
|
| cubthread::wait_seconds |
css_get_server_request_thread_timeout_configuration (void)
|
| int |
css_internal_request_handler (THREAD_ENTRY & thread_ref, CSS_CONN_ENTRY & conn_ref)
|
| void |
css_is_any_thread_not_suspended_mapfunc (THREAD_ENTRY & thread_ref, bool & stop_mapper, size_t & count, bool & found)
|
| bool |
css_is_log_writer (const THREAD_ENTRY & thread_arg)
|
| void |
css_process_shutdown_request (SOCKET master_fd)
|
| void |
css_set_shutdown_timeout (int timeout)
|
| void |
css_start_all_threads (void)
|
| void |
css_stop_all_workers (THREAD_ENTRY & thread_ref, css_thread_stop_type stop_phase)
|
| void |
css_stop_log_writer (THREAD_ENTRY & thread_ref, bool & stop_mapper)
|
| void |
css_stop_non_log_writer (THREAD_ENTRY & thread_ref, bool & stop_mapper, THREAD_ENTRY & stopper_thread_ref)
|
| int |
css_test_for_client_errors (CSS_CONN_ENTRY * conn, unsigned int eid)
|
| HA_SERVER_STATE |
css_transit_ha_server_state (THREAD_ENTRY * thread_p, HA_SERVER_STATE req_state)
|
| void |
css_wp_core_job_scan_mapper (const cubthread::stats_worker_pool_type::core_impl & wp_core, bool & stop_mapper, THREAD_ENTRY * thread_p, SHOWSTMT_ARRAY_CONTEXT * ctx, size_t & core_index, int & error_code)
|
| void |
css_wp_worker_get_busy_count_mapper (THREAD_ENTRY & thread_ref, bool & stop_mapper, int & busy_count)
|
Macros
Public Types Documentation
typedef HA_LOG_APPLIER_STATE_TABLE
typedef struct ha_log_applier_state_table HA_LOG_APPLIER_STATE_TABLE;
Public Static Attributes Documentation
variable CSS_JOB_QUEUE_SCAN_COLUMN_COUNT
const size_t CSS_JOB_QUEUE_SCAN_COLUMN_COUNT;
variable css_Master_conn
CSS_CONN_ENTRY* css_Master_conn;
variable css_Master_port_id
variable css_Master_server_name
char* css_Master_server_name;
variable css_Server_accessible_ip_info
IP_INFO* css_Server_accessible_ip_info;
variable css_Server_request_handler
int(* css_Server_request_handler) (THREAD_ENTRY *, unsigned int, int, int, char *);
variable css_Server_request_worker_pool
cubthread::stats_worker_pool_type* css_Server_request_worker_pool;
variable css_Server_shutdown_inited
bool css_Server_shutdown_inited;
variable css_Shutdown_timeout
struct timeval css_Shutdown_timeout;
variable ha_Log_applier_state
HA_LOG_APPLIER_STATE_TABLE ha_Log_applier_state[5];
variable ha_Log_applier_state_num
int ha_Log_applier_state_num;
variable ha_Repl_delay_detected
bool ha_Repl_delay_detected;
variable ha_Server_num_of_hosts
int ha_Server_num_of_hosts;
variable ha_Server_state
HA_SERVER_STATE ha_Server_state;
variable ip_file_real_path
char ip_file_real_path[PATH_MAX];
variable ip_list_file_name
Public Functions Documentation
function REGISTER_WORKERPOOL
REGISTER_WORKERPOOL (
transaction,
() { return ( int ) prm_get_integer_value ( PRM_ID_TASK_WORKER );}
)
function css_add_client_version_string
char * css_add_client_version_string (
THREAD_ENTRY * thread_p,
const char * version_string
)
function css_are_all_request_handlers_suspended
bool css_are_all_request_handlers_suspended (
void
)
function css_block_all_active_conn
void css_block_all_active_conn (
unsigned short stop_phase
)
function css_change_ha_server_state
int css_change_ha_server_state (
THREAD_ENTRY * thread_p,
HA_SERVER_STATE state,
bool force,
int timeout,
bool heartbeat
)
function css_check_accessibility
int css_check_accessibility (
SOCKET new_fd
)
function css_check_conn
int css_check_conn (
CSS_CONN_ENTRY * p
)
function css_check_ha_server_state_for_client
int css_check_ha_server_state_for_client (
THREAD_ENTRY * thread_p,
int whence
)
function css_cleanup_server_queues
void css_cleanup_server_queues (
unsigned int eid
)
function css_count_transaction_worker_threads
size_t css_count_transaction_worker_threads (
THREAD_ENTRY * thread_p,
int tran_index,
int client_id
)
function css_end_server_request
void css_end_server_request (
CSS_CONN_ENTRY * conn
)
function css_free_accessible_ip_info
int css_free_accessible_ip_info (
void
)
function css_get_client_id
int css_get_client_id (
THREAD_ENTRY * thread_p
)
function css_get_client_version_string
char * css_get_client_version_string (
void
)
function css_get_comm_request_id
unsigned int css_get_comm_request_id (
THREAD_ENTRY * thread_p
)
function css_get_current_conn_entry
CSS_CONN_ENTRY * css_get_current_conn_entry (
void
)
function css_get_ha_num_of_hosts
int css_get_ha_num_of_hosts (
void
)
function css_get_max_connections
size_t css_get_max_connections ()
function css_get_max_task_count
size_t css_get_max_task_count ()
function css_get_max_workers
size_t css_get_max_workers ()
function css_get_num_request_workers
size_t css_get_num_request_workers (
void
)
function css_get_shutdown_timeout
struct timeval * css_get_shutdown_timeout (
void
)
function css_get_task_stats
void css_get_task_stats (
UINT64 * stats_out
)
function css_get_thread_stats
void css_get_thread_stats (
UINT64 * stats_out
)
function css_ha_server_state
HA_SERVER_STATE css_ha_server_state (
void
)
function css_init
int css_init (
THREAD_ENTRY * thread_p,
char * server_name,
int name_length,
int port_id
)
function css_initialize_server_interfaces
void css_initialize_server_interfaces (
int (*)( THREAD_ENTRY *thrd, unsigned int eid , int request, int size, char *buffer) request_handler
)
function css_is_ha_repl_delayed
bool css_is_ha_repl_delayed (
void
)
function css_is_shutdown_timeout_expired
bool css_is_shutdown_timeout_expired (
void
)
function css_is_shutdowning_server
bool css_is_shutdowning_server ()
function css_job_queues_start_scan
int css_job_queues_start_scan (
THREAD_ENTRY * thread_p,
int show_type,
DB_VALUE ** arg_values,
int arg_cnt,
void ** ptr
)
function css_notify_ha_log_applier_state
int css_notify_ha_log_applier_state (
THREAD_ENTRY * thread_p,
HA_LOG_APPLIER_STATE state
)
function css_pack_server_name
char * css_pack_server_name (
const char * server_name,
int * name_length
)
function css_push_external_task
void css_push_external_task (
CSS_CONN_ENTRY * conn,
cubthread::entry_task * task
)
function css_push_server_task
void css_push_server_task (
CSS_CONN_ENTRY & conn_ref
)
function css_receive_data_from_client
unsigned int css_receive_data_from_client (
CSS_CONN_ENTRY * conn,
unsigned int eid,
char ** buffer,
int * size
)
function css_receive_data_from_client_with_timeout
unsigned int css_receive_data_from_client_with_timeout (
CSS_CONN_ENTRY * conn,
unsigned int eid,
char ** buffer,
int * size,
int timeout
)
function css_send_abort_to_client
unsigned int css_send_abort_to_client (
CSS_CONN_ENTRY * conn,
unsigned int eid
)
function css_send_data_to_client
unsigned int css_send_data_to_client (
CSS_CONN_ENTRY * conn,
unsigned int eid,
char * buffer,
int buffer_size,
int wait_time
)
function css_send_error_to_client
unsigned int css_send_error_to_client (
CSS_CONN_ENTRY * conn,
unsigned int eid,
char * buffer,
int buffer_size
)
function css_send_reply_and_2_data_to_client
unsigned int css_send_reply_and_2_data_to_client (
CSS_CONN_ENTRY * conn,
unsigned int eid,
char * reply,
int reply_size,
char * buffer1,
int buffer1_size,
char * buffer2,
int buffer2_size,
std::function< void () > && deleter
)
function css_send_reply_and_3_data_to_client
unsigned int css_send_reply_and_3_data_to_client (
CSS_CONN_ENTRY * conn,
unsigned int eid,
char * reply,
int reply_size,
char * buffer1,
int buffer1_size,
char * buffer2,
int buffer2_size,
char * buffer3,
int buffer3_size,
std::function< void () > && deleter
)
function css_send_reply_and_data_to_client
unsigned int css_send_reply_and_data_to_client (
CSS_CONN_ENTRY * conn,
unsigned int eid,
char * reply,
int reply_size,
char * buffer,
int buffer_size,
std::function< void () > && deleter
)
function css_send_reply_and_data_to_client_direct
unsigned int css_send_reply_and_data_to_client_direct (
CSS_CONN_ENTRY * conn,
unsigned int eid,
char * reply,
int reply_size,
char * buffer,
int buffer_size
)
function css_set_accessible_ip_info
int css_set_accessible_ip_info (
void
)
function css_set_ha_num_of_hosts
void css_set_ha_num_of_hosts (
int num
)
function css_set_ha_repl_delayed
void css_set_ha_repl_delayed (
void
)
function css_set_thread_info
void css_set_thread_info (
THREAD_ENTRY * thread_p,
int client_id,
int rid,
int tran_index,
int net_request_index
)
function css_start_shutdown_server
void css_start_shutdown_server ()
function css_unset_ha_repl_delayed
void css_unset_ha_repl_delayed (
void
)
function xacl_dump
void xacl_dump (
THREAD_ENTRY * thread_p,
FILE * outfp
)
function xacl_reload
int xacl_reload (
THREAD_ENTRY * thread_p
)
Public Static Functions Documentation
function css_check_ha_log_applier_done
static bool css_check_ha_log_applier_done (
void
)
function css_check_ha_log_applier_working
static bool css_check_ha_log_applier_working (
void
)
function css_count_transaction_worker_threads_mapfunc
static void css_count_transaction_worker_threads_mapfunc (
THREAD_ENTRY & thread_ref,
bool & stop_mapper,
THREAD_ENTRY * caller_thread,
int tran_index,
int client_id,
size_t & count
)
function css_enqueue_and_notify
static unsigned int css_enqueue_and_notify (
cubconn::connection::worker::queue_type type,
cubconn::connection::worker::message && item,
int wait_time=0
)
function css_find_not_stopped
static void css_find_not_stopped (
THREAD_ENTRY & thread_ref,
bool & stop,
bool is_log_writer,
bool & found
)
function css_get_master_request
static int css_get_master_request (
SOCKET master_fd
)
function css_get_server_request_thread_pooling_configuration
static bool css_get_server_request_thread_pooling_configuration (
void
)
function css_get_server_request_thread_timeout_configuration
static cubthread::wait_seconds css_get_server_request_thread_timeout_configuration (
void
)
function css_internal_request_handler
static int css_internal_request_handler (
THREAD_ENTRY & thread_ref,
CSS_CONN_ENTRY & conn_ref
)
function css_is_any_thread_not_suspended_mapfunc
static void css_is_any_thread_not_suspended_mapfunc (
THREAD_ENTRY & thread_ref,
bool & stop_mapper,
size_t & count,
bool & found
)
function css_is_log_writer
static bool css_is_log_writer (
const THREAD_ENTRY & thread_arg
)
function css_process_shutdown_request
static void css_process_shutdown_request (
SOCKET master_fd
)
function css_set_shutdown_timeout
static void css_set_shutdown_timeout (
int timeout
)
function css_start_all_threads
static void css_start_all_threads (
void
)
function css_stop_all_workers
static void css_stop_all_workers (
THREAD_ENTRY & thread_ref,
css_thread_stop_type stop_phase
)
function css_stop_log_writer
static void css_stop_log_writer (
THREAD_ENTRY & thread_ref,
bool & stop_mapper
)
function css_stop_non_log_writer
static void css_stop_non_log_writer (
THREAD_ENTRY & thread_ref,
bool & stop_mapper,
THREAD_ENTRY & stopper_thread_ref
)
function css_test_for_client_errors
static int css_test_for_client_errors (
CSS_CONN_ENTRY * conn,
unsigned int eid
)
function css_transit_ha_server_state
static HA_SERVER_STATE css_transit_ha_server_state (
THREAD_ENTRY * thread_p,
HA_SERVER_STATE req_state
)
function css_wp_core_job_scan_mapper
static void css_wp_core_job_scan_mapper (
const cubthread::stats_worker_pool_type::core_impl & wp_core,
bool & stop_mapper,
THREAD_ENTRY * thread_p,
SHOWSTMT_ARRAY_CONTEXT * ctx,
size_t & core_index,
int & error_code
)
function css_wp_worker_get_busy_count_mapper
static void css_wp_worker_get_busy_count_mapper (
THREAD_ENTRY & thread_ref,
bool & stop_mapper,
int & busy_count
)
Macro Definition Documentation
#define CSS_GOING_DOWN_IMMEDIATELY `"Server going down immediately"`
define CSS_WAIT_COUNT
#define CSS_WAIT_COUNT `5 /* # of retry to connect to master */`
define FROM_OTHERS
define FROM_REGISTER_CLIENT
#define FROM_REGISTER_CLIENT `1`
define FROM_UNREGISTER_CLIENT
#define FROM_UNREGISTER_CLIENT `2`
define HA_LOG_APPLIER_STATE_TABLE_MAX
#define HA_LOG_APPLIER_STATE_TABLE_MAX `5`
define MAX_CONNECTIONS
#define MAX_CONNECTIONS `css_get_max_connections ()`
define MAX_TASK_COUNT
#define MAX_TASK_COUNT `css_get_max_task_count ()`
define MAX_WORKERS
#define MAX_WORKERS `css_get_max_workers ()`
define RMUTEX_NAME_TEMP_CONN_ENTRY
#define RMUTEX_NAME_TEMP_CONN_ENTRY `"TEMP_CONN_ENTRY"`
define SockError
The documentation for this class was generated from the following file cubrid/src/connection/server_support.c