CUBRID Engine  latest
lock_manager.c File Reference
#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"

Go to the source code of this file.

Macros

#define RESOURCE_ALLOC_WAIT_TIME   10 /* 10 msec */
 
#define KEY_LOCK_ESCALATION_THRESHOLD   10 /* key lock escalation threshold */
 
#define MAX_NUM_LOCKS_DUMP_TO_EVENT_LOG   100
 
#define MSGCAT_LK_NEWLINE   1
 
#define MSGCAT_LK_SUSPEND_TRAN   2
 
#define MSGCAT_LK_RESUME_TRAN   3
 
#define MSGCAT_LK_OID_LOCK_ACQUIRED   4
 
#define MSGCAT_LK_VPID_LOCK_ACQUIRED   5
 
#define MSGCAT_LK_OID_LOCK_CONVERTED   6
 
#define MSGCAT_LK_VPID_LOCK_CONVERTED   7
 
#define MSGCAT_LK_OID_LOCK_WAITFOR   8
 
#define MSGCAT_LK_VPID_LOCK_WAITFOR   9
 
#define MSGCAT_LK_OID_LOCK_RELEASE   10
 
#define MSGCAT_LK_VPID_LOCK_RELEASE   11
 
#define MSGCAT_LK_OID_LOCK_DEMOTE   12
 
#define MSGCAT_LK_VPID_LOCK_DEMOTE   13
 
#define MSGCAT_LK_RES_OID   14
 
#define MSGCAT_LK_RES_ROOT_CLASS_TYPE   15
 
#define MSGCAT_LK_RES_CLASS_TYPE   16
 
#define MSGCAT_LK_RES_INSTANCE_TYPE   17
 
#define MSGCAT_LK_RES_UNKNOWN_TYPE   18
 
#define MSGCAT_LK_RES_TOTAL_MODE   19
 
#define MSGCAT_LK_RES_LOCK_COUNT   20
 
#define MSGCAT_LK_RES_NON_BLOCKED_HOLDER_HEAD   21
 
#define MSGCAT_LK_RES_BLOCKED_HOLDER_HEAD   22
 
#define MSGCAT_LK_RES_BLOCKED_WAITER_HEAD   23
 
#define MSGCAT_LK_RES_NON2PL_RELEASED_HEAD   24
 
#define MSGCAT_LK_RES_NON_BLOCKED_HOLDER_ENTRY   25
 
#define MSGCAT_LK_RES_NON_BLOCKED_HOLDER_ENTRY_WITH_GRANULE   26
 
#define MSGCAT_LK_RES_BLOCKED_HOLDER_ENTRY   27
 
#define MSGCAT_LK_RES_BLOCKED_HOLDER_ENTRY_WITH_GRANULE   28
 
#define MSGCAT_LK_RES_BLOCKED_WAITER_ENTRY   29
 
#define MSGCAT_LK_RES_NON2PL_RELEASED_ENTRY   30
 
#define MSGCAT_LK_RES_VPID   31
 
#define MSGCAT_LK_DUMP_LOCK_TABLE   32
 
#define MSGCAT_LK_DUMP_TRAN_IDENTIFIERS   33
 
#define MSGCAT_LK_DUMP_TRAN_ISOLATION   34
 
#define MSGCAT_LK_DUMP_TRAN_STATE   35
 
#define MSGCAT_LK_DUMP_TRAN_TIMEOUT_PERIOD   36
 
#define MSGCAT_LK_DEADLOCK_ABORT_HDR   37
 
#define MSGCAT_LK_DEADLOCK_ABORT   38
 
#define MSGCAT_LK_DEADLOCK_TIMEOUT_HDR   39
 
#define MSGCAT_LK_DEADLOCK_TIMEOUT   40
 
#define MSGCAT_LK_DEADLOCK_FUN_HDR   41
 
#define MSGCAT_LK_DEADLOCK_FUN   42
 
#define MSGCAT_LK_RES_INDEX_KEY_TYPE   43
 
#define MSGCAT_LK_INDEXNAME   44
 
#define MSGCAT_LK_RES_RR_TYPE   45
 
#define MSGCAT_LK_MVCC_INFO   46
 
#define MSGCAT_LK_LASTONE   47
 
