CUBRID Engine
latest
|
#include <mvcc_table.hpp>
Public Types | |
using | lowest_active_mvccid_type = std::atomic< MVCCID > |
Public Member Functions | |
mvcctable () | |
~mvcctable () | |
void | initialize () |
void | finalize () |
void | alloc_transaction_lowest_active () |
void | reset_transaction_lowest_active (int tran_index) |
void | build_mvcc_info (log_tdes &tdes) |
void | complete_mvcc (int tran_index, MVCCID mvccid, bool committed) |
void | complete_sub_mvcc (MVCCID mvccid) |
MVCCID | get_new_mvccid () |
void | get_two_new_mvccid (MVCCID &first, MVCCID &second) |
bool | is_active (MVCCID mvccid) const |
void | reset_start_mvccid () |
MVCCID | get_global_oldest_visible () const |
MVCCID | update_global_oldest_visible () |
void | lock_global_oldest_visible () |
void | unlock_global_oldest_visible () |
bool | is_global_oldest_visible_locked () const |
Private Member Functions | |
mvcc_trans_status & | next_trans_status_start (mvcc_trans_status::version_type &next_version, size_t &next_index) |
void | next_tran_status_finish (mvcc_trans_status &next_trans_status, size_t next_index) |
void | advance_oldest_active (MVCCID next_oldest_active) |
MVCCID | compute_oldest_visible_mvccid () const |
Private Attributes | |
lowest_active_mvccid_type * | m_transaction_lowest_visible_mvccids |
size_t | m_transaction_lowest_visible_mvccids_size |
lowest_active_mvccid_type | m_current_status_lowest_active_mvccid |
mvcc_trans_status | m_current_trans_status |
std::atomic< size_t > | m_trans_status_history_position |
mvcc_trans_status * | m_trans_status_history |
std::mutex | m_new_mvccid_lock |
std::mutex | m_active_trans_mutex |
std::atomic< MVCCID > | m_oldest_visible |
std::atomic< size_t > | m_ov_lock_count |
Static Private Attributes | |
static const size_t | HISTORY_MAX_SIZE = 2048 |
static const size_t | HISTORY_INDEX_MASK = HISTORY_MAX_SIZE - 1 |
Definition at line 64 of file mvcc_table.hpp.
using mvcctable::lowest_active_mvccid_type = std::atomic<MVCCID> |
Definition at line 67 of file mvcc_table.hpp.
mvcctable::mvcctable | ( | ) |
Definition at line 162 of file mvcc_table.cpp.
mvcctable::~mvcctable | ( | ) |
Definition at line 176 of file mvcc_table.cpp.
References m_trans_status_history, and m_transaction_lowest_visible_mvccids.
|
private |
Definition at line 140 of file mvcc_table.cpp.
References oldest_active_event::ADVANCE_LOWEST, oldest_active_add_event(), and oldest_active_event::SET.
Referenced by complete_mvcc().
void mvcctable::alloc_transaction_lowest_active | ( | ) |
Definition at line 198 of file mvcc_table.cpp.
References logtb_get_number_of_total_tran_indices(), m_transaction_lowest_visible_mvccids, and m_transaction_lowest_visible_mvccids_size.
Referenced by initialize(), and logtb_expand_trantable().
void mvcctable::build_mvcc_info | ( | log_tdes & | tdes | ) |
Definition at line 224 of file mvcc_table.cpp.
References ARG_FILE_LINE, assert, oldest_active_event::BUILD_MVCC_INFO, mvcc_active_tran::check_valid(), mvcc_active_tran::compute_highest_completed_mvccid(), mvcc_active_tran::copy_to(), ER_ERROR_SEVERITY, ER_MVCC_CANT_GET_SNAPSHOT, er_set(), mvcc_snapshot::highest_completed_mvccid, HISTORY_MAX_SIZE, mvcc_active_tran::initialize(), logtb_get_number_of_total_tran_indices(), logtb_load_global_statistics_to_tran(), mvcc_snapshot::lowest_active_mvccid, mvcc_trans_status::m_active_mvccs, mvcc_snapshot::m_active_mvccs, m_current_status_lowest_active_mvccid, m_trans_status_history, m_trans_status_history_position, m_transaction_lowest_visible_mvccids, mvcc_trans_status::m_version, mvcc_satisfies_snapshot(), MVCCID_ALL_VISIBLE, MVCCID_FORWARD, MVCCID_IS_VALID, log_tdes::mvccinfo, NO_ERROR, oldest_active_get(), oldest_active_set(), perfmon_add_stat(), perfmon_is_perf_tracking(), PSTAT_LOG_SNAPSHOT_RETRY_COUNTERS, PSTAT_LOG_SNAPSHOT_TIME_COUNTERS, mvcc_info::recent_snapshot_lowest_active_mvccid, mvcc_active_tran::reset_active_transactions(), mvcc_info::snapshot, mvcc_snapshot::snapshot_fnc, thread_get_thread_entry_info(), mvcc_active_tran::THREAD_UNSAFE, log_tdes::tran_index, tsc_elapsed_time_usec(), tsc_getticks(), and mvcc_snapshot::valid.
Referenced by logtb_get_mvcc_snapshot().
Definition at line 466 of file mvcc_table.cpp.
References advance_oldest_active(), assert, mvcc_trans_status::COMMIT, oldest_active_event::COMPLETE_MVCC, mvcc_active_tran::compute_lowest_active_mvccid(), mvcc_active_tran::get_bit_area_start_mvccid(), oldest_active_event::GET_LOWEST_ACTIVE, logtb_tran_update_all_global_unique_stats(), mvcc_trans_status::m_active_mvccs, m_active_trans_mutex, m_current_status_lowest_active_mvccid, m_current_trans_status, mvcc_trans_status::m_event_type, mvcc_trans_status::m_last_completed_mvccid, m_transaction_lowest_visible_mvccids, mvcc_trans_status::m_version, MVCC_ID_PRECEDES, MVCCID_IS_VALID, MVCCID_NULL, next_tran_status_finish(), next_trans_status_start(), NO_ERROR, oldest_active_add_event(), oldest_active_get(), oldest_active_set(), mvcc_trans_status::ROLLBACK, mvcc_active_tran::set_inactive_mvccid(), and thread_get_thread_entry_info().
Referenced by logtb_complete_mvcc().
void mvcctable::complete_sub_mvcc | ( | MVCCID | mvccid | ) |
Definition at line 542 of file mvcc_table.cpp.
References assert, mvcc_trans_status::m_active_mvccs, m_active_trans_mutex, m_current_trans_status, mvcc_trans_status::m_last_completed_mvccid, MVCCID_IS_VALID, next_tran_status_finish(), next_trans_status_start(), mvcc_active_tran::set_inactive_mvccid(), and mvcc_trans_status::SUBTRAN.
Referenced by logtb_complete_sub_mvcc().
|
private |
Definition at line 356 of file mvcc_table.cpp.
References cubmem::appendable_array< T, S >::append(), assert, cubmem::appendable_array< T, S >::erase(), cubmem::extensible_array< T, S >::get_array(), cubthread::get_entry(), oldest_active_event::GET_OLDEST_ACTIVE, cubmem::appendable_array< T, S >::get_size(), i, m_current_status_lowest_active_mvccid, m_transaction_lowest_visible_mvccids, m_transaction_lowest_visible_mvccids_size, MVCC_ID_PRECEDES, MVCCID_ALL_VISIBLE, MVCCID_IS_NORMAL, MVCCID_NULL, oldest_active_get(), perfmon_add_stat(), PSTAT_LOG_OLDEST_MVCC_RETRY_COUNTERS, PSTAT_LOG_OLDEST_MVCC_TIME_COUNTERS, and thread_sleep().
Referenced by update_global_oldest_visible().
void mvcctable::finalize | ( | void | ) |
Definition at line 211 of file mvcc_table.cpp.
References mvcc_trans_status::finalize(), m_current_trans_status, m_trans_status_history, m_transaction_lowest_visible_mvccids, m_transaction_lowest_visible_mvccids_size, and NULL.
Referenced by logtb_finalize_mvcctable(), and logtb_undefine_trantable().
MVCCID mvcctable::get_global_oldest_visible | ( | ) | const |
Definition at line 612 of file mvcc_table.cpp.
References m_oldest_visible.
Referenced by prior_update_header_mvcc_info(), redistribute_partition_data(), test_mvcc_get_oldest(), vacuum_consume_buffer_log_blocks(), vacuum_process_log_block(), vacuum_recover_lost_block_data(), vacuum_rv_check_at_undo(), vacuum_verify_vacuum_data_debug(), xbtree_load_index(), and xlocator_upgrade_instances_domain().
MVCCID mvcctable::get_new_mvccid | ( | ) |
Definition at line 567 of file mvcc_table.cpp.
References log_global::hdr, log_Gl, m_new_mvccid_lock, log_header::mvcc_next_id, and MVCCID_FORWARD.
Referenced by logtb_get_current_mvccid(), and logtb_get_new_subtransaction_mvccid().
Definition at line 580 of file mvcc_table.cpp.
References log_global::hdr, log_Gl, m_new_mvccid_lock, log_header::mvcc_next_id, and MVCCID_FORWARD.
Referenced by logtb_get_new_subtransaction_mvccid().
void mvcctable::initialize | ( | ) |
Definition at line 183 of file mvcc_table.cpp.
References alloc_transaction_lowest_active(), HISTORY_MAX_SIZE, mvcc_trans_status::initialize(), m_current_status_lowest_active_mvccid, m_current_trans_status, m_trans_status_history, m_trans_status_history_position, and MVCCID_FIRST.
Referenced by logtb_define_trantable_log_latch(), and logtb_initialize_mvcctable().
Definition at line 424 of file mvcc_table.cpp.
References mvcc_active_tran::is_active(), mvcc_trans_status::m_active_mvccs, m_trans_status_history, m_trans_status_history_position, and mvcc_trans_status::m_version.
Referenced by mvcc_is_active_id().
bool mvcctable::is_global_oldest_visible_locked | ( | ) | const |
Definition at line 646 of file mvcc_table.cpp.
References m_ov_lock_count.
Referenced by logtb_get_system_tdes().
void mvcctable::lock_global_oldest_visible | ( | ) |
Definition at line 633 of file mvcc_table.cpp.
References m_ov_lock_count.
Referenced by logtb_get_system_tdes().
|
private |
Definition at line 456 of file mvcc_table.cpp.
References mvcc_active_tran::copy_to(), mvcc_trans_status::m_active_mvccs, m_current_trans_status, mvcc_trans_status::m_event_type, mvcc_trans_status::m_last_completed_mvccid, m_trans_status_history_position, and mvcc_active_tran::THREAD_SAFE.
Referenced by complete_mvcc(), and complete_sub_mvcc().
|
private |
Definition at line 442 of file mvcc_table.cpp.
References HISTORY_INDEX_MASK, m_current_trans_status, m_trans_status_history, m_trans_status_history_position, and mvcc_trans_status::m_version.
Referenced by complete_mvcc(), and complete_sub_mvcc().
void mvcctable::reset_start_mvccid | ( | ) |
Definition at line 601 of file mvcc_table.cpp.
References assert, log_global::hdr, HISTORY_MAX_SIZE, log_Gl, mvcc_trans_status::m_active_mvccs, m_current_status_lowest_active_mvccid, m_current_trans_status, m_trans_status_history, m_trans_status_history_position, log_header::mvcc_next_id, and mvcc_active_tran::reset_start_mvccid().
Referenced by log_initialize_internal(), log_recovery_analysis(), and log_recovery_redo().
void mvcctable::reset_transaction_lowest_active | ( | int | tran_index | ) |
Definition at line 594 of file mvcc_table.cpp.
References m_transaction_lowest_visible_mvccids, MVCCID_NULL, oldest_active_set(), and oldest_active_event::RESET.
Referenced by log_complete(), log_complete_for_2pc(), logtb_complete_mvcc(), test_mvcc_get_snapshot(), and test_new_mvcc_complete().
void mvcctable::unlock_global_oldest_visible | ( | ) |
Definition at line 639 of file mvcc_table.cpp.
References assert, and m_ov_lock_count.
Referenced by logtb_get_system_tdes().
MVCCID mvcctable::update_global_oldest_visible | ( | ) |
Definition at line 618 of file mvcc_table.cpp.
References assert, compute_oldest_visible_mvccid(), m_oldest_visible, and m_ov_lock_count.
Referenced by vacuum_data_load_and_recover(), and vacuum_data_unload_first_and_last_page().
|
staticprivate |
Definition at line 98 of file mvcc_table.hpp.
Referenced by next_trans_status_start().
|
staticprivate |
Definition at line 97 of file mvcc_table.hpp.
Referenced by build_mvcc_info(), initialize(), and reset_start_mvccid().
|
private |
Definition at line 116 of file mvcc_table.hpp.
Referenced by complete_mvcc(), and complete_sub_mvcc().
|
private |
Definition at line 104 of file mvcc_table.hpp.
Referenced by build_mvcc_info(), complete_mvcc(), compute_oldest_visible_mvccid(), initialize(), and reset_start_mvccid().
|
private |
Definition at line 107 of file mvcc_table.hpp.
Referenced by complete_mvcc(), complete_sub_mvcc(), finalize(), initialize(), next_tran_status_finish(), next_trans_status_start(), and reset_start_mvccid().
|
private |
Definition at line 114 of file mvcc_table.hpp.
Referenced by get_new_mvccid(), and get_two_new_mvccid().
|
private |
Definition at line 118 of file mvcc_table.hpp.
Referenced by get_global_oldest_visible(), and update_global_oldest_visible().
|
private |
Definition at line 119 of file mvcc_table.hpp.
Referenced by is_global_oldest_visible_locked(), lock_global_oldest_visible(), unlock_global_oldest_visible(), and update_global_oldest_visible().
|
private |
Definition at line 111 of file mvcc_table.hpp.
Referenced by build_mvcc_info(), finalize(), initialize(), is_active(), next_trans_status_start(), reset_start_mvccid(), and ~mvcctable().
|
private |
Definition at line 110 of file mvcc_table.hpp.
Referenced by build_mvcc_info(), initialize(), is_active(), next_tran_status_finish(), next_trans_status_start(), and reset_start_mvccid().
|
private |
Definition at line 101 of file mvcc_table.hpp.
Referenced by alloc_transaction_lowest_active(), build_mvcc_info(), complete_mvcc(), compute_oldest_visible_mvccid(), finalize(), reset_transaction_lowest_active(), and ~mvcctable().
|
private |
Definition at line 102 of file mvcc_table.hpp.
Referenced by alloc_transaction_lowest_active(), compute_oldest_visible_mvccid(), and finalize().