CUBRID Engine
latest
|
#include "xasl_cache.h"
#include "binaryheap.h"
#include "compile_context.h"
#include "config.h"
#include "system_parameter.h"
#include "list_file.h"
#include "perf_monitor.h"
#include "query_executor.h"
#include "query_manager.h"
#include "statistics_sr.h"
#include "stream_to_xasl.h"
#include "thread_entry.hpp"
#include "thread_lockfree_hash_map.hpp"
#include "thread_manager.hpp"
#include "xasl_unpack_info.hpp"
#include <algorithm>
#include <assert.h>
Go to the source code of this file.
Classes | |
struct | xcache_stats |
struct | xcache_cleanup_candidate |
struct | xcache |
Macros | |
#define | XCACHE_ENTRY_MARK_DELETED ((INT32) 0x80000000) |
#define | XCACHE_ENTRY_TO_BE_RECOMPILED ((INT32) 0x40000000) |
#define | XCACHE_ENTRY_WAS_RECOMPILED ((INT32) 0x20000000) |
#define | XCACHE_ENTRY_SKIP_TO_BE_RECOMPILED ((INT32) 0x10000000) |
#define | XCACHE_ENTRY_CLEANUP ((INT32) 0x08000000) |
#define | XCACHE_ENTRY_RECOMPILED_REQUESTED ((INT32) 0x04000000) |
#define | XCACHE_ENTRY_FLAGS_MASK ((INT32) 0xFF000000) |
#define | XCACHE_ENTRY_FIX_COUNT_MASK ((INT32) 0x00FFFFFF) |
#define | XCACHE_ENTRY_DELETED_BY_ME (XCACHE_ENTRY_MARK_DELETED | XCACHE_ENTRY_FIX_COUNT_MASK) |
#define | XCACHE_PTR_TO_KEY(ptr) ((XASL_ID *) ptr) |
#define | XCACHE_PTR_TO_ENTRY(ptr) ((XASL_CACHE_ENTRY *) ptr) |
#define | XCACHE_STATS_INITIALIZER { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } |
#define | xcache_Enabled xcache_Global.enabled |
#define | xcache_Soft_capacity xcache_Global.soft_capacity |
#define | xcache_Time_threshold xcache_Global.time_threshold |
#define | xcache_Last_cleaned_time xcache_Global.last_cleaned_time |
#define | xcache_Hashmap xcache_Global.hashmap |
#define | xcache_Entry_count xcache_Global.entry_count |
#define | xcache_Log xcache_Global.logging_enabled |
#define | xcache_Max_clones xcache_Global.max_clones |
#define | xcache_Cleanup_flag xcache_Global.cleanup_flag |
#define | xcache_Cleanup_bh xcache_Global.cleanup_bh |
#define | xcache_Cleanup_array xcache_Global.cleanup_array |
#define | XCACHE_STAT_GET(name) ATOMIC_LOAD_64 (&xcache_Global.stats.name) |
#define | XCACHE_STAT_INC(name) ATOMIC_INC_64 (&xcache_Global.stats.name, 1) |
#define | TIME_DIFF_SEC(t1, t2) (t1.tv_sec - t2.tv_sec) |
#define | XCACHE_ATOMIC_CAS_CACHE_FLAG(xid, oldcf, newcf) (ATOMIC_CAS_32 (&(xid)->cache_flag, oldcf, newcf)) |
#define | XCACHE_CLEANUP_RATIO 0.2 |
#define | XCACHE_CLEANUP_MIN_NUM_ENTRIES 20 |
#define | XCACHE_CLEANUP_NUM_ENTRIES(capacity) (MAX ((int) (2 * XCACHE_CLEANUP_RATIO * (capacity)), XCACHE_CLEANUP_MIN_NUM_ENTRIES)) |
#define | XCACHE_RT_TIMEDIFF_IN_SEC 360 /* 10 minutes */ |
#define | XCACHE_RT_MAX_THRESHOLD 10000 /* 10k pages */ |
#define | XCACHE_RT_FACTOR 10 /* 10x or 0.1x cardinal change */ |
#define | XCACHE_RT_CLASS_STAT_NEED_UPDATE(class_pages, heap_pages) |
#define | xcache_check_logging() (xcache_Log = prm_get_bool_value (PRM_ID_XASL_CACHE_LOGGING)) |
#define | xcache_log(...) if (xcache_Log) _er_log_debug (ARG_FILE_LINE, "XASL CACHE: " __VA_ARGS__) |
#define | xcache_log_error(...) if (xcache_Log) _er_log_debug (ARG_FILE_LINE, "XASL CACHE ERROR: " __VA_ARGS__) |
#define | XCACHE_LOG_TRAN_TEXT "\t tran = %d \n" |
#define | XCACHE_LOG_TRAN_ARGS(thrd) LOG_FIND_THREAD_TRAN_INDEX (thrd) |
#define | XCACHE_LOG_ERROR_TEXT "\t error_code = %d \n" |
#define | XCACHE_LOG_ENTRY_PTR_TEXT "\t\t entry ptr = %p \n" |
#define | XCACHE_LOG_SHA1_TEXT "\t\t\t sha1 = %08x | %08x | %08x | %08x | %08x \n" |
#define | XCACHE_LOG_SHA1_ARGS(sha1) SHA1_AS_ARGS (sha1) |
#define | XCACHE_LOG_TIME_STORED_TEXT "\t\t\t time stored = %d sec, %d usec \n" |
#define | XCACHE_LOG_EXEINFO_TEXT |
#define | XCACHE_LOG_CLONE |
#define | XCACHE_LOG_XASL_ID_TEXT(msg) |
#define | XCACHE_LOG_XASL_ID_ARGS(xid) |
#define | XCACHE_LOG_ENTRY_TEXT(msg) |
#define | XCACHE_LOG_ENTRY_ARGS(xent) |
#define | XCACHE_LOG_CLONE_ARGS(xclone) XASL_CLONE_AS_ARGS (xclone) |
#define | XCACHE_LOG_OBJECT_TEXT |
#define | XCACHE_LOG_ENTRY_OBJECT_TEXT(msg) |
#define | XCACHE_LOG_ENTRY_OBJECT_ARGS(xent, oidx) |
#define | XCACHE_DELETE_XIDS_SIZE 1024 |
Typedefs | |
typedef struct xcache_stats | XCACHE_STATS |
typedef struct xcache_cleanup_candidate | XCACHE_CLEANUP_CANDIDATE |
using | xcache_hashmap_type = cubthread::lockfree_hashmap< xasl_id, xasl_cache_ent > |
using | xcache_hashmap_iterator = xcache_hashmap_type::iterator |
typedef struct xcache | XCACHE |
Variables | |
XCACHE | xcache_Global |
static LF_ENTRY_DESCRIPTOR | xcache_Entry_descriptor |
#define TIME_DIFF_SEC | ( | t1, | |
t2 | |||
) | (t1.tv_sec - t2.tv_sec) |
Definition at line 156 of file xasl_cache.c.
Referenced by xcache_cleanup(), and xcache_need_cleanup().
#define XCACHE_ATOMIC_CAS_CACHE_FLAG | ( | xid, | |
oldcf, | |||
newcf | |||
) | (ATOMIC_CAS_32 (&(xid)->cache_flag, oldcf, newcf)) |
Definition at line 189 of file xasl_cache.c.
Referenced by xcache_compare_key(), xcache_entry_mark_deleted(), xcache_entry_set_request_recompile_flag(), xcache_insert(), and xcache_unfix().
#define xcache_check_logging | ( | ) | (xcache_Log = prm_get_bool_value (PRM_ID_XASL_CACHE_LOGGING)) |
Definition at line 207 of file xasl_cache.c.
Referenced by xcache_drop_all(), xcache_finalize(), xcache_find_sha1(), xcache_initialize(), xcache_insert(), and xcache_remove_by_oid().
#define xcache_Cleanup_array xcache_Global.cleanup_array |
Definition at line 150 of file xasl_cache.c.
Referenced by xcache_cleanup(), and xcache_initialize().
#define xcache_Cleanup_bh xcache_Global.cleanup_bh |
Definition at line 149 of file xasl_cache.c.
Referenced by xcache_cleanup(), xcache_finalize(), and xcache_initialize().
#define xcache_Cleanup_flag xcache_Global.cleanup_flag |
Definition at line 148 of file xasl_cache.c.
Referenced by xcache_cleanup(), xcache_initialize(), and xcache_insert().
#define XCACHE_CLEANUP_MIN_NUM_ENTRIES 20 |
Definition at line 193 of file xasl_cache.c.
#define XCACHE_CLEANUP_NUM_ENTRIES | ( | capacity | ) | (MAX ((int) (2 * XCACHE_CLEANUP_RATIO * (capacity)), XCACHE_CLEANUP_MIN_NUM_ENTRIES)) |
Definition at line 194 of file xasl_cache.c.
Referenced by xcache_initialize().
#define XCACHE_CLEANUP_RATIO 0.2 |
Definition at line 192 of file xasl_cache.c.
Referenced by xcache_cleanup().
#define XCACHE_DELETE_XIDS_SIZE 1024 |
Referenced by xcache_invalidate_entries().
#define xcache_Enabled xcache_Global.enabled |
Definition at line 140 of file xasl_cache.c.
Referenced by xcache_can_entry_cache_list(), xcache_cleanup(), xcache_drop_all(), xcache_dump(), xcache_finalize(), xcache_find_sha1(), xcache_initialize(), xcache_insert(), xcache_invalidate_entries(), xcache_invalidate_qcaches(), xcache_remove_by_oid(), and xcache_unfix().
#define XCACHE_ENTRY_CLEANUP ((INT32) 0x08000000) |
Definition at line 50 of file xasl_cache.c.
Referenced by xcache_cleanup(), and xcache_compare_key().
#define xcache_Entry_count xcache_Global.entry_count |
Definition at line 145 of file xasl_cache.c.
Referenced by xcache_cleanup(), xcache_dump(), xcache_entry_mark_deleted(), xcache_insert(), and xcache_need_cleanup().
#define XCACHE_ENTRY_DELETED_BY_ME (XCACHE_ENTRY_MARK_DELETED | XCACHE_ENTRY_FIX_COUNT_MASK) |
Definition at line 60 of file xasl_cache.c.
Referenced by xcache_compare_key(), xcache_entry_mark_deleted(), and xcache_unfix().
#define XCACHE_ENTRY_FIX_COUNT_MASK ((INT32) 0x00FFFFFF) |
Definition at line 54 of file xasl_cache.c.
Referenced by xcache_dump(), xcache_entry_uninit(), xcache_insert(), and xcache_unfix().
#define XCACHE_ENTRY_FLAGS_MASK ((INT32) 0xFF000000) |
Definition at line 52 of file xasl_cache.c.
Referenced by xcache_can_entry_cache_list(), xcache_cleanup(), xcache_dump(), and xcache_insert().
#define XCACHE_ENTRY_MARK_DELETED ((INT32) 0x80000000) |
Definition at line 46 of file xasl_cache.c.
Referenced by xcache_compare_key(), xcache_entry_mark_deleted(), xcache_entry_set_request_recompile_flag(), xcache_entry_uninit(), xcache_find_xasl_id_for_execute(), xcache_insert(), and xcache_unfix().
#define XCACHE_ENTRY_RECOMPILED_REQUESTED ((INT32) 0x04000000) |
Definition at line 51 of file xasl_cache.c.
Referenced by xcache_check_recompilation_threshold(), xcache_compare_key(), xcache_entry_set_request_recompile_flag(), and xcache_find_sha1().
#define XCACHE_ENTRY_SKIP_TO_BE_RECOMPILED ((INT32) 0x10000000) |
Definition at line 49 of file xasl_cache.c.
Referenced by xcache_compare_key(), and xcache_insert().
#define XCACHE_ENTRY_TO_BE_RECOMPILED ((INT32) 0x40000000) |
Definition at line 47 of file xasl_cache.c.
Referenced by xcache_compare_key(), xcache_entry_mark_deleted(), xcache_entry_set_request_recompile_flag(), xcache_insert(), and xcache_unfix().
#define XCACHE_ENTRY_WAS_RECOMPILED ((INT32) 0x20000000) |
Definition at line 48 of file xasl_cache.c.
Referenced by xcache_compare_key(), xcache_entry_mark_deleted(), xcache_insert(), and xcache_unfix().
#define xcache_Hashmap xcache_Global.hashmap |
Definition at line 144 of file xasl_cache.c.
Referenced by xcache_cleanup(), xcache_dump(), xcache_finalize(), xcache_find_sha1(), xcache_initialize(), xcache_insert(), xcache_invalidate_entries(), xcache_invalidate_qcaches(), and xcache_unfix().
#define xcache_Last_cleaned_time xcache_Global.last_cleaned_time |
Definition at line 143 of file xasl_cache.c.
Referenced by xcache_cleanup(), xcache_initialize(), and xcache_need_cleanup().
#define xcache_Log xcache_Global.logging_enabled |
Definition at line 146 of file xasl_cache.c.
#define xcache_log | ( | ... | ) | if (xcache_Log) _er_log_debug (ARG_FILE_LINE, "XASL CACHE: " __VA_ARGS__) |
Definition at line 208 of file xasl_cache.c.
Referenced by xcache_check_recompilation_threshold(), xcache_cleanup(), xcache_compare_key(), xcache_copy_key(), xcache_drop_all(), xcache_entry_mark_deleted(), xcache_entry_set_request_recompile_flag(), xcache_entry_uninit(), xcache_finalize(), xcache_find_sha1(), xcache_find_xasl_id_for_execute(), xcache_hash_key(), xcache_initialize(), xcache_insert(), xcache_invalidate_entries(), xcache_remove_by_oid(), and xcache_unfix().
#define XCACHE_LOG_CLONE |
Definition at line 225 of file xasl_cache.c.
Referenced by xcache_find_xasl_id_for_execute().
#define XCACHE_LOG_CLONE_ARGS | ( | xclone | ) | XASL_CLONE_AS_ARGS (xclone) |
Definition at line 248 of file xasl_cache.c.
Referenced by xcache_find_xasl_id_for_execute().
#define XCACHE_LOG_ENTRY_ARGS | ( | xent | ) |
Definition at line 243 of file xasl_cache.c.
Referenced by xcache_check_recompilation_threshold(), xcache_entry_mark_deleted(), xcache_entry_set_request_recompile_flag(), xcache_entry_uninit(), xcache_find_sha1(), xcache_find_xasl_id_for_execute(), xcache_insert(), and xcache_unfix().
#define XCACHE_LOG_ENTRY_OBJECT_ARGS | ( | xent, | |
oidx | |||
) |
Definition at line 256 of file xasl_cache.c.
Referenced by xcache_find_xasl_id_for_execute().
#define XCACHE_LOG_ENTRY_OBJECT_TEXT | ( | msg | ) |
Definition at line 253 of file xasl_cache.c.
Referenced by xcache_find_xasl_id_for_execute().
#define XCACHE_LOG_ENTRY_PTR_TEXT "\t\t entry ptr = %p \n" |
Definition at line 216 of file xasl_cache.c.
#define XCACHE_LOG_ENTRY_TEXT | ( | msg | ) |
Definition at line 236 of file xasl_cache.c.
Referenced by xcache_check_recompilation_threshold(), xcache_entry_mark_deleted(), xcache_entry_set_request_recompile_flag(), xcache_entry_uninit(), xcache_find_sha1(), xcache_find_xasl_id_for_execute(), xcache_insert(), and xcache_unfix().
#define xcache_log_error | ( | ... | ) | if (xcache_Log) _er_log_debug (ARG_FILE_LINE, "XASL CACHE ERROR: " __VA_ARGS__) |
Definition at line 209 of file xasl_cache.c.
Referenced by xcache_entry_mark_deleted(), xcache_entry_set_request_recompile_flag(), xcache_find_xasl_id_for_execute(), xcache_initialize(), xcache_insert(), and xcache_unfix().
#define XCACHE_LOG_ERROR_TEXT "\t error_code = %d \n" |
Definition at line 214 of file xasl_cache.c.
#define XCACHE_LOG_EXEINFO_TEXT |
Definition at line 222 of file xasl_cache.c.
#define XCACHE_LOG_OBJECT_TEXT |
Definition at line 250 of file xasl_cache.c.
#define XCACHE_LOG_SHA1_ARGS | ( | sha1 | ) | SHA1_AS_ARGS (sha1) |
Definition at line 219 of file xasl_cache.c.
Referenced by xcache_compare_key(), xcache_find_sha1(), and xcache_hash_key().
#define XCACHE_LOG_SHA1_TEXT "\t\t\t sha1 = %08x | %08x | %08x | %08x | %08x \n" |
Definition at line 218 of file xasl_cache.c.
Referenced by xcache_compare_key(), xcache_find_sha1(), and xcache_hash_key().
#define XCACHE_LOG_TIME_STORED_TEXT "\t\t\t time stored = %d sec, %d usec \n" |
Definition at line 221 of file xasl_cache.c.
#define XCACHE_LOG_TRAN_ARGS | ( | thrd | ) | LOG_FIND_THREAD_TRAN_INDEX (thrd) |
Definition at line 212 of file xasl_cache.c.
Referenced by xcache_check_recompilation_threshold(), xcache_cleanup(), xcache_compare_key(), xcache_copy_key(), xcache_drop_all(), xcache_entry_mark_deleted(), xcache_entry_set_request_recompile_flag(), xcache_entry_uninit(), xcache_find_sha1(), xcache_find_xasl_id_for_execute(), xcache_hash_key(), xcache_insert(), xcache_invalidate_entries(), xcache_remove_by_oid(), and xcache_unfix().
#define XCACHE_LOG_TRAN_TEXT "\t tran = %d \n" |
Definition at line 211 of file xasl_cache.c.
Referenced by xcache_check_recompilation_threshold(), xcache_cleanup(), xcache_compare_key(), xcache_copy_key(), xcache_drop_all(), xcache_entry_mark_deleted(), xcache_entry_set_request_recompile_flag(), xcache_entry_uninit(), xcache_find_sha1(), xcache_find_xasl_id_for_execute(), xcache_hash_key(), xcache_insert(), xcache_invalidate_entries(), xcache_remove_by_oid(), and xcache_unfix().
#define XCACHE_LOG_XASL_ID_ARGS | ( | xid | ) |
Definition at line 232 of file xasl_cache.c.
Referenced by xcache_cleanup(), xcache_copy_key(), and xcache_find_xasl_id_for_execute().
#define XCACHE_LOG_XASL_ID_TEXT | ( | msg | ) |
Definition at line 228 of file xasl_cache.c.
Referenced by xcache_cleanup(), xcache_copy_key(), and xcache_find_xasl_id_for_execute().
#define xcache_Max_clones xcache_Global.max_clones |
Definition at line 147 of file xasl_cache.c.
Referenced by xcache_entry_uninit(), xcache_find_xasl_id_for_execute(), xcache_initialize(), xcache_retire_clone(), and xcache_uses_clones().
#define XCACHE_PTR_TO_ENTRY | ( | ptr | ) | ((XASL_CACHE_ENTRY *) ptr) |
Definition at line 64 of file xasl_cache.c.
Referenced by xcache_entry_init(), and xcache_entry_uninit().
#define XCACHE_PTR_TO_KEY | ( | ptr | ) | ((XASL_ID *) ptr) |
Definition at line 63 of file xasl_cache.c.
Referenced by xcache_compare_key(), and xcache_hash_key().
#define XCACHE_RT_CLASS_STAT_NEED_UPDATE | ( | class_pages, | |
heap_pages | |||
) |
Definition at line 202 of file xasl_cache.c.
Referenced by xcache_check_recompilation_threshold().
#define XCACHE_RT_FACTOR 10 /* 10x or 0.1x cardinal change */ |
Definition at line 201 of file xasl_cache.c.
Referenced by xcache_check_recompilation_threshold().
#define XCACHE_RT_MAX_THRESHOLD 10000 /* 10k pages */ |
Definition at line 200 of file xasl_cache.c.
Referenced by xcache_check_recompilation_threshold().
#define XCACHE_RT_TIMEDIFF_IN_SEC 360 /* 10 minutes */ |
Definition at line 199 of file xasl_cache.c.
Referenced by xcache_check_recompilation_threshold().
#define xcache_Soft_capacity xcache_Global.soft_capacity |
Definition at line 141 of file xasl_cache.c.
Referenced by xcache_cleanup(), xcache_dump(), xcache_initialize(), and xcache_need_cleanup().
#define XCACHE_STAT_GET | ( | name | ) | ATOMIC_LOAD_64 (&xcache_Global.stats.name) |
Definition at line 153 of file xasl_cache.c.
Referenced by xcache_dump().
#define XCACHE_STAT_INC | ( | name | ) | ATOMIC_INC_64 (&xcache_Global.stats.name, 1) |
Definition at line 154 of file xasl_cache.c.
Referenced by xcache_cleanup(), xcache_compare_key(), xcache_entry_mark_deleted(), xcache_find_sha1(), xcache_insert(), and xcache_unfix().
#define XCACHE_STATS_INITIALIZER { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } |
Definition at line 85 of file xasl_cache.c.
#define xcache_Time_threshold xcache_Global.time_threshold |
Definition at line 142 of file xasl_cache.c.
Referenced by xcache_cleanup(), xcache_initialize(), and xcache_need_cleanup().
Definition at line 101 of file xasl_cache.c.
typedef struct xcache_cleanup_candidate XCACHE_CLEANUP_CANDIDATE |
Definition at line 88 of file xasl_cache.c.
using xcache_hashmap_iterator = xcache_hashmap_type::iterator |
Definition at line 97 of file xasl_cache.c.
Definition at line 96 of file xasl_cache.c.
typedef struct xcache_stats XCACHE_STATS |
Definition at line 67 of file xasl_cache.c.
bool xcache_can_entry_cache_list | ( | XASL_CACHE_ENTRY * | xcache_entry | ) |
Definition at line 2004 of file xasl_cache.c.
References xasl_id::cache_flag, NULL, xasl_cache_ent::xasl_id, xcache_Enabled, and XCACHE_ENTRY_FLAGS_MASK.
Referenced by xqmgr_execute_query().
|
static |
Definition at line 2348 of file xasl_cache.c.
References assert, ASSERT_ERROR, xasl_id::cache_flag, catalog_free_class_info_and_init, catalog_get_class_info(), catalog_update_class_info(), cls_info::ci_hfid, cls_info::ci_time_stamp, cls_info::ci_tot_pages, file_get_num_user_pages(), HFID_IS_NULL, xasl_cache_ent::n_related_objects, NO_ERROR, NULL, xcache_related_object::oid, prm_get_bool_value(), PRM_ID_USE_STAT_ESTIMATION, xasl_cache_ent::related_objects, stats_get_time_stamp(), xcache_related_object::tcard, xasl_cache_ent::time_last_rt_check, hfid::vfid, VFID_ISNULL, XASL_CLASS_NO_TCARD, xasl_cache_ent::xasl_id, XASL_SERIAL_OID_TCARD, XCACHE_ENTRY_RECOMPILED_REQUESTED, xcache_entry_set_request_recompile_flag(), xcache_log, XCACHE_LOG_ENTRY_ARGS, XCACHE_LOG_ENTRY_TEXT, XCACHE_LOG_TRAN_ARGS, XCACHE_LOG_TRAN_TEXT, XCACHE_RT_CLASS_STAT_NEED_UPDATE, XCACHE_RT_FACTOR, XCACHE_RT_MAX_THRESHOLD, and XCACHE_RT_TIMEDIFF_IN_SEC.
Referenced by xcache_find_sha1().
|
static |
Definition at line 2111 of file xasl_cache.c.
References assert, assert_release, bh_create(), bh_destroy(), bh_element_at(), bh_try_insert(), xasl_id::cache_flag, xcache_stats::cleanups, cubregex::count(), xcache_stats::deletes_at_cleanup, binary_heap::element_count, xasl_cache_ent::list_ht_no, binary_heap::max_capacity, NULL, perfmon_inc_stat(), PSTAT_PC_NUM_DELETE, PSTAT_PC_NUM_FULL, qfile_clear_list_cache(), TIME_DIFF_SEC, xasl_cache_ent::time_last_used, xasl_cache_ent::xasl_id, xcache_cleanup_candidate::xcache, xcache_Cleanup_array, xcache_Cleanup_bh, xcache_Cleanup_flag, XCACHE_CLEANUP_FULL, XCACHE_CLEANUP_NONE, XCACHE_CLEANUP_RATIO, xcache_compare_cleanup_candidates(), xcache_Enabled, XCACHE_ENTRY_CLEANUP, xcache_Entry_count, XCACHE_ENTRY_FLAGS_MASK, xcache_Hashmap, xcache_Last_cleaned_time, xcache_log, XCACHE_LOG_TRAN_ARGS, XCACHE_LOG_TRAN_TEXT, XCACHE_LOG_XASL_ID_ARGS, XCACHE_LOG_XASL_ID_TEXT, xcache_need_cleanup(), xcache_Soft_capacity, XCACHE_STAT_INC, xcache_Time_threshold, and xcache_cleanup_candidate::xid.
Referenced by xcache_insert().
|
static |
Definition at line 2021 of file xasl_cache.c.
References db_change_private_heap(), free_xasl_unpack_info(), NULL, qexec_clear_xasl(), xasl_clone::xasl, xasl_clone::xasl_buf, XASL_DECACHE_CLONE, and XASL_SET_FLAG.
Referenced by xcache_entry_uninit(), xcache_invalidate_entries(), xcache_retire_clone(), and xcache_unfix().
|
static |
Definition at line 2319 of file xasl_cache.c.
References BH_EQ, BH_GT, and BH_LT.
Referenced by xcache_cleanup(), and xcache_initialize().
|
static |
Definition at line 587 of file xasl_cache.c.
References xasl_id::cache_flag, xcache_stats::fix, NULL, xasl_id::sha1, SHA1Compare(), XCACHE_ATOMIC_CAS_CACHE_FLAG, XCACHE_ENTRY_CLEANUP, XCACHE_ENTRY_DELETED_BY_ME, XCACHE_ENTRY_MARK_DELETED, XCACHE_ENTRY_RECOMPILED_REQUESTED, XCACHE_ENTRY_SKIP_TO_BE_RECOMPILED, XCACHE_ENTRY_TO_BE_RECOMPILED, XCACHE_ENTRY_WAS_RECOMPILED, xcache_log, XCACHE_LOG_SHA1_ARGS, XCACHE_LOG_SHA1_TEXT, XCACHE_LOG_TRAN_ARGS, XCACHE_LOG_TRAN_TEXT, XCACHE_PTR_TO_KEY, and XCACHE_STAT_INC.
|
static |
Definition at line 562 of file xasl_cache.c.
References assert, xasl_id::cache_flag, NO_ERROR, NULL, xcache_log, XCACHE_LOG_TRAN_ARGS, XCACHE_LOG_TRAN_TEXT, XCACHE_LOG_XASL_ID_ARGS, and XCACHE_LOG_XASL_ID_TEXT.
void xcache_drop_all | ( | THREAD_ENTRY * | thread_p | ) |
Definition at line 1890 of file xasl_cache.c.
References NULL, xcache_check_logging, xcache_Enabled, xcache_invalidate_entries(), xcache_log, XCACHE_LOG_TRAN_ARGS, and XCACHE_LOG_TRAN_TEXT.
Referenced by xqmgr_drop_all_query_plans().
void xcache_dump | ( | THREAD_ENTRY * | thread_p, |
FILE * | fp | ||
) |
Definition at line 1911 of file xasl_cache.c.
References assert, xasl_id::cache_flag, xcache_stats::cleanups, xcache_stats::deletes, xcache_stats::deletes_at_cleanup, xcache_stats::failed_recompiles, xcache_stats::fix, xcache_stats::found_at_insert, free_and_init, xcache_stats::hits, xcache_stats::inserts, xcache_related_object::lock, LOCK_TO_LOCKMODE_STRING, xcache_stats::lookups, xcache_stats::miss, xasl_cache_ent::n_cache_clones, xasl_cache_ent::n_related_objects, NULL, xcache_related_object::oid, OID_AS_ARGS, prm_get_bool_value(), PRM_ID_SQL_TRACE_EXECUTION_PLAN, qmgr_get_sql_id(), xcache_stats::recompiles, xasl_cache_ent::ref_count, xasl_cache_ent::related_objects, cache_time::sec, xasl_id::sha1, SHA1_AS_ARGS, execution_info::sql_hash_text, xasl_cache_ent::sql_info, execution_info::sql_plan_text, execution_info::sql_user_text, strlen, xcache_related_object::tcard, xasl_cache_ent::time_last_used, xasl_id::time_stored, xcache_stats::unfix, cache_time::usec, xasl_cache_ent::xasl_id, xcache_Enabled, xcache_Entry_count, XCACHE_ENTRY_FIX_COUNT_MASK, XCACHE_ENTRY_FLAGS_MASK, xcache_Hashmap, xcache_Soft_capacity, XCACHE_STAT_GET, and xcache_uses_clones().
Referenced by xqmgr_dump_query_plans().
|
static |
Definition at line 400 of file xasl_cache.c.
References xasl_cache_ent::cache_clones_mutex, xasl_cache_ent::init_clone_cache(), xasl_cache_ent::list_ht_no, NULL, and pthread_mutex_init.
|
static |
Definition at line 424 of file xasl_cache.c.
References assert, xasl_cache_ent::cache_clones, xasl_cache_ent::cache_clones_mutex, NO_ERROR, xasl_cache_ent::one_clone, and pthread_mutex_destroy.
|
static |
Definition at line 446 of file xasl_cache.c.
References assert, xasl_stream::buffer, xasl_cache_ent::clr_count, xasl_cache_ent::free_data_on_uninit, xasl_cache_ent::initialized, xasl_cache_ent::n_cache_clones, NO_ERROR, NULL, xasl_cache_ent::ref_count, xasl_cache_ent::related_objects, execution_info::sql_hash_text, xasl_cache_ent::sql_info, execution_info::sql_plan_text, execution_info::sql_user_text, xasl_cache_ent::stream, xasl_cache_ent::xasl_id, xasl_stream::xasl_id, XASL_ID_SET_NULL, and XCACHE_PTR_TO_ENTRY.
|
static |
Definition at line 1842 of file xasl_cache.c.
References assert, xasl_cache_ent::n_related_objects, NULL, xcache_related_object::oid, OID_EQ, and xasl_cache_ent::related_objects.
Referenced by xcache_invalidate_qcaches(), and xcache_remove_by_oid().
|
static |
Definition at line 1180 of file xasl_cache.c.
References ARG_FILE_LINE, assert, xasl_id::cache_flag, xcache_stats::deletes, ER_ERROR_SEVERITY, ER_GENERIC_ERROR, er_set(), perfmon_inc_stat(), PSTAT_PC_NUM_DELETE, xasl_cache_ent::xasl_id, XCACHE_ATOMIC_CAS_CACHE_FLAG, xcache_Entry_count, XCACHE_ENTRY_DELETED_BY_ME, XCACHE_ENTRY_MARK_DELETED, XCACHE_ENTRY_TO_BE_RECOMPILED, XCACHE_ENTRY_WAS_RECOMPILED, xcache_log, XCACHE_LOG_ENTRY_ARGS, XCACHE_LOG_ENTRY_TEXT, xcache_log_error, XCACHE_LOG_TRAN_ARGS, XCACHE_LOG_TRAN_TEXT, and XCACHE_STAT_INC.
Referenced by xcache_invalidate_entries().
|
static |
Definition at line 1245 of file xasl_cache.c.
References xasl_id::cache_flag, xasl_cache_ent::xasl_id, XCACHE_ATOMIC_CAS_CACHE_FLAG, XCACHE_ENTRY_MARK_DELETED, XCACHE_ENTRY_RECOMPILED_REQUESTED, XCACHE_ENTRY_TO_BE_RECOMPILED, xcache_log, XCACHE_LOG_ENTRY_ARGS, XCACHE_LOG_ENTRY_TEXT, xcache_log_error, XCACHE_LOG_TRAN_ARGS, and XCACHE_LOG_TRAN_TEXT.
Referenced by xcache_check_recompilation_threshold(), and xcache_insert().
|
static |
Definition at line 476 of file xasl_cache.c.
References assert, xasl_stream::buffer, xasl_cache_ent::cache_clones, xasl_cache_ent::cache_clones_capacity, xasl_id::cache_flag, free_and_init, xasl_cache_ent::free_data_on_uninit, xasl_cache_ent::initialized, xasl_cache_ent::n_cache_clones, NO_ERROR, NULL, xasl_cache_ent::one_clone, xasl_cache_ent::related_objects, execution_info::sql_hash_text, xasl_cache_ent::sql_info, execution_info::sql_plan_text, execution_info::sql_user_text, xasl_cache_ent::stream, thread_get_thread_entry_info(), xasl_clone::xasl, xasl_clone::xasl_buf, xasl_cache_ent::xasl_id, XASL_ID_SET_NULL, xcache_clone_decache(), XCACHE_ENTRY_FIX_COUNT_MASK, XCACHE_ENTRY_MARK_DELETED, xcache_log, XCACHE_LOG_ENTRY_ARGS, XCACHE_LOG_ENTRY_TEXT, XCACHE_LOG_TRAN_ARGS, XCACHE_LOG_TRAN_TEXT, xcache_Max_clones, and XCACHE_PTR_TO_ENTRY.
void xcache_finalize | ( | THREAD_ENTRY * | thread_p | ) |
Definition at line 344 of file xasl_cache.c.
References bh_destroy(), db_change_private_heap(), NULL, xcache_check_logging, xcache_Cleanup_bh, xcache_Enabled, xcache_Hashmap, and xcache_log.
Referenced by boot_restart_server(), and xboot_shutdown_server().
int xcache_find_sha1 | ( | THREAD_ENTRY * | thread_p, |
const SHA1Hash * | sha1, | ||
const XASL_CACHE_SEARCH_MODE | search_mode, | ||
XASL_CACHE_ENTRY ** | xcache_entry, | ||
xasl_cache_rt_check_result * | rt_check | ||
) |
Definition at line 791 of file xasl_cache.c.
References assert, xcache_stats::hits, xcache_stats::lookups, xcache_stats::miss, NO_ERROR, NULL, perfmon_inc_stat(), PSTAT_PC_NUM_HIT, PSTAT_PC_NUM_LOOKUP, PSTAT_PC_NUM_MISS, xasl_id::sha1, XASL_CACHE_RECOMPILE_EXECUTE, XASL_CACHE_RECOMPILE_PREPARE, XASL_CACHE_SEARCH_FOR_EXECUTE, XASL_CACHE_SEARCH_FOR_PREPARE, XASL_ID_SET_NULL, xcache_check_logging, xcache_check_recompilation_threshold(), xcache_Enabled, XCACHE_ENTRY_RECOMPILED_REQUESTED, xcache_Hashmap, xcache_log, XCACHE_LOG_ENTRY_ARGS, XCACHE_LOG_ENTRY_TEXT, XCACHE_LOG_SHA1_ARGS, XCACHE_LOG_SHA1_TEXT, XCACHE_LOG_TRAN_ARGS, XCACHE_LOG_TRAN_TEXT, XCACHE_STAT_INC, and xcache_unfix().
Referenced by event_log_sql_string(), session_get_prepared_statement(), xcache_find_xasl_id_for_execute(), xlogtb_get_pack_tran_table(), and xqmgr_prepare_query().
int xcache_find_xasl_id_for_execute | ( | THREAD_ENTRY * | thread_p, |
const XASL_ID * | xid, | ||
XASL_CACHE_ENTRY ** | xcache_entry, | ||
XASL_CLONE * | xclone | ||
) |
Definition at line 888 of file xasl_cache.c.
References ARG_FILE_LINE, assert, ASSERT_ERROR, ASSERT_ERROR_AND_SET, assert_release, db_change_private_heap(), ER_ERROR_SEVERITY, ER_QPROC_XASLNODE_RECOMPILE_REQUESTED, er_set(), LK_GRANTED, LK_UNCOND_LOCK, lock_object(), NO_ERROR, NULL, NULL_LOCK, oid_Root_class_oid, perfmon_inc_stat(), PSTAT_PC_NUM_INVALID_XASL_ID, pthread_mutex_lock, pthread_mutex_unlock, cache_time::sec, xasl_id::sha1, stx_map_stream_to_xasl(), xasl_id::time_stored, cache_time::usec, xasl_clone::xasl, xasl_clone::xasl_buf, XASL_CACHE_RECOMPILE_EXECUTE, XASL_CACHE_RECOMPILE_NOT_NEEDED, XASL_CACHE_SEARCH_FOR_EXECUTE, XCACHE_ENTRY_MARK_DELETED, xcache_find_sha1(), xcache_log, XCACHE_LOG_CLONE, XCACHE_LOG_CLONE_ARGS, XCACHE_LOG_ENTRY_ARGS, XCACHE_LOG_ENTRY_OBJECT_ARGS, XCACHE_LOG_ENTRY_OBJECT_TEXT, XCACHE_LOG_ENTRY_TEXT, xcache_log_error, XCACHE_LOG_TRAN_ARGS, XCACHE_LOG_TRAN_TEXT, XCACHE_LOG_XASL_ID_ARGS, XCACHE_LOG_XASL_ID_TEXT, xcache_Max_clones, xcache_unfix(), and xcache_uses_clones().
Referenced by xqmgr_execute_query().
int xcache_get_entry_count | ( | void | ) |
Definition at line 2457 of file xasl_cache.c.
References xcache::entry_count.
Referenced by perfmon_get_peek_stats().
|
static |
Definition at line 741 of file xasl_cache.c.
References SHA1Hash::h, xasl_id::sha1, thread_get_thread_entry_info(), xcache_log, XCACHE_LOG_SHA1_ARGS, XCACHE_LOG_SHA1_TEXT, XCACHE_LOG_TRAN_ARGS, XCACHE_LOG_TRAN_TEXT, and XCACHE_PTR_TO_KEY.
int xcache_initialize | ( | THREAD_ENTRY * | thread_p | ) |
Definition at line 280 of file xasl_cache.c.
References ARG_FILE_LINE, ASSERT_ERROR_AND_SET, bh_create(), db_change_private_heap(), ER_ERROR_SEVERITY, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), max, NO_ERROR, NULL, prm_get_integer_value(), PRM_ID_XASL_CACHE_MAX_CLONES, PRM_ID_XASL_CACHE_MAX_ENTRIES, PRM_ID_XASL_CACHE_TIME_THRESHOLD_IN_MINUTES, THREAD_TS_XCACHE, xcache_check_logging, xcache_Cleanup_array, xcache_Cleanup_bh, xcache_Cleanup_flag, XCACHE_CLEANUP_NUM_ENTRIES, xcache_compare_cleanup_candidates(), xcache_Enabled, xcache_Hashmap, xcache_Last_cleaned_time, xcache_log, xcache_log_error, xcache_Max_clones, xcache_Soft_capacity, xcache_Time_threshold, and xcache_Ts.
Referenced by boot_restart_server().
int xcache_insert | ( | THREAD_ENTRY * | thread_p, |
const compile_context * | context, | ||
XASL_STREAM * | stream, | ||
int | n_oid, | ||
const OID * | class_oids, | ||
const int * | class_locks, | ||
const int * | tcards, | ||
XASL_CACHE_ENTRY ** | xcache_entry | ||
) |
Definition at line 1350 of file xasl_cache.c.
References ARG_FILE_LINE, assert, ASSERT_ERROR, ASSERT_ERROR_AND_SET, xasl_stream::buffer, xasl_id::cache_flag, CACHE_TIME_MAKE, ER_ERROR_SEVERITY, ER_OUT_OF_VIRTUAL_MEMORY, ER_QPROC_INVALID_XASLNODE, er_set(), error(), xcache_stats::failed_recompiles, xcache_stats::found_at_insert, free_and_init, xcache_stats::inserts, xcache_related_object::lock, NO_ERROR, NULL, xcache_related_object::oid, perfmon_inc_stat(), PSTAT_PC_NUM_ADD, compile_context::recompile_xasl, xcache_stats::recompiles, compile_context::sha1, xasl_id::sha1, compile_context::sql_hash_text, compile_context::sql_plan_text, compile_context::sql_user_text, strlen, xcache_related_object::tcard, thread_sleep(), xasl_id::time_stored, xasl_cache_ent::xasl_id, xasl_stream::xasl_id, XASL_ID_COPY, XASL_ID_SET_NULL, XCACHE_ATOMIC_CAS_CACHE_FLAG, xcache_check_logging, xcache_cleanup(), xcache_Cleanup_flag, XCACHE_CLEANUP_NONE, xcache_Enabled, xcache_Entry_count, XCACHE_ENTRY_FIX_COUNT_MASK, XCACHE_ENTRY_FLAGS_MASK, XCACHE_ENTRY_MARK_DELETED, xcache_entry_set_request_recompile_flag(), XCACHE_ENTRY_SKIP_TO_BE_RECOMPILED, XCACHE_ENTRY_TO_BE_RECOMPILED, XCACHE_ENTRY_WAS_RECOMPILED, xcache_Hashmap, xcache_log, XCACHE_LOG_ENTRY_ARGS, XCACHE_LOG_ENTRY_TEXT, xcache_log_error, XCACHE_LOG_TRAN_ARGS, XCACHE_LOG_TRAN_TEXT, xcache_need_cleanup(), XCACHE_STAT_INC, and xcache_unfix().
Referenced by xqmgr_prepare_query().
|
static |
Definition at line 1747 of file xasl_cache.c.
References assert, xasl_cache_ent::cache_clones, xasl_cache_ent::list_ht_no, xasl_cache_ent::n_cache_clones, NULL, qfile_clear_list_cache(), qfile_has_no_cache_entries(), QFILE_IS_LIST_CACHE_DISABLED, xasl_cache_ent::xasl_id, xcache_clone_decache(), XCACHE_DELETE_XIDS_SIZE, xcache_Enabled, xcache_entry_mark_deleted(), xcache_Hashmap, xcache_log, XCACHE_LOG_TRAN_ARGS, and XCACHE_LOG_TRAN_TEXT.
Referenced by xcache_drop_all(), and xcache_remove_by_oid().
int xcache_invalidate_qcaches | ( | THREAD_ENTRY * | thread_p, |
const OID * | oid | ||
) |
Definition at line 1689 of file xasl_cache.c.
References xasl_cache_ent::list_ht_no, NO_ERROR, NULL, qfile_clear_list_cache(), qfile_get_list_cache_number_of_entries(), xcache_Enabled, xcache_entry_is_related_to_oid(), and xcache_Hashmap.
Referenced by qmgr_clear_relative_cache_entries().
|
static |
Definition at line 1317 of file xasl_cache.c.
References NULL, TIME_DIFF_SEC, XCACHE_CLEANUP_FULL, XCACHE_CLEANUP_NONE, XCACHE_CLEANUP_TIMEOUT, xcache_Entry_count, xcache_Last_cleaned_time, xcache_Soft_capacity, and xcache_Time_threshold.
Referenced by xcache_cleanup(), and xcache_insert().
void xcache_remove_by_oid | ( | THREAD_ENTRY * | thread_p, |
const OID * | oid | ||
) |
Definition at line 1869 of file xasl_cache.c.
References OID_AS_ARGS, xcache_check_logging, xcache_Enabled, xcache_entry_is_related_to_oid(), xcache_invalidate_entries(), xcache_log, XCACHE_LOG_TRAN_ARGS, and XCACHE_LOG_TRAN_TEXT.
Referenced by locator_delete_force_internal(), locator_update_force(), log_cleanup_modified_class(), and xserial_decache().
void xcache_retire_clone | ( | THREAD_ENTRY * | thread_p, |
XASL_CACHE_ENTRY * | xcache_entry, | ||
XASL_CLONE * | xclone | ||
) |
Definition at line 2040 of file xasl_cache.c.
References ARG_FILE_LINE, assert, xasl_cache_ent::cache_clones, xasl_cache_ent::cache_clones_capacity, xasl_cache_ent::cache_clones_mutex, ER_NOTIFICATION_SEVERITY, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), free_xasl_unpack_info(), xasl_cache_ent::n_cache_clones, NULL, xasl_cache_ent::one_clone, pthread_mutex_lock, pthread_mutex_unlock, xasl_clone::xasl, xasl_clone::xasl_buf, xcache_clone_decache(), xcache_Max_clones, and xcache_uses_clones().
Referenced by xqmgr_execute_query().
void xcache_unfix | ( | THREAD_ENTRY * | thread_p, |
XASL_CACHE_ENTRY * | xcache_entry | ||
) |
Definition at line 1083 of file xasl_cache.c.
References ARG_FILE_LINE, assert, xasl_cache_ent::cache_clones, xasl_id::cache_flag, ER_ERROR_SEVERITY, ER_GENERIC_ERROR, er_set(), xasl_cache_ent::list_ht_no, xasl_cache_ent::n_cache_clones, NO_ERROR, NULL, qfile_clear_list_cache(), xasl_cache_ent::ref_count, xasl_cache_ent::time_last_used, xcache_stats::unfix, xasl_cache_ent::xasl_id, XCACHE_ATOMIC_CAS_CACHE_FLAG, xcache_clone_decache(), xcache_Enabled, XCACHE_ENTRY_DELETED_BY_ME, XCACHE_ENTRY_FIX_COUNT_MASK, XCACHE_ENTRY_MARK_DELETED, XCACHE_ENTRY_TO_BE_RECOMPILED, XCACHE_ENTRY_WAS_RECOMPILED, xcache_Hashmap, xcache_log, XCACHE_LOG_ENTRY_ARGS, XCACHE_LOG_ENTRY_TEXT, xcache_log_error, XCACHE_LOG_TRAN_ARGS, XCACHE_LOG_TRAN_TEXT, and XCACHE_STAT_INC.
Referenced by event_log_sql_string(), sqmgr_execute_query(), xcache_find_sha1(), xcache_find_xasl_id_for_execute(), xcache_insert(), xlogtb_get_pack_tran_table(), xqmgr_execute_query(), xqmgr_prepare_query(), and xsession_get_prepared_statement().
bool xcache_uses_clones | ( | void | ) |
Definition at line 2468 of file xasl_cache.c.
References xcache_Max_clones.
Referenced by qexec_clear_regu_var(), qexec_clear_xasl_head(), xcache_dump(), xcache_find_xasl_id_for_execute(), and xcache_retire_clone().
|
static |
Definition at line 169 of file xasl_cache.c.
XCACHE xcache_Global |
Definition at line 137 of file xasl_cache.c.