#define LK_SET_STANDALONE_XLOCK(lock)
 

Typedefs

using tran_lock_waiters_array_type = std::array< THREAD_ENTRY *, DEFAULT_LOCK_WAITING_THREAD_ARRAY_SIZE >
 

Enumerations

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
}
 

Functions

int lock_demote_class_lock (THREAD_ENTRY *thread_p, const OID *oid, LOCK lock, LOCK *ex_lock)
 
int lock_initialize (void)
 
void lock_finalize (void)
 
int lock_hold_object_instant (THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock)
 
int lock_object (THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock, int cond_flag)
 
int lock_subclass (THREAD_ENTRY *thread_p, const OID *subclass_oid, const OID *superclass_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_scan (THREAD_ENTRY *thread_p, const OID *class_oid, int cond_flag, LOCK class_lock)
 
int lock_classes_lock_hint (THREAD_ENTRY *thread_p, LC_LOCKHINT *lockhint)
 
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)
 
void lock_unlock_object_donot_move_to_non2pl (THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock)
 
void lock_remove_object_lock (THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock)
 
void lock_unlock_object (THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock, bool force)
 
void lock_unlock_objects_lock_set (THREAD_ENTRY *thread_p, LC_LOCKSET *lockset)
 
void lock_unlock_classes_lock_hint (THREAD_ENTRY *thread_p, LC_LOCKHINT *lockhint)
 
void lock_unlock_all (THREAD_ENTRY *thread_p)
 
static LK_ENTRYlock_find_tran_hold_entry (THREAD_ENTRY *thread_p, int tran_index, const OID *oid, bool is_class)
 
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_xlock (THREAD_ENTRY *thread_p)
 
bool lock_is_waiting_transaction (int tran_index)
 
LK_ENTRYlock_get_class_lock (THREAD_ENTRY *thread_p, const OID *class_oid)
 
void lock_force_thread_timeout_lock (THREAD_ENTRY *thrd)
 
static bool lock_force_timeout_expired_wait_transactions (void *thrd_entry)
 
void lock_notify_isolation_incons (THREAD_ENTRY *thread_p, bool(*fun)(const OID *class_oid, const OID *oid, void *args), void *args)
 
static bool lock_is_local_deadlock_detection_interval_up (void)
 
static void lock_victimize_first_thread_mapfunc (THREAD_ENTRY &thread_ref, bool &stop_mapper)
 
static void lock_detect_local_deadlock (THREAD_ENTRY *thread_p)
 
int lock_reacquire_crash_locks (THREAD_ENTRY *thread_p, LK_ACQUIRED_LOCKS *acqlocks, int tran_index)
 
void lock_unlock_all_shared_get_all_exclusive (THREAD_ENTRY *thread_p, LK_ACQUIRED_LOCKS *acqlocks)
 
void lock_dump_acquired (FILE *fp, LK_ACQUIRED_LOCKS *acqlocks)
 
void xlock_dump (THREAD_ENTRY *thread_p, FILE *outfp)
 
int lock_initialize_composite_lock (THREAD_ENTRY *thread_p, 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_finalize_composite_lock (THREAD_ENTRY *thread_p, LK_COMPOSITE_LOCK *comp_lock)
 
void lock_abort_composite_lock (LK_COMPOSITE_LOCK *comp_lock)
 
static bool lock_is_class_lock_escalated (LOCK class_lock, LOCK lock_escalation)
 
unsigned int lock_get_number_object_locks (void)
 
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)
 
void lock_clear_deadlock_victim (int tran_index)
 
bool lock_is_instant_lock_mode (int tran_index)
 
int lock_get_lock_holder_tran_index (THREAD_ENTRY *thread_p, char **out_buf, int waiter_index, LK_RES *res)
 
const char * lock_wait_state_to_string (int state)
 
int lock_rep_read_tran (THREAD_ENTRY *thread_p, LOCK lock, int cond_flag)
 
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)
 
static void lock_get_transaction_lock_waiting_threads (int tran_index, tran_lock_waiters_array_type &tran_lock_waiters, size_t &count)
 

Variables

LOCK_COMPATIBILITY lock_Comp [12][12]
 
