CUBRID Engine
latest
|
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include "area_alloc.h"
#include "set_object.h"
#include "work_space.h"
Go to the source code of this file.
Macros | |
#define | pthread_mutex_init(a, b) |
#define | pthread_mutex_destroy(a) |
#define | pthread_mutex_lock(a) 0 |
#define | pthread_mutex_unlock(a) |
#define | AREA_PREFIX_SIZE sizeof(double) |
#define | LF_AREA_BITMAP_USAGE_RATIO LF_BITMAP_FULL_USAGE_RATIO |
#define | VOLATILE_ACCESS(v, t) (*((t volatile *) &(v))) |
#define | ER_AREA_ALREADY_STARTED ER_GENERIC_ERROR |
Enumerations | |
enum | { AREA_PREFIX_INITED = 0, AREA_PREFIX_FREED = 0x01010101 } |
Functions | |
static void | area_info (AREA *area, FILE *fp) |
static AREA_BLOCK * | area_alloc_block (AREA *area) |
static AREA_BLOCKSET_LIST * | area_alloc_blockset (AREA *area) |
static int | area_insert_block (AREA *area, AREA_BLOCK *new_block) |
static AREA_BLOCK * | area_find_block (AREA *area, const void *ptr) |
void | area_init (void) |
void | area_final (void) |
AREA * | area_create (const char *name, size_t element_size, size_t alloc_count) |
void | area_destroy (AREA *area) |
void * | area_alloc (AREA *area) |
int | area_validate (AREA *area, const void *address) |
int | area_free (AREA *area, void *ptr) |
void | area_flush (AREA *area) |
void | area_dump (FILE *fp) |
Variables | |
static int | rv |
static AREA * | area_List = NULL |
#define AREA_PREFIX_SIZE sizeof(double) |
Definition at line 59 of file area_alloc.c.
Referenced by area_alloc(), area_create(), area_free(), and area_info().
#define ER_AREA_ALREADY_STARTED ER_GENERIC_ERROR |
Referenced by area_init().
#define LF_AREA_BITMAP_USAGE_RATIO LF_BITMAP_FULL_USAGE_RATIO |
Definition at line 79 of file area_alloc.c.
Referenced by area_alloc_block().
#define pthread_mutex_destroy | ( | a | ) |
Definition at line 49 of file area_alloc.c.
Referenced by area_final(), area_flush(), broker_destroy_proxy_conn(), cubthread::entry::clear_resources(), csect_finalize_critical_section(), disk_cache_final(), file_tempcache_final(), file_tempcache_init(), fpcache_entry_free(), lock_finalize(), os_send_signal(), perfmon_finalize(), rmutex_finalize(), rwlock_finalize(), sort_return_used_resources(), sync_finalize_sync_stats(), vacuum_finalize(), xcache_entry_free(), xentry_free(), fpcache_ent::~fpcache_ent(), and xasl_cache_ent::~xasl_cache_ent().
#define pthread_mutex_init | ( | a, | |
b | |||
) |
Definition at line 48 of file area_alloc.c.
Referenced by area_create(), broker_init_proxy_conn(), csect_initialize_critical_section(), css_master_init(), disk_cache_init(), cubthread::entry::entry(), file_tempcache_init(), fpcache_ent::fpcache_ent(), fpcache_entry_alloc(), hb_cluster_initialize(), hb_cluster_job_initialize(), hb_resource_initialize(), hb_resource_job_initialize(), main(), os_send_signal(), perfmon_initialize(), rmutex_initialize(), rwlock_initialize(), sort_listfile(), sync_initialize_sync_stats(), vacuum_initialize(), xasl_cache_ent::xasl_cache_ent(), xcache_entry_alloc(), and xentry_alloc().
#define pthread_mutex_lock | ( | a | ) | 0 |
Definition at line 50 of file area_alloc.c.
Referenced by area_alloc(), area_create(), area_destroy(), area_dump(), broker_add_new_cas(), broker_add_proxy_conn(), broker_delete_proxy_conn_by_fd(), broker_delete_proxy_conn_by_proxy_id(), broker_destroy_proxy_conn(), broker_drop_one_cas_by_time_to_kill(), broker_find_available_proxy(), broker_get_proxy_conn_maxfd(), broker_get_readable_proxy_conn(), broker_register_proxy_conn(), broker_set_proxy_fds(), csect_check_own_critical_section(), csect_demote_critical_section(), csect_enter_critical_section(), csect_enter_critical_section_as_reader(), csect_exit_critical_section(), csect_promote_critical_section(), css_check_master_socket_exception(), css_check_master_socket_input(), css_connection_handler_thread(), css_count_transaction_worker_threads_mapfunc(), css_decrement_num_conn(), css_get_next_client_id(), css_hostname_to_ip(), css_increment_num_conn(), css_master_select_error(), css_master_timeout(), css_sockaddr(), disk_cache_lock_reserve(), disk_lock_extend(), dispatch_thr_f(), css_server_task::execute(), css_server_external_task::execute(), css_connection_task::execute(), file_tempcache_retire_entry(), find_add_as_index(), find_drop_as_index(), find_idle_cas(), hb_check_request_eligibility(), hb_cleanup_conn_and_start_process(), hb_cluster_cleanup(), hb_cluster_initialize(), hb_cluster_job_calc_score(), hb_cluster_job_check_ping(), hb_cluster_job_check_valid_ping_server(), hb_cluster_job_demote(), hb_cluster_job_failback(), hb_cluster_job_failover(), hb_cluster_job_heartbeat(), hb_cluster_job_initialize(), hb_cluster_receive_heartbeat(), hb_deregister_by_args(), hb_deregister_by_pid(), hb_disable_er_log(), hb_enable_er_log(), hb_get_admin_info_string(), hb_get_node_info_string(), hb_get_ping_host_info_string(), hb_get_process_info_string(), hb_help_sprint_jobs_info(), hb_hostname_to_sin_addr(), hb_is_deactivation_ready(), hb_is_hang_process(), hb_is_registered_process(), hb_job_dequeue(), hb_job_queue(), hb_job_set_expire_and_reorder(), hb_job_shutdown(), hb_kill_all_heartbeat_process(), hb_prepare_deactivate_heartbeat(), hb_register_new_process(), hb_reload_config(), hb_resource_cleanup(), hb_resource_initialize(), hb_resource_job_change_mode(), hb_resource_job_cleanup_all(), hb_resource_job_confirm_cleanup_all(), hb_resource_job_confirm_dereg(), hb_resource_job_confirm_start(), hb_resource_job_demote_confirm_shutdown(), hb_resource_job_demote_start_shutdown(), hb_resource_job_initialize(), hb_resource_job_proc_dereg(), hb_resource_job_proc_start(), hb_resource_receive_changemode(), hb_resource_receive_get_eof(), hb_return_proc_state_by_fd(), hb_start_util_process(), hb_thread_check_disk_failure(), cubthread::entry::lock(), lock_clear_deadlock_victim(), lock_demote_class_lock(), lock_detect_local_deadlock(), lockfree::hashmap< Key, T >::lock_entry_mutex(), lock_get_class_lock(), lock_get_lock_holder_tran_index(), lock_get_object_lock(), lock_has_lock_on_object(), lock_has_xlock(), lock_notify_isolation_incons(), lock_unlock_all_shared_get_all_exclusive(), lock_wait_state_to_string(), logwr_log_ha_filestat_to_string(), parser_allocate_string_buffer(), parser_create_node(), parser_create_node_block(), parser_create_parser(), parser_create_string_block(), parser_free_node(), perfmon_finalize(), pt_find_string_block(), pt_free_a_string_block(), pt_free_node_blocks(), pt_free_string_blocks(), pt_register_parser(), pt_unregister_parser(), px_sort_assign(), px_sort_myself(), receiver_thr_f(), rmutex_dump_statistics(), rmutex_lock(), run_appl_server(), run_proxy_server(), rwlock_dump_statistics(), rwlock_read_lock(), rwlock_read_unlock(), rwlock_write_lock(), shard_dispatch_thr_f(), sort_inphase_sort(), sync_allocate_sync_stats(), sync_deallocate_sync_stats(), thread_suspend_with_other_mutex(), tp_domain_cache(), vacuum_notify_all_workers_dropped_file(), xcache_find_xasl_id_for_execute(), and xcache_retire_clone().
#define pthread_mutex_unlock | ( | a | ) |
Definition at line 51 of file area_alloc.c.
Referenced by area_alloc(), area_create(), area_destroy(), area_dump(), broker_add_new_cas(), broker_add_proxy_conn(), broker_delete_proxy_conn_by_fd(), broker_delete_proxy_conn_by_proxy_id(), broker_destroy_proxy_conn(), broker_drop_one_cas_by_time_to_kill(), broker_find_available_proxy(), broker_get_proxy_conn_maxfd(), broker_get_readable_proxy_conn(), broker_register_proxy_conn(), broker_set_proxy_fds(), csect_check_own_critical_section(), csect_demote_critical_section(), csect_enter_critical_section(), csect_enter_critical_section_as_reader(), csect_exit_critical_section(), csect_promote_critical_section(), css_check_master_socket_exception(), css_check_master_socket_input(), css_connection_handler_thread(), css_count_transaction_worker_threads_mapfunc(), css_decrement_num_conn(), css_get_next_client_id(), css_hostname_to_ip(), css_increment_num_conn(), css_internal_request_handler(), css_master_select_error(), css_master_timeout(), css_sockaddr(), disk_cache_unlock_reserve(), disk_unlock_extend(), dispatch_thr_f(), lf_hash_table_cpp< Key, T >::erase_locked(), file_tempcache_unlock(), find_add_as_index(), find_drop_as_index(), find_idle_cas(), fpcache_claim(), fpcache_remove_by_class(), fpcache_retire(), hb_check_request_eligibility(), hb_cleanup_conn_and_start_process(), hb_cluster_cleanup(), hb_cluster_initialize(), hb_cluster_job_calc_score(), hb_cluster_job_check_ping(), hb_cluster_job_check_valid_ping_server(), hb_cluster_job_demote(), hb_cluster_job_failback(), hb_cluster_job_failover(), hb_cluster_job_heartbeat(), hb_cluster_job_initialize(), hb_cluster_receive_heartbeat(), hb_deregister_by_args(), hb_deregister_by_pid(), hb_disable_er_log(), hb_enable_er_log(), hb_get_admin_info_string(), hb_get_node_info_string(), hb_get_ping_host_info_string(), hb_get_process_info_string(), hb_help_sprint_jobs_info(), hb_hostname_to_sin_addr(), hb_is_deactivation_ready(), hb_is_hang_process(), hb_is_registered_process(), hb_job_dequeue(), hb_job_queue(), hb_job_set_expire_and_reorder(), hb_job_shutdown(), hb_kill_all_heartbeat_process(), hb_prepare_deactivate_heartbeat(), hb_register_new_process(), hb_reload_config(), hb_resource_cleanup(), hb_resource_initialize(), hb_resource_job_change_mode(), hb_resource_job_cleanup_all(), hb_resource_job_confirm_cleanup_all(), hb_resource_job_confirm_dereg(), hb_resource_job_confirm_start(), hb_resource_job_demote_confirm_shutdown(), hb_resource_job_demote_start_shutdown(), hb_resource_job_initialize(), hb_resource_job_proc_dereg(), hb_resource_job_proc_start(), hb_resource_receive_changemode(), hb_resource_receive_get_eof(), hb_return_proc_state_by_fd(), hb_start_util_process(), hb_thread_check_disk_failure(), lock_clear_deadlock_victim(), lock_demote_class_lock(), lock_detect_local_deadlock(), lock_find_tran_hold_entry(), lock_get_class_lock(), lock_get_lock_holder_tran_index(), lock_get_object_lock(), lock_has_lock_on_object(), lock_has_xlock(), lock_notify_isolation_incons(), lock_unlock_all_shared_get_all_exclusive(), lock_wait_state_to_string(), logwr_log_ha_filestat_to_string(), net_server_conn_down(), parser_allocate_string_buffer(), parser_create_node(), parser_create_node_block(), parser_create_parser(), parser_create_string_block(), parser_free_node(), perfmon_finalize(), pt_find_string_block(), pt_free_a_string_block(), pt_free_node_blocks(), pt_free_string_blocks(), pt_register_parser(), pt_unregister_parser(), px_sort_assign(), px_sort_myself(), receiver_thr_f(), rmutex_dump_statistics(), rmutex_unlock(), run_appl_server(), run_proxy_server(), rwlock_dump_statistics(), rwlock_read_lock(), rwlock_read_unlock(), rwlock_write_unlock(), shard_dispatch_thr_f(), sort_inphase_sort(), sync_allocate_sync_stats(), sync_deallocate_sync_stats(), thread_suspend_timeout_wakeup_and_unlock_entry(), thread_suspend_wakeup_and_unlock_entry(), thread_suspend_with_other_mutex(), tp_domain_cache(), cubthread::entry::unlock(), lf_hash_table_cpp< Key, T >::unlock(), lockfree::hashmap< Key, T >::unlock_entry_mutex_force(), lockfree::hashmap< Key, T >::unlock_entry_mutex_if_locked(), vacuum_notify_all_workers_dropped_file(), xcache_find_xasl_id_for_execute(), and xcache_retire_clone().
#define VOLATILE_ACCESS | ( | v, | |
t | |||
) | (*((t volatile *) &(v))) |
Definition at line 85 of file area_alloc.c.
Referenced by area_alloc(), area_find_block(), area_free(), lf_freelist_alloc_block(), lf_freelist_transport(), lf_hash_clear(), lf_hash_iterate(), lf_tran_start(), log_change_tran_as_completed(), logtb_get_new_tran_id(), and test_freelist().
anonymous enum |
Enumerator | |
---|---|
AREA_PREFIX_INITED | |
AREA_PREFIX_FREED |
Definition at line 61 of file area_alloc.c.
void* area_alloc | ( | AREA * | area | ) |
Definition at line 360 of file area_alloc.c.
References area_alloc_block(), area_insert_block(), area::area_mutex, AREA_PREFIX_INITED, AREA_PREFIX_SIZE, assert, area_block::bitmap, area::block_size, area::blockset_list, area_block::data, lockfree::bitmap::destroy(), area::element_size, free_and_init, lockfree::bitmap::get_entry(), area::hint_block, i, area_blockset_list::items, LF_BITMAP_IS_FULL, area::n_allocs, area_blockset_list::next, NO_ERROR, NULL, pthread_mutex_lock, pthread_mutex_unlock, rv, area_blockset_list::used_count, and VOLATILE_ACCESS.
Referenced by classobj_make_template(), col_new(), make_template(), ml_ext_add(), ml_ext_alloc_link(), obt_make_assignment(), pr_make_ext_value(), set_make_reference(), test_area_proc(), test_area_proc_1(), test_area_proc_2(), and tp_domain_new().
|
static |
Definition at line 291 of file area_alloc.c.
References area::alloc_count, ARG_FILE_LINE, assert, area_block::bitmap, area::block_size, area_block::data, lockfree::bitmap::entry_count, ER_ERROR_SEVERITY, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), area::failure_function, lockfree::bitmap::init(), LF_AREA_BITMAP_USAGE_RATIO, LF_BITMAP_LIST_OF_CHUNKS, new_block(), and NULL.
Referenced by area_alloc(), and area_create().
|
static |
Definition at line 327 of file area_alloc.c.
References AREA_BLOCKSET_SIZE, ARG_FILE_LINE, ER_ERROR_SEVERITY, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), area::failure_function, area_blockset_list::items, area_blockset_list::next, NULL, and area_blockset_list::used_count.
Referenced by area_create(), and area_insert_block().
Definition at line 146 of file area_alloc.c.
References area::alloc_count, area_alloc_block(), area_alloc_blockset(), area_List, area::area_mutex, AREA_PREFIX_SIZE, ARG_FILE_LINE, area::block_size, area::blockset_list, area::element_size, ER_ERROR_SEVERITY, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), error(), area::failure_function, free_and_init, area::hint_block, area_blockset_list::items, LF_BITMAP_COUNT_ALIGN, area::n_allocs, area::n_frees, area::name, area::next, NULL, pthread_mutex_init, pthread_mutex_lock, pthread_mutex_unlock, rv, strdup(), strlen, area_blockset_list::used_count, and ws_abort_transaction().
Referenced by classobj_area_init(), obt_area_init(), pr_area_init(), set_area_init(), test_area(), tp_init(), and ws_area_init().
void area_destroy | ( | AREA * | area | ) |
Definition at line 247 of file area_alloc.c.
References area_flush(), assert, free_and_init, area::next, NULL, pthread_mutex_lock, pthread_mutex_unlock, and rv.
Referenced by classobj_area_final(), obt_area_final(), pr_area_final(), set_area_final(), test_area(), tp_final(), and ws_area_final().
void area_dump | ( | FILE * | fp | ) |
Definition at line 853 of file area_alloc.c.
References area_info(), area::next, NULL, pthread_mutex_lock, pthread_mutex_unlock, and rv.
Referenced by ws_dump().
void area_final | ( | void | ) |
Definition at line 119 of file area_alloc.c.
References area_flush(), free_and_init, area::next, NULL, pthread_mutex_destroy, and set_area_reset().
Referenced by boot_client_all_finalize(), boot_initialize_client(), boot_restart_client(), boot_server_all_finalize(), and test_area().
|
static |
Definition at line 708 of file area_alloc.c.
References AREA_BLOCKSET_SIZE, ARG_FILE_LINE, assert, area::block_size, area::blockset_list, area_block::data, ER_AREA_ILLEGAL_POINTER, ER_ERROR_SEVERITY, er_set(), area_blockset_list::items, area_blockset_list::next, NULL, area_blockset_list::used_count, and VOLATILE_ACCESS.
Referenced by area_free(), and area_validate().
void area_flush | ( | AREA * | area | ) |
Definition at line 597 of file area_alloc.c.
References area::area_mutex, assert, area_block::bitmap, area::blockset_list, lockfree::bitmap::destroy(), free_and_init, i, area_blockset_list::items, area::name, area_blockset_list::next, NULL, pthread_mutex_destroy, and area_blockset_list::used_count.
Referenced by area_destroy(), and area_final().
int area_free | ( | AREA * | area, |
void * | ptr | ||
) |
Definition at line 514 of file area_alloc.c.
References area::alloc_count, area_find_block(), AREA_PREFIX_FREED, AREA_PREFIX_INITED, AREA_PREFIX_SIZE, ARG_FILE_LINE, assert, area_block::bitmap, area_block::data, area::element_size, ER_AREA_FREE_TWICE, ER_AREA_ILLEGAL_POINTER, ER_ERROR_SEVERITY, er_set(), lockfree::bitmap::free_entry(), area::hint_block, LF_BITMAP_IS_FULL, area::n_frees, NO_ERROR, NULL, and VOLATILE_ACCESS.
Referenced by classobj_free_template(), free_set_reference(), ml_ext_free_link(), obt_free_assignment(), obt_free_template(), pr_free_ext_value(), setobj_free(), test_area_proc(), test_area_proc_1(), test_area_proc_2(), and tp_domain_free().
|
static |
Definition at line 783 of file area_alloc.c.
References area::alloc_count, AREA_BLOCKSET_SIZE, AREA_PREFIX_SIZE, assert, area_block::bitmap, area::block_size, area::blockset_list, area::element_size, lockfree::bitmap::entry_count_in_use, i, area_blockset_list::items, area::n_allocs, area::n_frees, area::name, area_blockset_list::next, NULL, and area_blockset_list::used_count.
Referenced by area_dump().
void area_init | ( | void | ) |
Definition at line 100 of file area_alloc.c.
References ARG_FILE_LINE, ER_AREA_ALREADY_STARTED, er_set(), ER_WARNING_SEVERITY, and NULL.
Referenced by boot_initialize_client(), boot_restart_client(), boot_restart_server(), test_area(), xboot_initialize_server(), and xboot_restart_from_backup().
|
static |
Definition at line 641 of file area_alloc.c.
References area_alloc_blockset(), AREA_BLOCKSET_SIZE, assert, area::blockset_list, er_errid(), area_blockset_list::items, new_block(), area_blockset_list::next, NO_ERROR, NULL, and area_blockset_list::used_count.
Referenced by area_alloc().
Definition at line 487 of file area_alloc.c.
References area_find_block(), ARG_FILE_LINE, assert, ER_AREA_ILLEGAL_POINTER, ER_ERROR_SEVERITY, er_set(), error(), NO_ERROR, NULL, and p.
Referenced by ml_ext_free().
Definition at line 71 of file area_alloc.c.
Referenced by area_create().
|
static |
Definition at line 52 of file area_alloc.c.
Referenced by _DEFUN(), area_alloc(), area_create(), area_destroy(), area_dump(), btree_check_by_class_oid(), css_check_master_socket_exception(), css_check_master_socket_input(), css_connection_handler_thread(), css_get_next_client_id(), css_master_select_error(), css_master_timeout(), css_process_deregister_ha_process(), hb_check_request_eligibility(), hb_cleanup_conn_and_start_process(), hb_cluster_cleanup(), hb_cluster_initialize(), hb_cluster_job_calc_score(), hb_cluster_job_check_ping(), hb_cluster_job_check_valid_ping_server(), hb_cluster_job_demote(), hb_cluster_job_failover(), hb_cluster_job_heartbeat(), hb_cluster_job_initialize(), hb_cluster_receive_heartbeat(), hb_create_master_reader(), hb_disable_er_log(), hb_enable_er_log(), hb_get_admin_info_string(), hb_get_node_info_string(), hb_get_ping_host_info_string(), hb_get_process_info_string(), hb_help_sprint_jobs_info(), hb_is_hang_process(), hb_job_dequeue(), hb_job_queue(), hb_job_shutdown(), hb_kill_all_heartbeat_process(), hb_prepare_deactivate_heartbeat(), hb_register_new_process(), hb_reload_config(), hb_resource_initialize(), hb_resource_job_change_mode(), hb_resource_job_cleanup_all(), hb_resource_job_confirm_cleanup_all(), hb_resource_job_confirm_dereg(), hb_resource_job_confirm_start(), hb_resource_job_demote_confirm_shutdown(), hb_resource_job_demote_start_shutdown(), hb_resource_job_initialize(), hb_resource_job_proc_dereg(), hb_resource_job_proc_start(), hb_resource_receive_changemode(), hb_resource_receive_get_eof(), hb_return_proc_state_by_fd(), hb_thread_check_disk_failure(), hb_thread_initialize(), locator_check_by_class_oid(), locator_check_class(), lock_clear_deadlock_victim(), lock_demote_class_lock(), lock_detect_local_deadlock(), lock_get_class_lock(), lock_get_lock_holder_tran_index(), lock_get_object_lock(), lock_has_lock_on_object(), lock_has_xlock(), lock_notify_isolation_incons(), lock_unlock_all_shared_get_all_exclusive(), lock_wait_state_to_string(), logwr_log_ha_filestat_to_string(), parser_allocate_string_buffer(), parser_create_node(), parser_create_node_block(), parser_create_parser(), parser_create_string_block(), parser_free_node(), pt_find_string_block(), pt_free_a_string_block(), pt_free_node_blocks(), pt_free_string_blocks(), pt_register_parser(), pt_unregister_parser(), px_sort_assign(), px_sort_myself(), qmgr_free_list_temp_file(), qmgr_get_temp_file_from_list(), qmgr_initialize_temp_file_list(), qmgr_put_temp_file_into_list(), sort_inphase_sort(), sort_listfile(), sort_return_used_resources(), and tp_domain_cache().