CUBRID Engine
latest
|
#include <thread_manager.hpp>
Public Member Functions | |
manager () | |
~manager () | |
void | alloc_entries (void) |
void | init_entries (bool with_lock_free=false) |
void | init_lockfree_system () |
entry_workpool * | create_worker_pool (std::size_t pool_size, std::size_t task_max_count, const char *name, entry_manager *context_manager, std::size_t core_count, bool debug_logging, bool pool_threads=false, wait_seconds wait_for_task_time=std::chrono::seconds(5)) |
void | destroy_worker_pool (entry_workpool *&worker_pool_arg) |
void | push_task (entry_workpool *worker_pool_arg, entry_task *exec_p) |
void | push_task_on_core (entry_workpool *worker_pool_arg, entry_task *exec_p, std::size_t core_hash) |
bool | try_task (entry &thread_p, entry_workpool *worker_pool_arg, entry_task *exec_p) |
bool | is_pool_full (entry_workpool *worker_pool_arg) |
daemon * | create_daemon (const looper &looper_arg, entry_task *exec_p, const char *daemon_name="", entry_manager *context_manager=NULL) |
void | destroy_daemon (daemon *&daemon_arg) |
daemon * | create_daemon_without_entry (const looper &looper_arg, task_without_context *exec_p, const char *daemon_name) |
void | destroy_daemon_without_entry (daemon *&daemon_arg) |
std::size_t | get_max_thread_count (void) const |
void | check_all_killed (void) |
entry * | get_all_entries (void) |
lockfree::tran::system & | get_lockfree_transys () |
void | set_max_thread_count_from_config () |
void | set_max_thread_count (std::size_t count) |
void | return_lock_free_transaction_entries (void) |
entry * | find_by_tid (thread_id_t tid) |
template<typename Func , typename... Args> | |
void | map_entries (Func &&func, Args &&...args) |
Private Types | |
using | entry_dispatcher = resource_shared_pool< entry > |
Private Member Functions | |
entry * | claim_entry (void) |
void | retire_entry (entry &entry_p) |
template<typename Res , typename... CtArgs> | |
Res * | create_and_track_resource (std::vector< Res * > &tracker, size_t entries_count, CtArgs &&...args) |
template<typename Res > | |
void | destroy_and_untrack_resource (std::vector< Res * > &tracker, Res *&res, std::size_t entries_count) |
template<typename Res > | |
void | destroy_and_untrack_all_resources (std::vector< Res * > &tracker) |
Private Attributes | |
std::size_t | m_max_threads |
std::mutex | m_entries_mutex |
std::vector< entry_workpool * > | m_worker_pools |
std::vector< daemon * > | m_daemons |
std::vector< daemon * > | m_daemons_without_entries |
entry * | m_all_entries |
entry_dispatcher * | m_entry_dispatcher |
std::size_t | m_available_entries_count |
entry_manager * | m_entry_manager |
daemon_entry_manager * | m_daemon_entry_manager |
lockfree::tran::system * | m_lf_tran_sys |
Friends | |
class | entry_manager |
void | initialize (entry *&my_entry) |
void | finalize (void) |
Definition at line 108 of file thread_manager.hpp.
|
private |
Definition at line 230 of file thread_manager.hpp.
cubthread::manager::manager | ( | void | ) |
Definition at line 3247 of file error_manager.c.
References assert_release, er_init(), and NO_ERROR.
Referenced by cubthread::initialize(), and cubthread::set_manager().
cubthread::manager::~manager | ( | void | ) |
Definition at line 3255 of file error_manager.c.
References ER_ALL_FINAL, and er_final().
void cubthread::manager::alloc_entries | ( | void | ) |
Definition at line 81 of file thread_manager.cpp.
References assert, m_all_entries, m_available_entries_count, m_entry_dispatcher, and m_max_threads.
Referenced by cubthread::initialize_thread_entries().
void cubthread::manager::check_all_killed | ( | void | ) |
Definition at line 404 of file thread_manager.cpp.
References destroy_and_untrack_all_resources(), m_daemons, m_daemons_without_entries, and m_worker_pools.
|
private |
Definition at line 381 of file thread_manager.cpp.
References resource_shared_pool< T >::claim(), m_entry_dispatcher, and cubthread::tl_Entry_p.
Referenced by cubthread::entry_manager::create_context().
|
inlineprivate |
Definition at line 138 of file thread_manager.cpp.
References cubthread::check_not_single_thread(), m_available_entries_count, m_entries_mutex, and NULL.
Referenced by create_daemon(), create_daemon_without_entry(), and create_worker_pool().
daemon * cubthread::manager::create_daemon | ( | const looper & | looper_arg, |
entry_task * | exec_p, | ||
const char * | daemon_name = "" , |
||
entry_manager * | context_manager = NULL |
||
) |
Definition at line 183 of file thread_manager.cpp.
References assert, create_and_track_resource(), cubthread::is_single_thread(), m_daemon_entry_manager, m_daemons, and NULL.
Referenced by dwb_read_page(), lock_initialize(), log_is_log_flush_daemon_available(), pgbuf_get_page_flush_interval(), session_free_prepared_statement(), and vacuum_boot().
daemon * cubthread::manager::create_daemon_without_entry | ( | const looper & | looper_arg, |
task_without_context * | exec_p, | ||
const char * | daemon_name | ||
) |
Definition at line 208 of file thread_manager.cpp.
References assert, create_and_track_resource(), cubthread::is_single_thread(), m_daemons_without_entries, and NULL.
entry_workpool * cubthread::manager::create_worker_pool | ( | std::size_t | pool_size, |
std::size_t | task_max_count, | ||
const char * | name, | ||
entry_manager * | context_manager, | ||
std::size_t | core_count, | ||
bool | debug_logging, | ||
bool | pool_threads = false , |
||
wait_seconds | wait_for_task_time = std::chrono::seconds (5) |
||
) |
Definition at line 158 of file thread_manager.cpp.
References create_and_track_resource(), cubthread::is_single_thread(), m_entry_manager, m_worker_pools, and NULL.
Referenced by css_init(), cubthread::internal_tasks_worker_pool::initialize(), online_index_builder(), vacuum_boot(), and cubload::worker_manager_register_session().
|
private |
Definition at line 122 of file thread_manager.cpp.
References assert.
Referenced by check_all_killed().
|
inlineprivate |
Definition at line 229 of file thread_manager.cpp.
References assert, cubthread::check_not_single_thread(), m_available_entries_count, m_entries_mutex, and NULL.
Referenced by destroy_daemon(), destroy_daemon_without_entry(), and destroy_worker_pool().
void cubthread::manager::destroy_daemon | ( | daemon *& | daemon_arg | ) |
Definition at line 351 of file thread_manager.cpp.
References assert, destroy_and_untrack_resource(), m_daemons, and NULL.
Referenced by dwb_read_page(), lock_initialize(), log_is_log_flush_daemon_available(), log_stop_ha_delay_registration(), pgbuf_get_page_flush_interval(), session_free_prepared_statement(), and vacuum_stop_master().
void cubthread::manager::destroy_daemon_without_entry | ( | daemon *& | daemon_arg | ) |
Definition at line 366 of file thread_manager.cpp.
References assert, destroy_and_untrack_resource(), m_daemons_without_entries, and NULL.
void cubthread::manager::destroy_worker_pool | ( | entry_workpool *& | worker_pool_arg | ) |
Definition at line 257 of file thread_manager.cpp.
References assert, destroy_and_untrack_resource(), cubthread::worker_pool< Context >::get_max_count(), m_worker_pools, and NULL.
Referenced by css_init(), online_index_builder(), vacuum_stop_workers(), and cubload::worker_manager_unregister_session().
entry * cubthread::manager::find_by_tid | ( | thread_id_t | tid | ) |
Definition at line 446 of file thread_manager.cpp.
References cubthread::Is_single_thread, m_all_entries, m_max_threads, and NULL.
Referenced by csect_start_scan(), and tz_get_client_tz_region_session().
|
inline |
Definition at line 198 of file thread_manager.hpp.
|
inline |
Definition at line 203 of file thread_manager.hpp.
References cubregex::count(), and cubthread::return_lock_free_transaction_entries().
Referenced by cubthread::get_thread_entry_lftransys(), and cubthread::initialize_thread_entries().
std::size_t cubthread::manager::get_max_thread_count | ( | void | ) | const |
Definition at line 398 of file thread_manager.cpp.
References m_max_threads.
Referenced by cubthread::get_max_thread_count(), and cubthread::initialize_thread_entries().
void cubthread::manager::init_entries | ( | bool | with_lock_free = false | ) |
Definition at line 96 of file thread_manager.cpp.
References lockfree::tran::system::assign_index(), cubthread::entry::assign_lf_tran_index(), cubthread::entry::index, m_all_entries, m_lf_tran_sys, m_max_threads, and cubthread::entry::request_lock_free_transactions().
Referenced by cubthread::initialize_thread_entries().
void cubthread::manager::init_lockfree_system | ( | ) |
Definition at line 111 of file thread_manager.cpp.
References m_lf_tran_sys, and m_max_threads.
Referenced by cubthread::initialize_thread_entries().
bool cubthread::manager::is_pool_full | ( | entry_workpool * | worker_pool_arg | ) |
Definition at line 340 of file thread_manager.cpp.
References cubthread::worker_pool< Context >::is_full(), and NULL.
void cubthread::manager::map_entries | ( | Func && | func, |
Args &&... | args | ||
) |
Definition at line 351 of file thread_manager.hpp.
References i.
Referenced by lock_detect_local_deadlock(), lock_get_transaction_lock_waiting_threads(), lock_initialize(), logtb_find_thread_by_tran_index(), logtb_find_thread_by_tran_index_except_me(), and thread_start_scan().
void cubthread::manager::push_task | ( | entry_workpool * | worker_pool_arg, |
entry_task * | exec_p | ||
) |
Definition at line 272 of file thread_manager.cpp.
References assert, cubthread::check_not_single_thread(), cubthread::task< Context >::execute(), cubthread::worker_pool< Context >::execute(), cubthread::get_entry(), NULL, and cubthread::task< Context >::retire().
Referenced by css_internal_connection_handler(), css_push_external_task(), online_index_builder(), and vacuum_data_unload_first_and_last_page().
void cubthread::manager::push_task_on_core | ( | entry_workpool * | worker_pool_arg, |
entry_task * | exec_p, | ||
std::size_t | core_hash | ||
) |
Definition at line 295 of file thread_manager.cpp.
References assert, cubthread::check_not_single_thread(), cubthread::task< Context >::execute(), cubthread::worker_pool< Context >::execute_on_core(), cubthread::get_entry(), NULL, and cubthread::task< Context >::retire().
Referenced by css_push_server_task().
|
private |
Definition at line 389 of file thread_manager.cpp.
References assert, m_entry_dispatcher, NULL, and resource_shared_pool< T >::retire().
Referenced by cubthread::entry_manager::retire_context().
void cubthread::manager::return_lock_free_transaction_entries | ( | void | ) |
Definition at line 436 of file thread_manager.cpp.
References lockfree::tran::system::free_index(), m_all_entries, m_lf_tran_sys, m_max_threads, and cubthread::entry::return_lock_free_transaction_entries().
Referenced by cubthread::return_lock_free_transaction_entries().
void cubthread::manager::set_max_thread_count | ( | std::size_t | count | ) |
Definition at line 430 of file thread_manager.cpp.
References cubregex::count(), and m_max_threads.
void cubthread::manager::set_max_thread_count_from_config | ( | void | ) |
Definition at line 413 of file thread_manager.cpp.
References m_max_threads, NUM_NON_SYSTEM_TRANS, prm_get_integer_value(), and PRM_ID_VACUUM_WORKER_COUNT.
Referenced by cubthread::initialize_thread_entries().
bool cubthread::manager::try_task | ( | entry & | thread_p, |
entry_workpool * | worker_pool_arg, | ||
entry_task * | exec_p | ||
) |
Definition at line 318 of file thread_manager.cpp.
References assert, cubthread::check_not_single_thread(), cubthread::task< Context >::execute(), NULL, cubthread::task< Context >::retire(), and cubthread::worker_pool< Context >::try_execute().
|
friend |
Definition at line 225 of file thread_manager.hpp.
|
friend |
Definition at line 54 of file internal_tasks_worker_pool.cpp.
|
friend |
Definition at line 472 of file thread_manager.cpp.
|
private |
Definition at line 259 of file thread_manager.hpp.
Referenced by alloc_entries(), find_by_tid(), init_entries(), and return_lock_free_transaction_entries().
|
private |
Definition at line 263 of file thread_manager.hpp.
Referenced by alloc_entries(), create_and_track_resource(), and destroy_and_untrack_resource().
|
private |
Definition at line 265 of file thread_manager.hpp.
Referenced by create_daemon().
|
private |
Definition at line 254 of file thread_manager.hpp.
Referenced by check_all_killed(), create_daemon(), and destroy_daemon().
|
private |
Definition at line 256 of file thread_manager.hpp.
Referenced by check_all_killed(), create_daemon_without_entry(), and destroy_daemon_without_entry().
|
private |
Definition at line 250 of file thread_manager.hpp.
Referenced by create_and_track_resource(), and destroy_and_untrack_resource().
|
private |
Definition at line 261 of file thread_manager.hpp.
Referenced by alloc_entries(), claim_entry(), and retire_entry().
|
private |
Definition at line 264 of file thread_manager.hpp.
Referenced by create_worker_pool().
|
private |
Definition at line 268 of file thread_manager.hpp.
Referenced by init_entries(), init_lockfree_system(), and return_lock_free_transaction_entries().
|
private |
Definition at line 247 of file thread_manager.hpp.
Referenced by alloc_entries(), find_by_tid(), get_max_thread_count(), init_entries(), init_lockfree_system(), return_lock_free_transaction_entries(), set_max_thread_count(), and set_max_thread_count_from_config().
|
private |
Definition at line 252 of file thread_manager.hpp.
Referenced by check_all_killed(), create_worker_pool(), and destroy_worker_pool().