static int lk_Standalone_has_xlock = 0
 
const size_t DEFAULT_LOCK_WAITING_THREAD_ARRAY_SIZE = 10
 

Macro Definition Documentation

#define KEY_LOCK_ESCALATION_THRESHOLD   10 /* key lock escalation threshold */

Definition at line 168 of file lock_manager.c.

#define LK_SET_STANDALONE_XLOCK (   lock)
Value:
do { \
if ((lock) == SCH_M_LOCK || (lock) == X_LOCK || lock == IX_LOCK \
|| lock == SIX_LOCK) \
{ \
} \
} while (0)
static int lk_Standalone_has_xlock
Definition: lock_manager.c:456
if(extra_options)
Definition: dynamic_load.c:958

Definition at line 457 of file lock_manager.c.

Referenced by lock_hold_object_instant(), lock_object(), lock_object_wait_msecs(), lock_rep_read_tran(), and lock_subclass().

#define MAX_NUM_LOCKS_DUMP_TO_EVENT_LOG   100

Definition at line 169 of file lock_manager.c.

Referenced by lock_wait_state_to_string().

#define MSGCAT_LK_DEADLOCK_ABORT   38

Definition at line 226 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_DEADLOCK_ABORT_HDR   37

Definition at line 225 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_DEADLOCK_FUN   42

Definition at line 230 of file lock_manager.c.

#define MSGCAT_LK_DEADLOCK_FUN_HDR   41

Definition at line 229 of file lock_manager.c.

#define MSGCAT_LK_DEADLOCK_TIMEOUT   40

Definition at line 228 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_DEADLOCK_TIMEOUT_HDR   39

Definition at line 227 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_DUMP_LOCK_TABLE   32

Definition at line 220 of file lock_manager.c.

Referenced by xlock_dump().

#define MSGCAT_LK_DUMP_TRAN_IDENTIFIERS   33

Definition at line 221 of file lock_manager.c.

Referenced by xlock_dump().

#define MSGCAT_LK_DUMP_TRAN_ISOLATION   34

Definition at line 222 of file lock_manager.c.

Referenced by xlock_dump().

#define MSGCAT_LK_DUMP_TRAN_STATE   35

Definition at line 223 of file lock_manager.c.

Referenced by xlock_dump().

#define MSGCAT_LK_DUMP_TRAN_TIMEOUT_PERIOD   36

Definition at line 224 of file lock_manager.c.

Referenced by xlock_dump().

#define MSGCAT_LK_INDEXNAME   44

Definition at line 232 of file lock_manager.c.

#define MSGCAT_LK_LASTONE   47

Definition at line 235 of file lock_manager.c.

#define MSGCAT_LK_MVCC_INFO   46

Definition at line 234 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_NEWLINE   1

Definition at line 189 of file lock_manager.c.

Referenced by lock_demote_class_lock(), and xlock_dump().

#define MSGCAT_LK_OID_LOCK_ACQUIRED   4

Definition at line 192 of file lock_manager.c.

#define MSGCAT_LK_OID_LOCK_CONVERTED   6

Definition at line 194 of file lock_manager.c.

#define MSGCAT_LK_OID_LOCK_DEMOTE   12

Definition at line 200 of file lock_manager.c.

#define MSGCAT_LK_OID_LOCK_RELEASE   10

Definition at line 198 of file lock_manager.c.

#define MSGCAT_LK_OID_LOCK_WAITFOR   8

Definition at line 196 of file lock_manager.c.

#define MSGCAT_LK_RES_BLOCKED_HOLDER_ENTRY   27

Definition at line 215 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_BLOCKED_HOLDER_ENTRY_WITH_GRANULE   28

Definition at line 216 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_BLOCKED_HOLDER_HEAD   22

Definition at line 210 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_BLOCKED_WAITER_ENTRY   29

Definition at line 217 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_BLOCKED_WAITER_HEAD   23

Definition at line 211 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_CLASS_TYPE   16

Definition at line 204 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_INDEX_KEY_TYPE   43

Definition at line 231 of file lock_manager.c.

#define MSGCAT_LK_RES_INSTANCE_TYPE   17

Definition at line 205 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_LOCK_COUNT   20

