File lock_manager.c
FileList > cubrid > src > transaction > lock_manager.c
Go to the source code of this file
#include <inttypes.h>
#include "config.h"
#include <array>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "boot_sr.h"
#include "critical_section.h"
#include "environment_variable.h"
#include "event_log.h"
#include "locator.h"
#include "lock_free.h"
#include "lock_manager.h"
#include "log_impl.h"
#include "log_manager.h"
#include "memory_alloc.h"
#include "memory_hash.h"
#include "message_catalog.h"
#include "mvcc.h"
#include "object_representation_sr.h"
#include "oid.h"
#include "page_buffer.h"
#include "perf_monitor.h"
#include "porting.h"
#include "query_manager.h"
#include "server_support.h"
#include "storage_common.h"
#include "system_parameter.h"
#include "thread_daemon.hpp"
#include "thread_entry_task.hpp"
#include "thread_lockfree_hash_map.hpp"
#include "thread_manager.hpp"
#include "transaction_sr.h"
#include "tsc_timer.h"
#include "wait_for_graph.h"
#include "xserver_interface.h"
#include "xasl.h"
#include "memory_wrapper.hpp"
Classes
Public Types
Public Attributes
Public Static Attributes
Public Functions
| Type |
Name |
|
REGISTER_DAEMON (lock_deadlock_detect)
|
| void |
deadlock_detect_task_execute (cubthread::entry & thread_ref)
|
| void |
lock_abort_composite_lock (LK_COMPOSITE_LOCK * comp_lock)
|
| int |
lock_add_composite_lock (THREAD_ENTRY * thread_p, LK_COMPOSITE_LOCK * comp_lock, const OID * oid, const OID * class_oid)
|
| int |
lock_classes_lock_hint (THREAD_ENTRY * thread_p, LC_LOCKHINT * lockhint)
|
| void |
lock_clear_deadlock_victim (int tran_index)
|
| void |
lock_deadlock_detect_daemon_get_stats (UINT64 * statsp)
|
| int |
lock_demote_class_lock (THREAD_ENTRY * thread_p, const OID * oid, LOCK lock, LOCK * ex_lock)
|
| void |
lock_demote_read_class_lock_for_checksumdb (THREAD_ENTRY * thread_p, int tran_index, const OID * class_oid)
|
| void |
lock_dump_acquired (FILE * fp, LK_ACQUIRED_LOCKS * acqlocks)
|
| void |
lock_finalize (void)
|
| int |
lock_finalize_composite_lock (THREAD_ENTRY * thread_p, LK_COMPOSITE_LOCK * comp_lock)
|
| void |
lock_force_thread_timeout_lock (THREAD_ENTRY * thrd)
|
| LK_ENTRY * |
lock_get_class_lock (THREAD_ENTRY * thread_p, const OID * class_oid)
|
| int |
lock_get_lock_holder_tran_index (THREAD_ENTRY * thread_p, char ** out_buf, int waiter_index, LK_RES * res)
|
| unsigned int |
lock_get_number_object_locks (void)
|
| LOCK |
lock_get_object_lock (const OID * oid, const OID * class_oid)
|
| int |
lock_has_lock_on_object (const OID * oid, const OID * class_oid, LOCK lock)
|
| bool |
lock_has_lock_transaction (int tran_index)
|
| bool |
lock_has_xlock (THREAD_ENTRY * thread_p)
|
| int |
lock_hold_object_instant (THREAD_ENTRY * thread_p, const OID * oid, const OID * class_oid, LOCK lock)
|
| int |
lock_initialize (void)
|
| int |
lock_initialize_composite_lock (THREAD_ENTRY * thread_p, LK_COMPOSITE_LOCK * comp_lock)
|
| bool |
lock_is_instant_lock_mode (int tran_index)
|
| bool |
lock_is_waiting_transaction (int tran_index)
|
| void |
lock_notify_isolation_incons (THREAD_ENTRY * thread_p, bool(*)(const OID *class_oid, const OID *oid, void *args) fun, void * args)
|
| int |
lock_object (THREAD_ENTRY * thread_p, const OID * oid, const OID * class_oid, LOCK lock, int cond_flag)
|
| int |
lock_object_wait_msecs (THREAD_ENTRY * thread_p, const OID * oid, const OID * class_oid, LOCK lock, int cond_flag, int wait_msecs)
|
| int |
lock_reacquire_crash_locks (THREAD_ENTRY * thread_p, LK_ACQUIRED_LOCKS * acqlocks, int tran_index)
|
| void |
lock_remove_all_inst_locks (THREAD_ENTRY * thread_p, int tran_index, const OID * class_oid, LOCK lock)
|
| int |
lock_rep_read_tran (THREAD_ENTRY * thread_p, LOCK lock, int cond_flag)
|
| int |
lock_scan (THREAD_ENTRY * thread_p, const OID * class_oid, int cond_flag, LOCK class_lock)
|
| void |
lock_start_instant_lock_mode (int tran_index)
|
| void |
lock_stop_instant_lock_mode (THREAD_ENTRY * thread_p, int tran_index, bool need_unlock)
|
| int |
lock_subclass (THREAD_ENTRY * thread_p, const OID * subclass_oid, const OID * superclass_oid, LOCK lock, int cond_flag)
|
| void |
lock_unlock_all (THREAD_ENTRY * thread_p)
|
| void |
lock_unlock_all_shared_get_all_exclusive (THREAD_ENTRY * thread_p, LK_ACQUIRED_LOCKS * acqlocks)
|
| void |
lock_unlock_classes_lock_hint (THREAD_ENTRY * thread_p, LC_LOCKHINT * lockhint)
|
| void |
lock_unlock_object (THREAD_ENTRY * thread_p, const OID * oid, const OID * class_oid, LOCK lock, bool force)
|
| void |
lock_unlock_object_donot_move_to_non2pl (THREAD_ENTRY * thread_p, const OID * oid, const OID * class_oid, LOCK lock)
|
| void |
lock_unlock_objects_lock_set (THREAD_ENTRY * thread_p, LC_LOCKSET * lockset)
|
| const char * |
lock_wait_state_to_string (int state)
|
| void |
xlock_dump (THREAD_ENTRY * thread_p, FILE * outfp, int is_contention)
|
Public Static Functions
| Type |
Name |
| int |
lock_add_WFG_edge (int from_tran_index, int to_tran_index, int holder_flag, INT64 edge_wait_stime)
|
| int |
lock_add_WFG_edge (int from_tran_index, int to_tran_index, int holder_flag, INT64 edge_wait_stime, LK_ENTRY * holder, LK_ENTRY * waiter)
|
| LK_ENTRY * |
lock_add_non2pl_lock (THREAD_ENTRY * thread_p, LK_RES * res_ptr, int tran_index, LOCK lock)
|
| void * |
lock_alloc_entry (void)
|
| void * |
lock_alloc_resource (void)
|
| bool |
lock_check_escalate (THREAD_ENTRY * thread_p, LK_ENTRY * class_entry, LK_TRAN_LOCK * tran_lock)
|
| void |
lock_check_timeout_expired_and_count_suspended_mapfunc (THREAD_ENTRY & thread_ref, bool & stop_mapper, size_t & suspend_count)
|
| int |
lock_compare_lock_info (const void * lockinfo1, const void * lockinfo2)
|
| LK_RES_KEY |
lock_create_search_key (OID * oid, OID * class_oid)
|
| void |
lock_deadlock_detect_daemon_destroy ()
|
| void |
lock_deadlock_detect_daemon_init ()
|
| int |
lock_dealloc_entry (void * res)
|
| int |
lock_dealloc_resource (void * res)
|
| void |
lock_decrement_class_granules (LK_ENTRY * class_entry)
|
| int |
lock_delete_from_tran_hold_list (LK_ENTRY * entry_ptr, int owner_tran_index)
|
| int |
lock_delete_from_tran_non2pl_list (LK_ENTRY * non2pl, int owner_tran_index)
|
| void |
lock_demote_all_shared_class_locks (THREAD_ENTRY * thread_p, int tran_index)
|
| void |
lock_detect_local_deadlock (THREAD_ENTRY * thread_p)
|
| void |
lock_dump_deadlock_victims (THREAD_ENTRY * thread_p, FILE * outfile)
|
| void |
lock_dump_resource (THREAD_ENTRY * thread_p, FILE * outfp, LK_RES * res_ptr)
|
| int |
lock_escalate_if_needed (THREAD_ENTRY * thread_p, LK_ENTRY * class_entry, int tran_index)
|
| void |
lock_event_log_blocked_lock (THREAD_ENTRY * thread_p, FILE * log_fp, LK_ENTRY * entry)
|
| void |
lock_event_log_blocking_locks (THREAD_ENTRY * thread_p, FILE * log_fp, LK_ENTRY * wait_entry)
|
| void |
lock_event_log_deadlock_locks (THREAD_ENTRY * thread_p, FILE * log_fp, int tran_index, bool log_trunc, int log_num_entries, LK_ENTRY ** log_entries)
|
| void |
lock_event_log_lock_info (THREAD_ENTRY * thread_p, FILE * log_fp, LK_ENTRY * entry)
|
| void |
lock_event_log_tran_locks (THREAD_ENTRY * thread_p, FILE * log_fp, int tran_index)
|
| void |
lock_event_set_tran_wait_entry (int tran_index, LK_ENTRY * entry)
|
| void |
lock_event_set_xasl_id_to_entry (int tran_index, LK_ENTRY * entry)
|
| void |
lock_finalize_deadlock_detection (void)
|
| void |
lock_finalize_object_lock_structures (void)
|
| void |
lock_finalize_tran_lock_table (void)
|
| LK_ENTRY * |
lock_find_class_entry (int tran_index, const OID * class_oid)
|
| LK_ENTRY * |
lock_find_tran_hold_entry (THREAD_ENTRY * thread_p, int tran_index, const OID * oid, bool is_class)
|
| bool |
lock_force_timeout_expired_wait_transactions (void * thrd_entry)
|
| void |
lock_free_entry (int tran_index, LF_TRAN_ENTRY * tran_entry, LF_FREELIST * freelist, LK_ENTRY * lock_entry)
|
| unsigned int |
lock_get_hash_value (const OID * oid, int htsize)
|
| LK_ENTRY * |
lock_get_new_entry (int tran_index, LF_TRAN_ENTRY * tran_entry, LF_FREELIST * freelist)
|
| void |
lock_get_transaction_lock_waiting_threads (int tran_index, tran_lock_waiters_array_type & tran_lock_waiters, size_t & count)
|
| void |
lock_get_transaction_lock_waiting_threads_mapfunc (THREAD_ENTRY & thread_ref, bool & stop_mapper, int tran_index, tran_lock_waiters_array_type & tran_lock_waiters, size_t & count)
|
| void |
lock_grant_blocked_holder (THREAD_ENTRY * thread_p, LK_RES * res_ptr)
|
| int |
lock_grant_blocked_waiter (THREAD_ENTRY * thread_p, LK_RES * res_ptr)
|
| void |
lock_grant_blocked_waiter_partial (THREAD_ENTRY * thread_p, LK_RES * res_ptr, LK_ENTRY * from_whom)
|
| void |
lock_increment_class_granules (LK_ENTRY * class_entry)
|
| int |
lock_init_entry (void * res)
|
| int |
lock_init_resource (void * res)
|
| int |
lock_initialize_deadlock_detection (void)
|
| void |
lock_initialize_entry (LK_ENTRY * entry_ptr)
|
| void |
lock_initialize_entry_as_blocked (LK_ENTRY * entry_ptr, THREAD_ENTRY * thread_p, int tran_index, LK_RES * res, LOCK lock)
|
| void |
lock_initialize_entry_as_granted (LK_ENTRY * entry_ptr, int tran_index, LK_RES * res, LOCK lock)
|
| void |
lock_initialize_entry_as_non2pl (LK_ENTRY * entry_ptr, int tran_index, LK_RES * res, LOCK lock)
|
| int |
lock_initialize_object_lock_structures (void)
|
| void |
lock_initialize_resource (LK_RES * res_ptr)
|
| void |
lock_initialize_resource_as_allocated (LK_RES * res_ptr, LOCK lock)
|
| int |
lock_initialize_tran_lock_table (void)
|
| int |
lock_initialize_with_config (const LK_CONFIG * config)
|
| void |
lock_insert_into_tran_hold_list (LK_ENTRY * entry_ptr, int owner_tran_index)
|
| void |
lock_insert_into_tran_non2pl_list (LK_ENTRY * non2pl, int owner_tran_index)
|
| int |
lock_internal_demote_class_lock (THREAD_ENTRY * thread_p, LK_ENTRY * entry_ptr, LOCK to_be_lock, LOCK * ex_lock)
|
| int |
lock_internal_hold_lock_object_instant (THREAD_ENTRY * thread_p, int tran_index, const OID * oid, const OID * class_oid, LOCK lock)
|
| int |
lock_internal_perform_lock_object (THREAD_ENTRY * thread_p, int tran_index, const OID * oid, const OID * class_oid, LOCK lock, int wait_msecs, LK_ENTRY ** entry_addr_ptr, LK_ENTRY * class_entry)
|
| void |
lock_internal_perform_unlock_object (THREAD_ENTRY * thread_p, LK_ENTRY * entry_ptr, bool release_flag, bool move_to_non2pl)
|
| bool |
lock_is_class_lock_escalated (LOCK class_lock, LOCK lock_escalation)
|
| bool |
lock_is_local_deadlock_detection_interval_up (void)
|
| bool |
lock_is_safe_lock_with_page (THREAD_ENTRY * thread_p, LK_ENTRY * entry_ptr)
|
| LK_CONFIG |
lock_make_default_config (void)
|
| LK_CONFIG |
lock_make_runtime_config (void)
|
| void |
lock_position_holder_entry (LK_RES * res_ptr, LK_ENTRY * entry_ptr)
|
| void |
lock_remove_all_class_locks (THREAD_ENTRY * thread_p, int tran_index, LOCK lock)
|
| void |
lock_remove_non2pl (THREAD_ENTRY * thread_p, LK_ENTRY * non2pl, int tran_index)
|
| int |
lock_remove_resource (THREAD_ENTRY * thread_p, LK_RES * res_ptr)
|
| int |
lock_res_key_compare (void * k1, void * k2)
|
| int |
lock_res_key_copy (void * src, void * dest)
|
| unsigned int |
lock_res_key_hash (void * key, int htsize)
|
| void |
lock_resume (LK_ENTRY * entry_ptr, int state)
|
| void |
lock_select_deadlock_victim (THREAD_ENTRY * thread_p, int s, int t)
|
| void |
lock_set_error_for_aborted (LK_ENTRY * entry_ptr)
|
| void |
lock_set_error_for_timeout (THREAD_ENTRY * thread_p, LK_ENTRY * entry_ptr)
|
| void |
lock_set_tran_abort_reason (int tran_index, TRAN_ABORT_REASON abort_reason)
|
| LOCK_WAIT_STATE |
lock_suspend (THREAD_ENTRY * thread_p, LK_ENTRY * entry_ptr, int wait_msecs)
|
| int |
lock_uninit_entry (void * res)
|
| int |
lock_uninit_resource (void * res)
|
| void |
lock_unlock_inst_locks_of_class_by_isolation (THREAD_ENTRY * thread_p, int tran_index, TRAN_ISOLATION isolation, const OID * class_oid)
|
| void |
lock_unlock_object_by_isolation (THREAD_ENTRY * thread_p, int tran_index, TRAN_ISOLATION isolation, const OID * class_oid, const OID * oid)
|
| void |
lock_unlock_object_lock_internal (THREAD_ENTRY * thread_p, const OID * oid, const OID * class_oid, LOCK lock, int release_flag, int move_to_non2pl)
|
| void |
lock_unlock_shared_inst_lock (THREAD_ENTRY * thread_p, int tran_index, const OID * inst_oid)
|
| void |
lock_update_non2pl_list (THREAD_ENTRY * thread_p, LK_RES * res_ptr, int tran_index, LOCK lock)
|
| void |
lock_victimize_first_thread_mapfunc (THREAD_ENTRY & thread_ref, bool & stop_mapper)
|
| float |
lock_wait_msecs_to_secs (int msecs)
|
| bool |
lock_wakeup_deadlock_victim_aborted (int tran_index)
|
| bool |
lock_wakeup_deadlock_victim_timeout (int tran_index)
|
Macros
Public Types Documentation
typedef LK_CONFIG
typedef struct lk_config LK_CONFIG;
typedef LK_DEADLOCK_VICTIM
typedef struct lk_deadlock_victim LK_DEADLOCK_VICTIM;
typedef LK_ENTRY_BLOCK
typedef struct lk_entry_block LK_ENTRY_BLOCK;
typedef LK_GLOBAL_DATA
typedef struct lk_global_data LK_GLOBAL_DATA;
typedef LK_INIT_STATE
typedef struct lk_init_state LK_INIT_STATE;
typedef LK_LOCKINFO
typedef struct lk_lockinfo LK_LOCKINFO;
typedef LK_RES_BLOCK
typedef struct lk_res_block LK_RES_BLOCK;
typedef LK_TRAN_LOCK
typedef struct lk_tran_lock LK_TRAN_LOCK;
typedef LK_WFG_EDGE
typedef struct lk_WFG_edge LK_WFG_EDGE;
typedef LK_WFG_NODE
typedef struct lk_WFG_node LK_WFG_NODE;
enum LOCK_WAIT_STATE
enum LOCK_WAIT_STATE {
LOCK_SUSPENDED,
LOCK_RESUMED,
LOCK_RESUMED_TIMEOUT,
LOCK_RESUMED_DEADLOCK_TIMEOUT,
LOCK_RESUMED_ABORTED,
LOCK_RESUMED_ABORTED_FIRST,
LOCK_RESUMED_ABORTED_OTHER,
LOCK_RESUMED_INTERRUPT
};
typedef lk_hashmap_iterator
using lk_hashmap_iterator = lk_hashmap_type::iterator;
typedef lk_hashmap_type
using lk_hashmap_type = cubthread::lockfree_hashmap<LK_RES_KEY, LK_RES>;
typedef tran_lock_waiters_array_type
using tran_lock_waiters_array_type = std::array<THREAD_ENTRY *, DEFAULT_LOCK_WAITING_THREAD_ARRAY_SIZE>;
Public Attributes Documentation
variable DEFAULT_LOCK_WAITING_THREAD_ARRAY_SIZE
const size_t DEFAULT_LOCK_WAITING_THREAD_ARRAY_SIZE;
variable lk_Gl
variable lk_Obj_lock_res_desc
LF_ENTRY_DESCRIPTOR lk_Obj_lock_res_desc;
variable obj_lock_entry_desc
LF_ENTRY_DESCRIPTOR obj_lock_entry_desc;
Public Static Attributes Documentation
variable LK_COMPOSITE_LOCK_OID_INCREMENT
const int LK_COMPOSITE_LOCK_OID_INCREMENT;
variable LK_SLEEP_MAX_COUNT
const int LK_SLEEP_MAX_COUNT;
variable SIZEOF_LK_ACQOBJ_LOCK
const int SIZEOF_LK_ACQOBJ_LOCK;
variable SIZEOF_LK_DEADLOCK_VICTIM
const int SIZEOF_LK_DEADLOCK_VICTIM;
variable SIZEOF_LK_ENTRY_BLOCK
const int SIZEOF_LK_ENTRY_BLOCK;
variable SIZEOF_LK_LOCKINFO
const int SIZEOF_LK_LOCKINFO;
variable SIZEOF_LK_RES
variable SIZEOF_LK_RES_BLOCK
const int SIZEOF_LK_RES_BLOCK;
variable SIZEOF_LK_TRAN_LOCK
const int SIZEOF_LK_TRAN_LOCK;
variable SIZEOF_LK_WFG_EDGE
const int SIZEOF_LK_WFG_EDGE;
variable SIZEOF_LK_WFG_NODE
const int SIZEOF_LK_WFG_NODE;
variable lock_Deadlock_detect_daemon
cubthread::daemon* lock_Deadlock_detect_daemon;
variable victim_count
Public Functions Documentation
function REGISTER_DAEMON
REGISTER_DAEMON (
lock_deadlock_detect
)
function deadlock_detect_task_execute
void deadlock_detect_task_execute (
cubthread::entry & thread_ref
)
function lock_abort_composite_lock
void lock_abort_composite_lock (
LK_COMPOSITE_LOCK * comp_lock
)
function lock_add_composite_lock
int lock_add_composite_lock (
THREAD_ENTRY * thread_p,
LK_COMPOSITE_LOCK * comp_lock,
const OID * oid,
const OID * class_oid
)
function lock_classes_lock_hint
int lock_classes_lock_hint (
THREAD_ENTRY * thread_p,
LC_LOCKHINT * lockhint
)
function lock_clear_deadlock_victim
void lock_clear_deadlock_victim (
int tran_index
)
function lock_deadlock_detect_daemon_get_stats
void lock_deadlock_detect_daemon_get_stats (
UINT64 * statsp
)
function lock_demote_class_lock
int lock_demote_class_lock (
THREAD_ENTRY * thread_p,
const OID * oid,
LOCK lock,
LOCK * ex_lock
)
function lock_demote_read_class_lock_for_checksumdb
void lock_demote_read_class_lock_for_checksumdb (
THREAD_ENTRY * thread_p,
int tran_index,
const OID * class_oid
)
function lock_dump_acquired
void lock_dump_acquired (
FILE * fp,
LK_ACQUIRED_LOCKS * acqlocks
)
function lock_finalize
void lock_finalize (
void
)
function lock_finalize_composite_lock
int lock_finalize_composite_lock (
THREAD_ENTRY * thread_p,
LK_COMPOSITE_LOCK * comp_lock
)
function lock_force_thread_timeout_lock
void lock_force_thread_timeout_lock (
THREAD_ENTRY * thrd
)
function lock_get_class_lock
LK_ENTRY * lock_get_class_lock (
THREAD_ENTRY * thread_p,
const OID * class_oid
)
function lock_get_lock_holder_tran_index
int lock_get_lock_holder_tran_index (
THREAD_ENTRY * thread_p,
char ** out_buf,
int waiter_index,
LK_RES * res
)
function lock_get_number_object_locks
unsigned int lock_get_number_object_locks (
void
)
function lock_get_object_lock
LOCK lock_get_object_lock (
const OID * oid,
const OID * class_oid
)
function lock_has_lock_on_object
int lock_has_lock_on_object (
const OID * oid,
const OID * class_oid,
LOCK lock
)
function lock_has_lock_transaction
bool lock_has_lock_transaction (
int tran_index
)
function lock_has_xlock
bool lock_has_xlock (
THREAD_ENTRY * thread_p
)
function lock_hold_object_instant
int lock_hold_object_instant (
THREAD_ENTRY * thread_p,
const OID * oid,
const OID * class_oid,
LOCK lock
)
function lock_initialize
int lock_initialize (
void
)
function lock_initialize_composite_lock
int lock_initialize_composite_lock (
THREAD_ENTRY * thread_p,
LK_COMPOSITE_LOCK * comp_lock
)
function lock_is_instant_lock_mode
bool lock_is_instant_lock_mode (
int tran_index
)
function lock_is_waiting_transaction
bool lock_is_waiting_transaction (
int tran_index
)
function lock_notify_isolation_incons
void lock_notify_isolation_incons (
THREAD_ENTRY * thread_p,
bool (*)( const OID *class_oid, const OID *oid, void *args) fun,
void * args
)
function lock_object
int lock_object (
THREAD_ENTRY * thread_p,
const OID * oid,
const OID * class_oid,
LOCK lock,
int cond_flag
)
function lock_object_wait_msecs
int lock_object_wait_msecs (
THREAD_ENTRY * thread_p,
const OID * oid,
const OID * class_oid,
LOCK lock,
int cond_flag,
int wait_msecs
)
function lock_reacquire_crash_locks
int lock_reacquire_crash_locks (
THREAD_ENTRY * thread_p,
LK_ACQUIRED_LOCKS * acqlocks,
int tran_index
)
function lock_remove_all_inst_locks
void lock_remove_all_inst_locks (
THREAD_ENTRY * thread_p,
int tran_index,
const OID * class_oid,
LOCK lock
)
function lock_rep_read_tran
int lock_rep_read_tran (
THREAD_ENTRY * thread_p,
LOCK lock,
int cond_flag
)
function lock_scan
int lock_scan (
THREAD_ENTRY * thread_p,
const OID * class_oid,
int cond_flag,
LOCK class_lock
)
function lock_start_instant_lock_mode
void lock_start_instant_lock_mode (
int tran_index
)
function lock_stop_instant_lock_mode
void lock_stop_instant_lock_mode (
THREAD_ENTRY * thread_p,
int tran_index,
bool need_unlock
)
function lock_subclass
int lock_subclass (
THREAD_ENTRY * thread_p,
const OID * subclass_oid,
const OID * superclass_oid,
LOCK lock,
int cond_flag
)
function lock_unlock_all
void lock_unlock_all (
THREAD_ENTRY * thread_p
)
function lock_unlock_all_shared_get_all_exclusive
void lock_unlock_all_shared_get_all_exclusive (
THREAD_ENTRY * thread_p,
LK_ACQUIRED_LOCKS * acqlocks
)
function lock_unlock_classes_lock_hint
void lock_unlock_classes_lock_hint (
THREAD_ENTRY * thread_p,
LC_LOCKHINT * lockhint
)
function lock_unlock_object
void lock_unlock_object (
THREAD_ENTRY * thread_p,
const OID * oid,
const OID * class_oid,
LOCK lock,
bool force
)
function lock_unlock_object_donot_move_to_non2pl
void lock_unlock_object_donot_move_to_non2pl (
THREAD_ENTRY * thread_p,
const OID * oid,
const OID * class_oid,
LOCK lock
)
function lock_unlock_objects_lock_set
void lock_unlock_objects_lock_set (
THREAD_ENTRY * thread_p,
LC_LOCKSET * lockset
)
function lock_wait_state_to_string
const char * lock_wait_state_to_string (
int state
)
function xlock_dump
void xlock_dump (
THREAD_ENTRY * thread_p,
FILE * outfp,
int is_contention
)
Public Static Functions Documentation
function lock_add_WFG_edge
static int lock_add_WFG_edge (
int from_tran_index,
int to_tran_index,
int holder_flag,
INT64 edge_wait_stime
)
function lock_add_WFG_edge
static int lock_add_WFG_edge (
int from_tran_index,
int to_tran_index,
int holder_flag,
INT64 edge_wait_stime,
LK_ENTRY * holder,
LK_ENTRY * waiter
)
function lock_add_non2pl_lock
static LK_ENTRY * lock_add_non2pl_lock (
THREAD_ENTRY * thread_p,
LK_RES * res_ptr,
int tran_index,
LOCK lock
)
function lock_alloc_entry
static void * lock_alloc_entry (
void
)
function lock_alloc_resource
static void * lock_alloc_resource (
void
)
function lock_check_escalate
static bool lock_check_escalate (
THREAD_ENTRY * thread_p,
LK_ENTRY * class_entry,
LK_TRAN_LOCK * tran_lock
)
function lock_check_timeout_expired_and_count_suspended_mapfunc
static void lock_check_timeout_expired_and_count_suspended_mapfunc (
THREAD_ENTRY & thread_ref,
bool & stop_mapper,
size_t & suspend_count
)
function lock_compare_lock_info
static int lock_compare_lock_info (
const void * lockinfo1,
const void * lockinfo2
)
function lock_create_search_key
static LK_RES_KEY lock_create_search_key (
OID * oid,
OID * class_oid
)
function lock_deadlock_detect_daemon_destroy
static void lock_deadlock_detect_daemon_destroy ()
function lock_deadlock_detect_daemon_init
static void lock_deadlock_detect_daemon_init ()
function lock_dealloc_entry
static int lock_dealloc_entry (
void * res
)
function lock_dealloc_resource
static int lock_dealloc_resource (
void * res
)
function lock_decrement_class_granules
static void lock_decrement_class_granules (
LK_ENTRY * class_entry
)
function lock_delete_from_tran_hold_list
static int lock_delete_from_tran_hold_list (
LK_ENTRY * entry_ptr,
int owner_tran_index
)
function lock_delete_from_tran_non2pl_list
static int lock_delete_from_tran_non2pl_list (
LK_ENTRY * non2pl,
int owner_tran_index
)
function lock_demote_all_shared_class_locks
static void lock_demote_all_shared_class_locks (
THREAD_ENTRY * thread_p,
int tran_index
)
function lock_detect_local_deadlock
static void lock_detect_local_deadlock (
THREAD_ENTRY * thread_p
)
function lock_dump_deadlock_victims
static void lock_dump_deadlock_victims (
THREAD_ENTRY * thread_p,
FILE * outfile
)
function lock_dump_resource
static void lock_dump_resource (
THREAD_ENTRY * thread_p,
FILE * outfp,
LK_RES * res_ptr
)
function lock_escalate_if_needed
static int lock_escalate_if_needed (
THREAD_ENTRY * thread_p,
LK_ENTRY * class_entry,
int tran_index
)
function lock_event_log_blocked_lock
static void lock_event_log_blocked_lock (
THREAD_ENTRY * thread_p,
FILE * log_fp,
LK_ENTRY * entry
)
function lock_event_log_blocking_locks
static void lock_event_log_blocking_locks (
THREAD_ENTRY * thread_p,
FILE * log_fp,
LK_ENTRY * wait_entry
)
function lock_event_log_deadlock_locks
static void lock_event_log_deadlock_locks (
THREAD_ENTRY * thread_p,
FILE * log_fp,
int tran_index,
bool log_trunc,
int log_num_entries,
LK_ENTRY ** log_entries
)
function lock_event_log_lock_info
static void lock_event_log_lock_info (
THREAD_ENTRY * thread_p,
FILE * log_fp,
LK_ENTRY * entry
)
function lock_event_log_tran_locks
static void lock_event_log_tran_locks (
THREAD_ENTRY * thread_p,
FILE * log_fp,
int tran_index
)
function lock_event_set_tran_wait_entry
static void lock_event_set_tran_wait_entry (
int tran_index,
LK_ENTRY * entry
)
function lock_event_set_xasl_id_to_entry
static void lock_event_set_xasl_id_to_entry (
int tran_index,
LK_ENTRY * entry
)
function lock_finalize_deadlock_detection
static void lock_finalize_deadlock_detection (
void
)
function lock_finalize_object_lock_structures
static void lock_finalize_object_lock_structures (
void
)
function lock_finalize_tran_lock_table
static void lock_finalize_tran_lock_table (
void
)
function lock_find_class_entry
static LK_ENTRY * lock_find_class_entry (
int tran_index,
const OID * class_oid
)
function lock_find_tran_hold_entry
static LK_ENTRY * lock_find_tran_hold_entry (
THREAD_ENTRY * thread_p,
int tran_index,
const OID * oid,
bool is_class
)
function lock_force_timeout_expired_wait_transactions
static bool lock_force_timeout_expired_wait_transactions (
void * thrd_entry
)
function lock_free_entry
static void lock_free_entry (
int tran_index,
LF_TRAN_ENTRY * tran_entry,
LF_FREELIST * freelist,
LK_ENTRY * lock_entry
)
function lock_get_hash_value
static unsigned int lock_get_hash_value (
const OID * oid,
int htsize
)
function lock_get_new_entry
static LK_ENTRY * lock_get_new_entry (
int tran_index,
LF_TRAN_ENTRY * tran_entry,
LF_FREELIST * freelist
)
function lock_get_transaction_lock_waiting_threads
static void lock_get_transaction_lock_waiting_threads (
int tran_index,
tran_lock_waiters_array_type & tran_lock_waiters,
size_t & count
)
function lock_get_transaction_lock_waiting_threads_mapfunc
static void lock_get_transaction_lock_waiting_threads_mapfunc (
THREAD_ENTRY & thread_ref,
bool & stop_mapper,
int tran_index,
tran_lock_waiters_array_type & tran_lock_waiters,
size_t & count
)
function lock_grant_blocked_holder
static void lock_grant_blocked_holder (
THREAD_ENTRY * thread_p,
LK_RES * res_ptr
)
function lock_grant_blocked_waiter
static int lock_grant_blocked_waiter (
THREAD_ENTRY * thread_p,
LK_RES * res_ptr
)
function lock_grant_blocked_waiter_partial
static void lock_grant_blocked_waiter_partial (
THREAD_ENTRY * thread_p,
LK_RES * res_ptr,
LK_ENTRY * from_whom
)
function lock_increment_class_granules
static void lock_increment_class_granules (
LK_ENTRY * class_entry
)
function lock_init_entry
static int lock_init_entry (
void * res
)
function lock_init_resource
static int lock_init_resource (
void * res
)
function lock_initialize_deadlock_detection
static int lock_initialize_deadlock_detection (
void
)
function lock_initialize_entry
static void lock_initialize_entry (
LK_ENTRY * entry_ptr
)
function lock_initialize_entry_as_blocked
static void lock_initialize_entry_as_blocked (
LK_ENTRY * entry_ptr,
THREAD_ENTRY * thread_p,
int tran_index,
LK_RES * res,
LOCK lock
)
function lock_initialize_entry_as_granted
static void lock_initialize_entry_as_granted (
LK_ENTRY * entry_ptr,
int tran_index,
LK_RES * res,
LOCK lock
)
function lock_initialize_entry_as_non2pl
static void lock_initialize_entry_as_non2pl (
LK_ENTRY * entry_ptr,
int tran_index,
LK_RES * res,
LOCK lock
)
function lock_initialize_object_lock_structures
static int lock_initialize_object_lock_structures (
void
)
function lock_initialize_resource
static void lock_initialize_resource (
LK_RES * res_ptr
)
function lock_initialize_resource_as_allocated
static void lock_initialize_resource_as_allocated (
LK_RES * res_ptr,
LOCK lock
)
function lock_initialize_tran_lock_table
static int lock_initialize_tran_lock_table (
void
)
function lock_initialize_with_config
static int lock_initialize_with_config (
const LK_CONFIG * config
)
function lock_insert_into_tran_hold_list
static void lock_insert_into_tran_hold_list (
LK_ENTRY * entry_ptr,
int owner_tran_index
)
function lock_insert_into_tran_non2pl_list
static void lock_insert_into_tran_non2pl_list (
LK_ENTRY * non2pl,
int owner_tran_index
)
function lock_internal_demote_class_lock
static int lock_internal_demote_class_lock (
THREAD_ENTRY * thread_p,
LK_ENTRY * entry_ptr,
LOCK to_be_lock,
LOCK * ex_lock
)
function lock_internal_hold_lock_object_instant
static int lock_internal_hold_lock_object_instant (
THREAD_ENTRY * thread_p,
int tran_index,
const OID * oid,
const OID * class_oid,
LOCK lock
)
static int lock_internal_perform_lock_object (
THREAD_ENTRY * thread_p,
int tran_index,
const OID * oid,
const OID * class_oid,
LOCK lock,
int wait_msecs,
LK_ENTRY ** entry_addr_ptr,
LK_ENTRY * class_entry
)
static void lock_internal_perform_unlock_object (
THREAD_ENTRY * thread_p,
LK_ENTRY * entry_ptr,
bool release_flag,
bool move_to_non2pl
)
function lock_is_class_lock_escalated
static bool lock_is_class_lock_escalated (
LOCK class_lock,
LOCK lock_escalation
)
function lock_is_local_deadlock_detection_interval_up
static bool lock_is_local_deadlock_detection_interval_up (
void
)
function lock_is_safe_lock_with_page
static bool lock_is_safe_lock_with_page (
THREAD_ENTRY * thread_p,
LK_ENTRY * entry_ptr
)
function lock_make_default_config
static LK_CONFIG lock_make_default_config (
void
)
function lock_make_runtime_config
static LK_CONFIG lock_make_runtime_config (
void
)
function lock_position_holder_entry
static void lock_position_holder_entry (
LK_RES * res_ptr,
LK_ENTRY * entry_ptr
)
function lock_remove_all_class_locks
static void lock_remove_all_class_locks (
THREAD_ENTRY * thread_p,
int tran_index,
LOCK lock
)
function lock_remove_non2pl
static void lock_remove_non2pl (
THREAD_ENTRY * thread_p,
LK_ENTRY * non2pl,
int tran_index
)
function lock_remove_resource
static int lock_remove_resource (
THREAD_ENTRY * thread_p,
LK_RES * res_ptr
)
function lock_res_key_compare
static int lock_res_key_compare (
void * k1,
void * k2
)
function lock_res_key_copy
static int lock_res_key_copy (
void * src,
void * dest
)
function lock_res_key_hash
static unsigned int lock_res_key_hash (
void * key,
int htsize
)
function lock_resume
static void lock_resume (
LK_ENTRY * entry_ptr,
int state
)
function lock_select_deadlock_victim
static void lock_select_deadlock_victim (
THREAD_ENTRY * thread_p,
int s,
int t
)
function lock_set_error_for_aborted
static void lock_set_error_for_aborted (
LK_ENTRY * entry_ptr
)
function lock_set_error_for_timeout
static void lock_set_error_for_timeout (
THREAD_ENTRY * thread_p,
LK_ENTRY * entry_ptr
)
function lock_set_tran_abort_reason
static void lock_set_tran_abort_reason (
int tran_index,
TRAN_ABORT_REASON abort_reason
)
function lock_suspend
static LOCK_WAIT_STATE lock_suspend (
THREAD_ENTRY * thread_p,
LK_ENTRY * entry_ptr,
int wait_msecs
)
function lock_uninit_entry
static int lock_uninit_entry (
void * res
)
function lock_uninit_resource
static int lock_uninit_resource (
void * res
)
function lock_unlock_inst_locks_of_class_by_isolation
static void lock_unlock_inst_locks_of_class_by_isolation (
THREAD_ENTRY * thread_p,
int tran_index,
TRAN_ISOLATION isolation,
const OID * class_oid
)
function lock_unlock_object_by_isolation
static void lock_unlock_object_by_isolation (
THREAD_ENTRY * thread_p,
int tran_index,
TRAN_ISOLATION isolation,
const OID * class_oid,
const OID * oid
)
function lock_unlock_object_lock_internal
static void lock_unlock_object_lock_internal (
THREAD_ENTRY * thread_p,
const OID * oid,
const OID * class_oid,
LOCK lock,
int release_flag,
int move_to_non2pl
)
function lock_unlock_shared_inst_lock
static void lock_unlock_shared_inst_lock (
THREAD_ENTRY * thread_p,
int tran_index,
const OID * inst_oid
)
function lock_update_non2pl_list
static void lock_update_non2pl_list (
THREAD_ENTRY * thread_p,
LK_RES * res_ptr,
int tran_index,
LOCK lock
)
function lock_victimize_first_thread_mapfunc
static void lock_victimize_first_thread_mapfunc (
THREAD_ENTRY & thread_ref,
bool & stop_mapper
)
function lock_wait_msecs_to_secs
static float lock_wait_msecs_to_secs (
int msecs
)
function lock_wakeup_deadlock_victim_aborted
static bool lock_wakeup_deadlock_victim_aborted (
int tran_index
)
function lock_wakeup_deadlock_victim_timeout
static bool lock_wakeup_deadlock_victim_timeout (
int tran_index
)
Macro Definition Documentation
define CLEAR_EMULATE_THREAD
#define CLEAR_EMULATE_THREAD (
th
) `/* multi line expression */`
define DEFAULT_WAIT_USERS
#define DEFAULT_WAIT_USERS `10`
define EXPAND_WAIT_FOR_ARRAY_IF_NEEDED
#define EXPAND_WAIT_FOR_ARRAY_IF_NEEDED (
) `/* multi line expression */`
define HOLDER_ENTRY_LENGTH
#define HOLDER_ENTRY_LENGTH `(12)`
define KEY_LOCK_ESCALATION_THRESHOLD
#define KEY_LOCK_ESCALATION_THRESHOLD `10 /* key lock escalation threshold */`
define LK_CAN_TIMEOUT
#define LK_CAN_TIMEOUT (
msecs
) `(( msecs ) != LK_INFINITE_WAIT )`
define LK_ISYOUNGER
#define LK_ISYOUNGER (
young_tranid,
old_tranid
) `( young_tranid > old_tranid )`
define LK_IS_LOCKWAIT_THREAD
#define LK_IS_LOCKWAIT_THREAD (
thrd
) `/* multi line expression */`
define LK_LOCKINFO_FIXED_COUNT
#define LK_LOCKINFO_FIXED_COUNT `30`
define LK_MSG_LOCK_ACQUIRED
#define LK_MSG_LOCK_ACQUIRED (
entry
) `LK_MSG_LOCK_HELPER (entry, MSGCAT_LK_OID_LOCK_ACQUIRED )`
define LK_MSG_LOCK_CONVERTED
#define LK_MSG_LOCK_CONVERTED (
entry
) `LK_MSG_LOCK_HELPER (entry, MSGCAT_LK_OID_LOCK_CONVERTED )`
define LK_MSG_LOCK_DEMOTE
#define LK_MSG_LOCK_DEMOTE (
entry
) `LK_MSG_LOCK_HELPER (entry, MSGCAT_LK_OID_LOCK_DEMOTE )`
define LK_MSG_LOCK_HELPER
#define LK_MSG_LOCK_HELPER (
entry,
msgnum
) `/* multi line expression */`
define LK_MSG_LOCK_RELEASE
#define LK_MSG_LOCK_RELEASE (
entry
) `LK_MSG_LOCK_HELPER (entry, MSGCAT_LK_OID_LOCK_RELEASE )`
define LK_MSG_LOCK_WAITFOR
#define LK_MSG_LOCK_WAITFOR (
entry
) `LK_MSG_LOCK_HELPER (entry, MSGCAT_LK_OID_LOCK_WAITFOR )`
define LK_OBJ_LOCK_HASH
#define LK_OBJ_LOCK_HASH (
oid,
htsize
) `(( OID_ISTEMP (oid)) ? ( unsigned int )(-((oid)->pageid) % htsize ) :\ lock_get_hash_value (oid, htsize ))`
define MAX_NUM_LOCKS_DUMP_TO_EVENT_LOG
#define MAX_NUM_LOCKS_DUMP_TO_EVENT_LOG `100`
define MSGCAT_LK_DEADLOCK_ABORT
#define MSGCAT_LK_DEADLOCK_ABORT `38`
define MSGCAT_LK_DEADLOCK_ABORT_HDR
#define MSGCAT_LK_DEADLOCK_ABORT_HDR `37`
define MSGCAT_LK_DEADLOCK_FUN
#define MSGCAT_LK_DEADLOCK_FUN `42`
define MSGCAT_LK_DEADLOCK_FUN_HDR
#define MSGCAT_LK_DEADLOCK_FUN_HDR `41`
define MSGCAT_LK_DEADLOCK_TIMEOUT
#define MSGCAT_LK_DEADLOCK_TIMEOUT `40`
define MSGCAT_LK_DEADLOCK_TIMEOUT_HDR
#define MSGCAT_LK_DEADLOCK_TIMEOUT_HDR `39`
define MSGCAT_LK_DUMP_LOCK_TABLE
#define MSGCAT_LK_DUMP_LOCK_TABLE `32`
define MSGCAT_LK_DUMP_TRAN_IDENTIFIERS
#define MSGCAT_LK_DUMP_TRAN_IDENTIFIERS `33`
define MSGCAT_LK_DUMP_TRAN_ISOLATION
#define MSGCAT_LK_DUMP_TRAN_ISOLATION `34`
define MSGCAT_LK_DUMP_TRAN_STATE
#define MSGCAT_LK_DUMP_TRAN_STATE `35`
define MSGCAT_LK_DUMP_TRAN_TIMEOUT_PERIOD
#define MSGCAT_LK_DUMP_TRAN_TIMEOUT_PERIOD `36`
define MSGCAT_LK_INDEXNAME
#define MSGCAT_LK_INDEXNAME `44`
define MSGCAT_LK_LASTONE
#define MSGCAT_LK_LASTONE `47`
define MSGCAT_LK_MVCC_INFO
#define MSGCAT_LK_MVCC_INFO `46`
define MSGCAT_LK_NEWLINE
#define MSGCAT_LK_NEWLINE `1`
define MSGCAT_LK_OID_LOCK_ACQUIRED
#define MSGCAT_LK_OID_LOCK_ACQUIRED `4`
define MSGCAT_LK_OID_LOCK_CONVERTED
#define MSGCAT_LK_OID_LOCK_CONVERTED `6`
define MSGCAT_LK_OID_LOCK_DEMOTE
#define MSGCAT_LK_OID_LOCK_DEMOTE `12`
define MSGCAT_LK_OID_LOCK_RELEASE
#define MSGCAT_LK_OID_LOCK_RELEASE `10`
define MSGCAT_LK_OID_LOCK_WAITFOR
#define MSGCAT_LK_OID_LOCK_WAITFOR `8`
define MSGCAT_LK_RESUME_TRAN
#define MSGCAT_LK_RESUME_TRAN `3`
define MSGCAT_LK_RES_BLOCKED_HOLDER_ENTRY
#define MSGCAT_LK_RES_BLOCKED_HOLDER_ENTRY `27`
define MSGCAT_LK_RES_BLOCKED_HOLDER_ENTRY_WITH_GRANULE
#define MSGCAT_LK_RES_BLOCKED_HOLDER_ENTRY_WITH_GRANULE `28`
define MSGCAT_LK_RES_BLOCKED_HOLDER_HEAD
#define MSGCAT_LK_RES_BLOCKED_HOLDER_HEAD `22`
define MSGCAT_LK_RES_BLOCKED_WAITER_ENTRY
#define MSGCAT_LK_RES_BLOCKED_WAITER_ENTRY `29`
define MSGCAT_LK_RES_BLOCKED_WAITER_HEAD
#define MSGCAT_LK_RES_BLOCKED_WAITER_HEAD `23`
define MSGCAT_LK_RES_CLASS_TYPE
#define MSGCAT_LK_RES_CLASS_TYPE `16`
define MSGCAT_LK_RES_INDEX_KEY_TYPE
#define MSGCAT_LK_RES_INDEX_KEY_TYPE `43`
define MSGCAT_LK_RES_INSTANCE_TYPE
#define MSGCAT_LK_RES_INSTANCE_TYPE `17`
define MSGCAT_LK_RES_LOCK_COUNT
#define MSGCAT_LK_RES_LOCK_COUNT `20`
define MSGCAT_LK_RES_NON2PL_RELEASED_ENTRY
#define MSGCAT_LK_RES_NON2PL_RELEASED_ENTRY `30`
define MSGCAT_LK_RES_NON2PL_RELEASED_HEAD
#define MSGCAT_LK_RES_NON2PL_RELEASED_HEAD `24`
define MSGCAT_LK_RES_NON_BLOCKED_HOLDER_ENTRY
#define MSGCAT_LK_RES_NON_BLOCKED_HOLDER_ENTRY `25`
define MSGCAT_LK_RES_NON_BLOCKED_HOLDER_ENTRY_WITH_GRANULE
#define MSGCAT_LK_RES_NON_BLOCKED_HOLDER_ENTRY_WITH_GRANULE `26`
define MSGCAT_LK_RES_NON_BLOCKED_HOLDER_HEAD
#define MSGCAT_LK_RES_NON_BLOCKED_HOLDER_HEAD `21`
define MSGCAT_LK_RES_OID
#define MSGCAT_LK_RES_OID `14`
define MSGCAT_LK_RES_ROOT_CLASS_TYPE
#define MSGCAT_LK_RES_ROOT_CLASS_TYPE `15`
define MSGCAT_LK_RES_RR_TYPE
#define MSGCAT_LK_RES_RR_TYPE `45`
define MSGCAT_LK_RES_TOTAL_MODE
#define MSGCAT_LK_RES_TOTAL_MODE `19`
define MSGCAT_LK_RES_UNKNOWN_TYPE
#define MSGCAT_LK_RES_UNKNOWN_TYPE `18`
define MSGCAT_LK_RES_VPID
#define MSGCAT_LK_RES_VPID `31`
define MSGCAT_LK_SUSPEND_TRAN
#define MSGCAT_LK_SUSPEND_TRAN `2`
define MSGCAT_LK_VPID_LOCK_ACQUIRED
#define MSGCAT_LK_VPID_LOCK_ACQUIRED `5`
define MSGCAT_LK_VPID_LOCK_CONVERTED
#define MSGCAT_LK_VPID_LOCK_CONVERTED `7`
define MSGCAT_LK_VPID_LOCK_DEMOTE
#define MSGCAT_LK_VPID_LOCK_DEMOTE `13`
define MSGCAT_LK_VPID_LOCK_RELEASE
#define MSGCAT_LK_VPID_LOCK_RELEASE `11`
define MSGCAT_LK_VPID_LOCK_WAITFOR
#define MSGCAT_LK_VPID_LOCK_WAITFOR `9`
define RESOURCE_ALLOC_WAIT_TIME
#define RESOURCE_ALLOC_WAIT_TIME `10 /* 10 msec */`
define SET_EMULATE_THREAD_WITH_LOCK_ENTRY
#define SET_EMULATE_THREAD_WITH_LOCK_ENTRY (
th,
lock_entry
) `/* multi line expression */`
define TEMP_BUFFER_SIZE
#define TEMP_BUFFER_SIZE `128`
#define __STDC_FORMAT_MACROS
The documentation for this class was generated from the following file cubrid/src/transaction/lock_manager.c