Definition at line 208 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_NON2PL_RELEASED_ENTRY   30

Definition at line 218 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_NON2PL_RELEASED_HEAD   24

Definition at line 212 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_NON_BLOCKED_HOLDER_ENTRY   25

Definition at line 213 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_NON_BLOCKED_HOLDER_ENTRY_WITH_GRANULE   26

Definition at line 214 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_NON_BLOCKED_HOLDER_HEAD   21

Definition at line 209 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_OID   14

Definition at line 202 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_ROOT_CLASS_TYPE   15

Definition at line 203 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_RR_TYPE   45

Definition at line 233 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_TOTAL_MODE   19

Definition at line 207 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_UNKNOWN_TYPE   18

Definition at line 206 of file lock_manager.c.

Referenced by lock_demote_class_lock().

#define MSGCAT_LK_RES_VPID   31

Definition at line 219 of file lock_manager.c.

#define MSGCAT_LK_RESUME_TRAN   3

Definition at line 191 of file lock_manager.c.

#define MSGCAT_LK_SUSPEND_TRAN   2

Definition at line 190 of file lock_manager.c.

#define MSGCAT_LK_VPID_LOCK_ACQUIRED   5

Definition at line 193 of file lock_manager.c.

#define MSGCAT_LK_VPID_LOCK_CONVERTED   7

Definition at line 195 of file lock_manager.c.

#define MSGCAT_LK_VPID_LOCK_DEMOTE   13

Definition at line 201 of file lock_manager.c.

#define MSGCAT_LK_VPID_LOCK_RELEASE   11

Definition at line 199 of file lock_manager.c.

#define MSGCAT_LK_VPID_LOCK_WAITFOR   9

Definition at line 197 of file lock_manager.c.

#define RESOURCE_ALLOC_WAIT_TIME   10 /* 10 msec */

Definition at line 167 of file lock_manager.c.

Typedef Documentation

Enumeration Type Documentation

Enumerator
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 

Definition at line 172 of file lock_manager.c.

Function Documentation

void lock_clear_deadlock_victim ( int  tran_index)

Definition at line 8967 of file lock_manager.c.

References pthread_mutex_lock, pthread_mutex_unlock, rv, and TRAN_NORMAL.

Referenced by lock_unlock_all(), and qexec_execute_selupd_list().

Here is the caller graph for this function:

int lock_demote_class_lock ( THREAD_ENTRY thread_p,
const OID oid,
LOCK  lock,
LOCK ex_lock 
)

Definition at line 4169 of file lock_manager.c.

References ARG_FILE_LINE, assert, assert_release, lk_res_key::class_oid, COPY_OID, cubregex::count(), CTIME_MAX, CUB_MAXHOSTNAMELEN, er_clear(), er_errid(), ER_ERROR_SEVERITY, ER_FAILED, ER_INTERRUPTED, ER_LK_DEADLOCK_CYCLE_DETECTED, ER_LK_NOTFOUND_IN_LOCK_HOLDER_LIST, er_log_debug, ER_NOTIFICATION_SEVERITY, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), free_and_init, heap_get_class_name(), heap_get_visible_version(), heap_scancache_end(), heap_scancache_quick_start(), lk_res::holder, i, INCON_NON_TWO_PHASE_LOCK, IS_LOCK, IX_LOCK, lk_res::key, lock_Comp, LOCK_COMPAT_NO, LOCK_COMPAT_UNKNOWN, lock_Conv, lock_demote_read_class_lock_for_checksumdb(), lock_find_tran_hold_entry(), LOCK_RESOURCE_CLASS, LOCK_RESOURCE_INSTANCE, LOCK_RESOURCE_ROOT_CLASS, LOCK_TO_LOCKMODE_STRING, LOG_FIND_THREAD_TRAN_INDEX, log_state_string(), LOG_USERNAME_MAX, logtb_find_client_name_host_pid(), logtb_find_log_records_count(), logtb_find_state(), logtb_find_tranid(), logtb_find_wait_msecs(), logtb_has_deadlock_priority(), logtb_is_active(), MSGCAT_CATALOG_CUBRID, MSGCAT_LK_DEADLOCK_ABORT, MSGCAT_LK_DEADLOCK_ABORT_HDR, MSGCAT_LK_DEADLOCK_TIMEOUT, MSGCAT_LK_DEADLOCK_TIMEOUT_HDR, MSGCAT_LK_MVCC_INFO, MSGCAT_LK_NEWLINE, MSGCAT_LK_RES_BLOCKED_HOLDER_ENTRY, MSGCAT_LK_RES_BLOCKED_HOLDER_ENTRY_WITH_GRANULE, MSGCAT_LK_RES_BLOCKED_HOLDER_HEAD, MSGCAT_LK_RES_BLOCKED_WAITER_ENTRY, MSGCAT_LK_RES_BLOCKED_WAITER_HEAD, MSGCAT_LK_RES_CLASS_TYPE, MSGCAT_LK_RES_INSTANCE_TYPE, MSGCAT_LK_RES_LOCK_COUNT, MSGCAT_LK_RES_NON2PL_RELEASED_ENTRY, MSGCAT_LK_RES_NON2PL_RELEASED_HEAD, MSGCAT_LK_RES_NON_BLOCKED_HOLDER_ENTRY, MSGCAT_LK_RES_NON_BLOCKED_HOLDER_ENTRY_WITH_GRANULE, MSGCAT_LK_RES_NON_BLOCKED_HOLDER_HEAD, MSGCAT_LK_RES_OID, MSGCAT_LK_RES_ROOT_CLASS_TYPE, MSGCAT_LK_RES_RR_TYPE, MSGCAT_LK_RES_TOTAL_MODE, MSGCAT_LK_RES_UNKNOWN_TYPE, msgcat_message(), MSGCAT_SET_LOCK, MVCC_GET_DELID, MVCC_GET_INSID, MVCC_IS_FLAG_SET, MVCC_IS_HEADER_DELID_VALID, NA_LOCK, NO_ERROR, lk_res::non2pl, NULL, NULL_CHN, NULL_LOCK, NULL_TRAN_INDEX, NULL_TRANID, lk_res_key::oid, OID_AS_ARGS, oid_compare(), OID_EQ, OID_GET_REAL_CLASS_OF_DIR_OID, oid_get_rep_read_tran_oid(), OID_IS_VIRTUAL_CLASS_OF_DIR_OID, OID_ISNULL, OID_ISTEMP, OR_MVCC_FLAG_VALID_INSID, or_mvcc_get_header(), db_identifier::pageid, PEEK, pthread_mutex_lock, pthread_mutex_unlock, RECDES_INITIALIZER, lk_res::res_mutex, rv, S_LOCK, S_SUCCESS, SIX_LOCK, db_identifier::slotid, strlen, thread_get_tran_entry(), THREAD_TS_OBJ_LOCK_ENT, lk_res::total_holders_mode, lk_res::total_waiters_mode, lk_res_key::type, U_LOCK, db_identifier::volid, lk_res::waiter, X_LOCK, and xlock_dump().

Referenced by xbtree_load_online_index(), and xlocator_demote_class_lock().

Here is the caller graph for this function:

void lock_dump_acquired ( FILE *  fp,
LK_ACQUIRED_LOCKS acqlocks 
)
void lock_finalize ( void  )

Definition at line 5797 of file lock_manager.c.

References free_and_init, i, lf_freelist_destroy(), and pthread_mutex_destroy.

Referenced by lock_initialize(), and logtb_undefine_trantable().

Here is the caller graph for this function:

static LK_ENTRY* lock_find_tran_hold_entry ( THREAD_ENTRY thread_p,
int  tran_index,
const OID oid,
bool  is_class 
)
static
void lock_force_thread_timeout_lock ( THREAD_ENTRY thrd)

Definition at line 7390 of file lock_manager.c.

References ARG_FILE_LINE, assert, ER_ERROR_SEVERITY, ER_LK_STRANGE_LOCK_WAIT, er_set(), LOCK_RESUMED_TIMEOUT, thread_lock_entry(), and thread_unlock_entry().

Referenced by css_stop_log_writer(), and css_stop_non_log_writer().

Here is the caller graph for this function:

static bool lock_force_timeout_expired_wait_transactions ( void *  thrd_entry)
static
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  )

Definition at line 8836 of file lock_manager.c.

Referenced by logpb_checkpoint().

Here is the caller graph for this function:

static void lock_get_transaction_lock_waiting_threads ( int  tran_index,
tran_lock_waiters_array_type tran_lock_waiters,
size_t &  count 
)
static

Definition at line 9829 of file lock_manager.c.

References lock_get_transaction_lock_waiting_threads_mapfunc(), cubthread::manager::map_entries(), and thread_get_manager().

Referenced by lock_is_waiting_transaction().

Here is the caller graph for this function:

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 
)
static

Definition at line 9803 of file lock_manager.c.

Referenced by lock_get_transaction_lock_waiting_threads().

Here is the caller graph for this function:

bool lock_has_xlock ( THREAD_ENTRY thread_p)

Definition at line 7181 of file lock_manager.c.

References IX_LOCK, lk_Standalone_has_xlock, LOG_FIND_THREAD_TRAN_INDEX, pthread_mutex_lock, pthread_mutex_unlock, rv, SCH_M_LOCK, SIX_LOCK, and X_LOCK.

Referenced by xtran_server_has_updated().

Here is the caller graph for this function:

int lock_hold_object_instant ( THREAD_ENTRY thread_p,
const OID oid,
const OID class_oid,
LOCK  lock 
)
int lock_initialize_composite_lock ( THREAD_ENTRY thread_p,
LK_COMPOSITE_LOCK comp_lock 
)
static bool lock_is_class_lock_escalated ( LOCK  class_lock,
LOCK  lock_escalation 
)
static

Definition at line 8808 of file lock_manager.c.

References IS_WRITE_EXCLUSIVE_LOCK, IX_LOCK, and S_LOCK.

Referenced by lock_object().

Here is the caller graph for this function:

bool lock_is_instant_lock_mode ( int  tran_index)

Definition at line 8999 of file lock_manager.c.

References LOCK_RESOURCE_CLASS, and OID_IS_ROOTOID.

Referenced by qexec_execute_mainblock_internal(), and qexec_execute_selupd_list().

Here is the caller graph for this function:

static bool lock_is_local_deadlock_detection_interval_up ( void  )
static

Definition at line 7608 of file lock_manager.c.

References perfmon_diff_timeval(), prm_get_float_value(), and PRM_ID_LK_RUN_DEADLOCK_INTERVAL.

Referenced by lock_initialize().

Here is the caller graph for this function:

bool lock_is_waiting_transaction ( int  tran_index)

Definition at line 7280 of file lock_manager.c.

References ARG_FILE_LINE, ER_LK_STRANGE_LOCK_WAIT, er_set(), ER_WARNING_SEVERITY, i, lock_get_transaction_lock_waiting_threads(), thread_lock_entry(), and thread_unlock_entry().

Referenced by xtran_is_blocked().

Here is the caller graph for this function:

int lock_object ( THREAD_ENTRY thread_p,
const OID oid,
const OID class_oid,
LOCK  lock,
int  cond_flag 
)

Definition at line 5904 of file lock_manager.c.

References ARG_FILE_LINE, assert, BU_LOCK, ER_ERROR_SEVERITY, ER_LK_BAD_ARGUMENT, er_log_debug, ER_MNT_WAITING_THREAD, ER_NOTIFICATION_SEVERITY, er_set(), if(), IS_LOCK, IX_LOCK, LK_COND_LOCK, LK_FORCE_ZERO_WAIT, LK_GRANTED, LK_NOTGRANTED, LK_NOTGRANTED_DUE_ERROR, LK_SET_STANDALONE_XLOCK, lock_get_class_lock(), lock_has_lock_on_object(), lock_is_class_lock_escalated(), lock_stop_instant_lock_mode(), LOG_FIND_THREAD_TRAN_INDEX, logtb_find_isolation(), logtb_find_wait_msecs(), MONITOR_WAITING_THREAD, NULL, NULL_LOCK, OID_IS_ROOTOID, oid_Root_class_oid, prm_get_integer_value(), PRM_ID_MNT_WAITING_THREAD, S_LOCK, SCH_S_LOCK, tsc_elapsed_time_usec(), tsc_getticks(), and TT_LOADDB.

Referenced by btree_check_by_class_oid(), btree_fk_object_does_exist(), btree_key_find_and_lock_unique_of_non_unique(), btree_load_check_fk(), btree_repair_prev_link_by_class_oid(), catalog_check_consistency(), catalog_get_cardinality_by_name(), catalog_start_access_with_dir_oid(), catcls_delete_instance(), file_tracker_get_and_protect(), heap_compact_pages(), heap_get_insert_location_with_lock(), heap_insert_logical(), locator_add_or_remove_index_internal(), locator_check_all_entries_of_all_btrees(), locator_check_by_class_oid(), locator_lock_and_get_object_internal(), locator_repair_btree_by_delete(), locator_repair_btree_by_insert(), locator_update_force(), locator_update_index(), lock_object_wait_msecs(), qexec_execute_insert(), qexec_for_update_set_class_locks(), qexec_set_class_locks(), scan_next_heap_scan(), scan_next_index_lookup_heap(), xboot_checkdb_table(), xbtree_find_unique(), xbtree_load_online_index(), xcache_find_xasl_id_for_execute(), xlocator_delete_class_name(), xlocator_fetch_all(), xlocator_fetch_lockhint_classes(), xlocator_find_class_oid(), xlocator_find_lockhint_class_oids(), xlocator_get_class(), xlocator_lock_and_fetch_all(), xlocator_reserve_class_name(), xserial_get_next_value(), xstats_get_statistics_from_server(), and xstats_update_statistics().

int lock_object_wait_msecs ( THREAD_ENTRY thread_p,
const OID oid,
const OID class_oid,
LOCK  lock,
int  cond_flag,
int  wait_msecs 
)

Definition at line 6238 of file lock_manager.c.

References LK_GRANTED, LK_SET_STANDALONE_XLOCK, lock_object(), and xlogtb_reset_wait_msecs().

Referenced by boot_compact_db(), and xlocator_lock_and_fetch_all().

Here is the caller graph for this function:

int lock_reacquire_crash_locks ( THREAD_ENTRY thread_p,
LK_ACQUIRED_LOCKS acqlocks,
int  tran_index 
)
void lock_remove_object_lock ( THREAD_ENTRY thread_p,
const OID oid,
const OID class_oid,
LOCK  lock 
)

Definition at line 6599 of file lock_manager.c.

References lock_unlock_object_lock_internal().

void lock_start_instant_lock_mode ( int  tran_index)

Definition at line 8853 of file lock_manager.c.

Referenced by qexec_execute_mainblock_internal(), and qexec_execute_selupd_list().

Here is the caller graph for this function:

void lock_stop_instant_lock_mode ( THREAD_ENTRY thread_p,
int  tran_index,
bool  need_unlock 
)

Definition at line 8875 of file lock_manager.c.

References assert, assert_release, and cubregex::count().

Referenced by lock_object(), qexec_execute_mainblock_internal(), and qexec_execute_selupd_list().

Here is the caller graph for this function:

void lock_unlock_all ( THREAD_ENTRY thread_p)

Definition at line 6837 of file lock_manager.c.

References assert, INCON_NON_TWO_PHASE_LOCK, lock_clear_deadlock_victim(), LOG_FIND_THREAD_TRAN_INDEX, and pgbuf_unfix_all().

Referenced by log_abort_local(), log_commit_local(), and log_complete_for_2pc().

Here is the caller graph for this function:

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 
)
static

Definition at line 6551 of file lock_manager.c.

References is_class(), lock_find_tran_hold_entry(), LOG_FIND_THREAD_TRAN_INDEX, NULL, and OID_IS_ROOTOID.

Referenced by lock_remove_object_lock(), and lock_unlock_object_donot_move_to_non2pl().

Here is the caller graph for this function:

static void lock_victimize_first_thread_mapfunc ( THREAD_ENTRY thread_ref,
bool stop_mapper 
)
static

Variable Documentation

const size_t DEFAULT_LOCK_WAITING_THREAD_ARRAY_SIZE = 10

Definition at line 467 of file lock_manager.c.

int lk_Standalone_has_xlock = 0
static

Definition at line 456 of file lock_manager.c.

Referenced by lock_has_xlock().

LOCK_COMPATIBILITY lock_Comp[12][12]