46 #define XCACHE_ENTRY_MARK_DELETED ((INT32) 0x80000000) 47 #define XCACHE_ENTRY_TO_BE_RECOMPILED ((INT32) 0x40000000) 48 #define XCACHE_ENTRY_WAS_RECOMPILED ((INT32) 0x20000000) 49 #define XCACHE_ENTRY_SKIP_TO_BE_RECOMPILED ((INT32) 0x10000000) 50 #define XCACHE_ENTRY_CLEANUP ((INT32) 0x08000000) 51 #define XCACHE_ENTRY_RECOMPILED_REQUESTED ((INT32) 0x04000000) 52 #define XCACHE_ENTRY_FLAGS_MASK ((INT32) 0xFF000000) 54 #define XCACHE_ENTRY_FIX_COUNT_MASK ((INT32) 0x00FFFFFF) 56 #if defined (SERVER_MODE) 57 #define XCACHE_ENTRY_DELETED_BY_ME \ 58 ((XCACHE_ENTRY_MARK_DELETED | XCACHE_ENTRY_FIX_COUNT_MASK) - logtb_get_current_tran_index ()) 60 #define XCACHE_ENTRY_DELETED_BY_ME (XCACHE_ENTRY_MARK_DELETED | XCACHE_ENTRY_FIX_COUNT_MASK) 63 #define XCACHE_PTR_TO_KEY(ptr) ((XASL_ID *) ptr) 64 #define XCACHE_PTR_TO_ENTRY(ptr) ((XASL_CACHE_ENTRY *) ptr) 85 #define XCACHE_STATS_INITIALIZER { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 106 struct timeval last_cleaned_time;
122 , last_cleaned_time { 0, 0 }
123 , time_threshold (360)
126 , logging_enabled (
false)
130 , cleanup_array (
NULL)
140 #define xcache_Enabled xcache_Global.enabled 141 #define xcache_Soft_capacity xcache_Global.soft_capacity 142 #define xcache_Time_threshold xcache_Global.time_threshold 143 #define xcache_Last_cleaned_time xcache_Global.last_cleaned_time 144 #define xcache_Hashmap xcache_Global.hashmap 145 #define xcache_Entry_count xcache_Global.entry_count 146 #define xcache_Log xcache_Global.logging_enabled 147 #define xcache_Max_clones xcache_Global.max_clones 148 #define xcache_Cleanup_flag xcache_Global.cleanup_flag 149 #define xcache_Cleanup_bh xcache_Global.cleanup_bh 150 #define xcache_Cleanup_array xcache_Global.cleanup_array 153 #define XCACHE_STAT_GET(name) ATOMIC_LOAD_64 (&xcache_Global.stats.name) 154 #define XCACHE_STAT_INC(name) ATOMIC_INC_64 (&xcache_Global.stats.name, 1) 156 #define TIME_DIFF_SEC(t1, t2) (t1.tv_sec - t2.tv_sec) 189 #define XCACHE_ATOMIC_CAS_CACHE_FLAG(xid, oldcf, newcf) (ATOMIC_CAS_32 (&(xid)->cache_flag, oldcf, newcf)) 192 #define XCACHE_CLEANUP_RATIO 0.2 193 #define XCACHE_CLEANUP_MIN_NUM_ENTRIES 20 194 #define XCACHE_CLEANUP_NUM_ENTRIES(capacity) \ 195 (MAX ((int) (2 * XCACHE_CLEANUP_RATIO * (capacity)), XCACHE_CLEANUP_MIN_NUM_ENTRIES)) 199 #define XCACHE_RT_TIMEDIFF_IN_SEC 360 200 #define XCACHE_RT_MAX_THRESHOLD 10000 201 #define XCACHE_RT_FACTOR 10 202 #define XCACHE_RT_CLASS_STAT_NEED_UPDATE(class_pages,heap_pages) \ 203 (((class_pages) < 100 && (((heap_pages) * 2 < (class_pages)) || ((heap_pages) > (class_pages) * 2))) \ 204 || ((heap_pages) < (class_pages) * 0.8f) || ((heap_pages) > (class_pages) * 1.2f)) 207 #define xcache_check_logging() (xcache_Log = prm_get_bool_value (PRM_ID_XASL_CACHE_LOGGING)) 208 #define xcache_log(...) if (xcache_Log) _er_log_debug (ARG_FILE_LINE, "XASL CACHE: " __VA_ARGS__) 209 #define xcache_log_error(...) if (xcache_Log) _er_log_debug (ARG_FILE_LINE, "XASL CACHE ERROR: " __VA_ARGS__) 211 #define XCACHE_LOG_TRAN_TEXT "\t tran = %d \n" 212 #define XCACHE_LOG_TRAN_ARGS(thrd) LOG_FIND_THREAD_TRAN_INDEX (thrd) 214 #define XCACHE_LOG_ERROR_TEXT "\t error_code = %d \n" 216 #define XCACHE_LOG_ENTRY_PTR_TEXT "\t\t entry ptr = %p \n" 218 #define XCACHE_LOG_SHA1_TEXT "\t\t\t sha1 = %08x | %08x | %08x | %08x | %08x \n" 219 #define XCACHE_LOG_SHA1_ARGS(sha1) SHA1_AS_ARGS (sha1) 221 #define XCACHE_LOG_TIME_STORED_TEXT "\t\t\t time stored = %d sec, %d usec \n" 222 #define XCACHE_LOG_EXEINFO_TEXT "\t\t\t user text = %s \n" \ 223 "\t\t\t plan text = %s \n" \ 224 "\t\t\t hash text = %s \n" 225 #define XCACHE_LOG_CLONE "\t\t\t xasl = %p \n" \ 226 "\t\t\t xasl_buf = %p \n" 228 #define XCACHE_LOG_XASL_ID_TEXT(msg) \ 230 XCACHE_LOG_SHA1_TEXT \ 231 XCACHE_LOG_TIME_STORED_TEXT 232 #define XCACHE_LOG_XASL_ID_ARGS(xid) \ 233 SHA1_AS_ARGS (&(xid)->sha1), \ 234 CACHE_TIME_AS_ARGS (&(xid)->time_stored) 236 #define XCACHE_LOG_ENTRY_TEXT(msg) \ 238 XCACHE_LOG_ENTRY_PTR_TEXT \ 239 XCACHE_LOG_XASL_ID_TEXT ("xasl_id") \ 240 "\t\t sql_info: \n" \ 241 XCACHE_LOG_EXEINFO_TEXT \ 242 "\t\t n_oids = %d \n" 243 #define XCACHE_LOG_ENTRY_ARGS(xent) \ 245 XCACHE_LOG_XASL_ID_ARGS (&(xent)->xasl_id), \ 246 EXEINFO_AS_ARGS(&(xent)->sql_info), \ 247 (xent)->n_related_objects 248 #define XCACHE_LOG_CLONE_ARGS(xclone) XASL_CLONE_AS_ARGS (xclone) 250 #define XCACHE_LOG_OBJECT_TEXT "\t\t\t oid = %d|%d|%d \n" \ 251 "\t\t\t lock = %s \n" \ 252 "\t\t\t tcard = %d \n" 253 #define XCACHE_LOG_ENTRY_OBJECT_TEXT(msg) \ 255 XCACHE_LOG_OBJECT_TEXT 256 #define XCACHE_LOG_ENTRY_OBJECT_ARGS(xent, oidx) \ 257 OID_AS_ARGS (&(xent)->related_objects[oidx].oid), \ 258 LOCK_TO_LOCKMODE_STRING ((xent)->related_objects[oidx].lock), \ 259 (xent)->related_objects[oidx].tcard 283 HL_HEAPID save_heapid;
300 const int freelist_block_count = 2;
303 xcache_Entry_descriptor);
346 HL_HEAPID save_heapid;
379 assert (cache_clones ==
NULL || cache_clones == &one_clone);
386 cache_clones = &one_clone;
387 one_clone.xasl =
NULL;
388 one_clone.xasl_buf =
NULL;
389 cache_clones_capacity = 1;
402 static int xcache_nentries = 0;
405 if (xcache_entry ==
NULL)
498 xcache_log (
"uninit an entry from cache and free its data: \n" 539 xcache_log (
"uninit an entry without freeing its data: \n" 568 #if !defined (NDEBUG) 632 xcache_log (
"compare keys: found for cleanup\n" 643 xcache_log (
"compare keys: failed to cleanup\n" 660 xcache_log (
"compare keys: found for delete\n" 671 xcache_log (
"compare keys: skip not deleted\n" 709 xcache_log (
"compare keys: skip to be recompiled\n" 723 xcache_log (
"compare keys: key matched and fixed %s\n" 744 unsigned int hash_index = ((
unsigned int) xasl_id->
sha1.
h[0]) % hash_table_size;
748 "\t\t hash index value = %d \n" 810 lookup_key.
sha1 = *sha1;
813 if (*xcache_entry ==
NULL)
848 if (recompile_needed)
853 *xcache_entry =
NULL;
892 HL_HEAPID save_heapid = 0;
895 bool use_xasl_clone =
false;
903 &recompile_due_to_threshold);
909 if (*xcache_entry ==
NULL)
920 if ((*xcache_entry)->xasl_id.time_stored.sec != xid->
time_stored.
sec 924 xcache_log (
"could not get cache entry because time_stored mismatch \n" 931 *xcache_entry =
NULL;
945 xcache_log (
"found cache entry by xasl_id: \n" 961 for (oid_index = 0; oid_index < (*xcache_entry)->n_related_objects; oid_index++)
963 if ((*xcache_entry)->related_objects[oid_index].lock <=
NULL_LOCK)
970 (*xcache_entry)->related_objects[oid_index].lock,
LK_UNCOND_LOCK);
975 *xcache_entry =
NULL;
976 xcache_log (
"could not get cache entry because lock on oid failed: \n" 991 xcache_log (
"could not get cache entry because it was deleted until locked: \n" 996 *xcache_entry =
NULL;
1004 use_xasl_clone =
true;
1006 if ((*xcache_entry)->cache_clones ==
NULL)
1015 if ((*xcache_entry)->n_cache_clones > 0)
1018 *xclone = (*xcache_entry)->cache_clones[--(*xcache_entry)->n_cache_clones];
1042 (*xcache_entry)->stream.buffer_size, &xclone->
xasl_buf);
1043 if (save_heapid != 0)
1053 *xcache_entry =
NULL;
1085 INT32 cache_flag = 0;
1086 INT32 new_cache_flag = 0;
1088 struct timeval time_last_used;
1096 (void) gettimeofday (&time_last_used,
NULL);
1097 ATOMIC_TAS (&xcache_entry->
time_last_used.tv_sec, time_last_used.tv_sec);
1100 ATOMIC_INC_64 (&xcache_entry->
ref_count, 1);
1106 new_cache_flag = cache_flag;
1112 new_cache_flag = cache_flag - 1;
1119 xcache_log_error (
"unexpected cache_flag = XCACHE_ENTRY_TO_BE_RECOMPILED on unfix: \n" 1150 xcache_log (
"delete entry from hash after unfix: \n" 1182 INT32 cache_flag = 0;
1183 INT32 new_cache_flag;
1192 xcache_log (
"tried to mark entry as deleted, but somebody else already marked it: \n" 1200 xcache_log_error (
"tried to mark entry as deleted, but it was marked as to be recompiled: \n" 1208 new_cache_flag = cache_flag;
1213 new_cache_flag &= ~XCACHE_ENTRY_WAS_RECOMPILED;
1217 if (new_cache_flag == XCACHE_ENTRY_MARK_DELETED)
1247 INT32 cache_flag = 0;
1248 INT32 new_cache_flag;
1257 xcache_log (
"tried to set flag request recompile, but entry is marked for delete: \n" 1266 xcache_log_error (
"tried to mark entry as request recompile, but it was marked as to be recompiled: \n" 1272 if (!set_flag && (cache_flag & XCACHE_ENTRY_TO_BE_RECOMPILED))
1280 xcache_log (
"tried to mark entry as request recompile, but somebody else already marked it: \n" 1286 new_cache_flag = cache_flag;
1294 new_cache_flag = new_cache_flag & (~XCACHE_ENTRY_RECOMPILED_REQUESTED);
1302 xcache_log (
"set entry request recompile flag: \n" 1308 xcache_log (
"clear entry request recompile flag: \n" 1319 struct timeval current_time;
1326 gettimeofday (¤t_time,
NULL);
1351 int n_oid,
const OID * class_oids,
const int *class_locks,
const int *tcards,
1355 bool inserted =
false;
1358 INT32 new_cache_flag;
1361 char *sql_hash_text =
NULL;
1362 char *sql_user_text =
NULL;
1363 char *sql_plan_text =
NULL;
1364 struct timeval time_stored;
1365 size_t sql_hash_text_len = 0, sql_user_text_len = 0, sql_plan_text_len = 0;
1366 char *strbuf =
NULL;
1389 if (related_objects ==
NULL)
1396 for (index = 0; index < n_oid; index++)
1413 strbuf = (
char *) malloc (sql_hash_text_len + sql_user_text_len + sql_plan_text_len);
1417 sql_hash_text_len + sql_user_text_len + sql_plan_text_len);
1423 sql_hash_text = strbuf;
1424 strbuf += sql_hash_text_len;
1426 if (sql_user_text_len > 0)
1429 sql_user_text = strbuf;
1430 strbuf += sql_user_text_len;
1433 if (sql_plan_text_len > 0)
1436 sql_plan_text = strbuf;
1440 (void) gettimeofday (&time_stored,
NULL);
1461 if (*xcache_entry ==
NULL)
1469 (*xcache_entry)->xasl_id.sha1 = context->
sha1;
1470 (*xcache_entry)->xasl_id.cache_flag = 1;
1471 (*xcache_entry)->n_related_objects = n_oid;
1472 (*xcache_entry)->related_objects = related_objects;
1473 (*xcache_entry)->sql_info.sql_hash_text = sql_hash_text;
1474 (*xcache_entry)->sql_info.sql_user_text = sql_user_text;
1475 (*xcache_entry)->sql_info.sql_plan_text = sql_plan_text;
1476 (*xcache_entry)->stream = *stream;
1477 (*xcache_entry)->time_last_rt_check = (INT64) time_stored.tv_sec;
1478 (*xcache_entry)->time_last_used = time_stored;
1482 inserted =
xcache_Hashmap.insert_given (thread_p, xid, *xcache_entry);
1490 (*xcache_entry)->free_data_on_uninit =
true;
1502 if (to_be_recompiled !=
NULL)
1515 "\t cache_flag = %d\n" 1531 to_be_recompiled =
NULL;
1541 "\t found or inserted = %s \n" 1542 "\t recompile xasl = %s \n" 1545 inserted ?
"inserted" :
"found",
1556 cache_flag = (*xcache_entry)->xasl_id.cache_flag;
1565 *xcache_entry =
NULL;
1573 xcache_log (
"(recompile) entry is recompiled by somebody else: \n" 1578 *xcache_entry =
NULL;
1586 if (*xcache_entry !=
NULL)
1590 to_be_recompiled = *xcache_entry;
1593 *xcache_entry =
NULL;
1596 xcache_log (
"(recompile) we marked entry to be recompiled: \n" 1611 #if defined (SERVER_MODE) 1626 if (related_objects)
1628 free (related_objects);
1632 free (sql_hash_text);
1653 if ((*xcache_entry) !=
NULL)
1657 if (to_be_recompiled)
1668 if (related_objects)
1670 free (related_objects);
1674 free (sql_hash_text);
1692 bool finished =
false;
1715 xcache_entry = iter.iterate ();
1716 if (xcache_entry ==
NULL)
1750 #define XCACHE_DELETE_XIDS_SIZE 1024 1753 int n_delete_xids = 0;
1755 bool finished =
false;
1775 xcache_entry = iter.iterate ();
1776 if (xcache_entry ==
NULL)
1783 if (invalidate_check ==
NULL || invalidate_check (xcache_entry, arg))
1804 delete_xids[n_delete_xids++] = xcache_entry->
xasl_id;
1811 xcache_Hashmap.end_tran (thread_p);
1820 for (xid_index = 0; xid_index < n_delete_xids; xid_index++)
1822 if (!xcache_Hashmap.erase (thread_p, delete_xids[xid_index]))
1831 #undef XCACHE_DELETE_XIDS_SIZE 1915 char *sql_id =
NULL;
1923 fprintf (fp,
"XASL cache is disabled.\n");
1929 fprintf (fp,
"XASL cache\n");
1930 fprintf (fp,
"Stats: \n");
1949 fprintf (fp,
"\nEntries:\n");
1950 while ((xcache_entry = iter.iterate ()) !=
NULL)
1953 fprintf (fp,
" XASL_ID = { \n");
1955 fprintf (fp,
" time_stored = %d sec, %d usec \n",
1957 fprintf (fp,
" } \n");
1960 fprintf (fp,
" reference count = %lld \n", (
long long) ATOMIC_INC_64 (&xcache_entry->
ref_count, 0));
1961 fprintf (fp,
" time second last used = %lld \n", (
long long) xcache_entry->
time_last_used.tv_sec);
1964 fprintf (fp,
" clone count = %d \n", xcache_entry->
n_cache_clones);
1966 fprintf (fp,
" sql info: \n");
1970 fprintf (fp,
" SQL_ID = %s \n", sql_id ? sql_id :
"(UNKNOWN)");
1980 fprintf (fp,
" sql plan text = %s \n",
1987 fprintf (fp,
" OID = %d|%d|%d, LOCK = %s, TCARD = %8d \n",
2043 assert (xclone->
xasl->status == XASL_CLEARED || xclone->
xasl->status == XASL_INITIALIZED);
2060 if (new_clones !=
NULL)
2070 if (new_clones ==
NULL)
2118 struct timeval current_time;
2120 int candidate_index;
2124 int save_max_capacity = 0;
2154 if (cleanup_count <= 0)
2164 if (cleanup_count <= xcache_Cleanup_bh->max_capacity)
2201 while ((xcache_entry = iter.iterate ()) !=
NULL)
2204 candidate.
xcache = xcache_entry;
2220 gettimeofday (¤t_time,
NULL);
2225 candidate.
xcache = xcache_entry;
2240 for (candidate_index = 0; candidate_index <
count; candidate_index++)
2260 if (xcache_Hashmap.erase (thread_p, candidate.
xid))
2262 xcache_log (
"cleanup: candidate was removed from hash" 2272 xcache_log (
"cleanup: candidate was not removed from hash" 2294 xcache_log (
"cleanup finished: entries = %d \n" 2325 if (left_timeval.tv_sec < right_timeval.tv_sec)
2329 else if (left_timeval.tv_sec == right_timeval.tv_sec)
2351 struct timeval crt_time;
2355 bool recompile =
false;
2357 (void) gettimeofday (&crt_time,
NULL);
2363 if (!ATOMIC_CAS_64 (&xcache_entry->
time_last_rt_check, save_secs, (INT64) crt_time.tv_sec))
2371 xcache_log (
"Unexpected flag found (recompile requested). Maybe the client preparing the XASL crashed !?: \n" 2393 if (cls_info_p ==
NULL)
2423 || npages < xcache_entry->related_objects[relobj].tcard /
XCACHE_RT_FACTOR)
2425 bool try_recompile =
true;
2433 try_recompile =
false;
#define XCACHE_RT_CLASS_STAT_NEED_UPDATE(class_pages, heap_pages)
int stx_map_stream_to_xasl(THREAD_ENTRY *thread_p, xasl_node **xasl_tree, bool use_xasl_clone, char *xasl_stream, int xasl_stream_size, XASL_UNPACK_INFO **xasl_unpack_info_ptr)
#define ER_QPROC_XASLNODE_RECOMPILE_REQUESTED
XCACHE_CLEANUP_CANDIDATE * cleanup_array
cubthread::entry * thread_get_thread_entry_info(void)
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)
CLS_INFO * catalog_get_class_info(THREAD_ENTRY *thread_p, OID *class_id_p, CATALOG_ACCESS_INFO *catalog_access_info_p)
#define XCACHE_ENTRY_FIX_COUNT_MASK
static int xcache_entry_uninit(void *entry)
#define LF_EM_NOT_USING_MUTEX
xcache_hashmap_type::iterator xcache_hashmap_iterator
XCACHE_RELATED_OBJECT * related_objects
#define XCACHE_CLEANUP_RATIO
#define XCACHE_RT_TIMEDIFF_IN_SEC
static int xcache_copy_key(void *src, void *dest)
#define pthread_mutex_init(a, b)
CLS_INFO * catalog_update_class_info(THREAD_ENTRY *thread_p, OID *class_id_p, CLS_INFO *class_info_p, CATALOG_ACCESS_INFO *catalog_access_info_p, bool skip_logging)
#define XCACHE_LOG_SHA1_TEXT
#define XCACHE_ENTRY_WAS_RECOMPILED
void bh_element_at(BINARY_HEAP *heap, int index, void *elem)
#define pthread_mutex_unlock(a)
#define XCACHE_LOG_XASL_ID_TEXT(msg)
#define xcache_check_logging()
bool xcache_uses_clones(void)
#define ER_QPROC_INVALID_XASLNODE
#define ASSERT_ERROR_AND_SET(error_code)
#define XCACHE_ENTRY_MARK_DELETED
void thread_sleep(double millisec)
#define assert_release(e)
unsigned int ci_time_stamp
int lock_object(THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock, int cond_flag)
xasl_cache_rt_check_result
#define XCACHE_STAT_GET(name)
#define XCACHE_LOG_ENTRY_TEXT(msg)
void xcache_retire_clone(THREAD_ENTRY *thread_p, XASL_CACHE_ENTRY *xcache_entry, XASL_CLONE *xclone)
volatile INT32 entry_count
void xcache_remove_by_oid(THREAD_ENTRY *thread_p, const OID *oid)
XASL_CLONE * cache_clones
#define OID_AS_ARGS(oidp)
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)
static void xcache_cleanup(THREAD_ENTRY *thread_p)
HL_HEAPID db_change_private_heap(THREAD_ENTRY *thread_p, HL_HEAPID heap_id)
static XCACHE_CLEANUP_REASON xcache_need_cleanup(void)
#define xcache_Cleanup_flag
#define XCACHE_LOG_ENTRY_OBJECT_TEXT(msg)
#define XCACHE_STAT_INC(name)
#define XCACHE_LOG_XASL_ID_ARGS(xid)
enum xcache_cleanup_reason XCACHE_CLEANUP_REASON
#define VFID_ISNULL(vfid_ptr)
#define SHA1_AS_ARGS(sha1)
bool xcache_can_entry_cache_list(XASL_CACHE_ENTRY *xcache_entry)
int xcache_invalidate_qcaches(THREAD_ENTRY *thread_p, const OID *oid)
static bool xcache_entry_mark_deleted(THREAD_ENTRY *thread_p, XASL_CACHE_ENTRY *xcache_entry)
int xcache_initialize(THREAD_ENTRY *thread_p)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
void bh_destroy(THREAD_ENTRY *thread_p, BINARY_HEAP *heap)
#define XASL_SET_FLAG(x, f)
#define XASL_ID_COPY(X1, X2)
#define xcache_Cleanup_array
#define XCACHE_LOG_ENTRY_ARGS(xent)
int file_get_num_user_pages(THREAD_ENTRY *thread_p, const VFID *vfid, int *n_user_pages_out)
int prm_get_integer_value(PARAM_ID prm_id)
#define ER_OUT_OF_VIRTUAL_MEMORY
#define xcache_log_error(...)
#define XASL_CLASS_NO_TCARD
static int xcache_compare_key(void *key1, void *key2)
int xcache_find_xasl_id_for_execute(THREAD_ENTRY *thread_p, const XASL_ID *xid, XASL_CACHE_ENTRY **xcache_entry, XASL_CLONE *xclone)
void xcache_finalize(THREAD_ENTRY *thread_p)
void xcache_unfix(THREAD_ENTRY *thread_p, XASL_CACHE_ENTRY *xcache_entry)
#define xcache_Soft_capacity
unsigned int stats_get_time_stamp(void)
#define XCACHE_DELETE_XIDS_SIZE
#define XCACHE_ENTRY_RECOMPILED_REQUESTED
#define XCACHE_PTR_TO_KEY(ptr)
#define OID_EQ(oidp1, oidp2)
#define XCACHE_STATS_INITIALIZER
int qexec_clear_xasl(THREAD_ENTRY *thread_p, xasl_node *xasl, bool is_final)
XASL_CACHE_ENTRY * xcache
#define LOCK_TO_LOCKMODE_STRING(lock)
static int xcache_entry_init(void *entry)
static void xcache_clone_decache(THREAD_ENTRY *thread_p, XASL_CLONE *xclone)
#define XCACHE_ENTRY_CLEANUP
#define XASL_DECACHE_CLONE
#define XCACHE_ENTRY_TO_BE_RECOMPILED
static unsigned int xcache_hash_key(void *key, int hash_table_size)
static bool xcache_entry_is_related_to_oid(XASL_CACHE_ENTRY *xcache_entry, const OID *related_to_oid)
#define XCACHE_LOG_CLONE_ARGS(xclone)
#define TIME_DIFF_SEC(t1, t2)
#define CACHE_TIME_MAKE(CT, TV)
int count(int &result, const cub_regex_object ®, const std::string &src, const int position, const INTL_CODESET codeset)
#define XCACHE_CLEANUP_NUM_ENTRIES(capacity)
#define xcache_Cleanup_bh
static int xcache_entry_free(void *entry)
void free_xasl_unpack_info(THREAD_ENTRY *thread_p, REFPTR(XASL_UNPACK_INFO, xasl_unpack_info))
static void error(const char *msg)
STATIC_INLINE void perfmon_inc_stat(THREAD_ENTRY *thread_p, PERF_STAT_ID psid) __attribute__((ALWAYS_INLINE))
#define HFID_IS_NULL(hfid)
bool qfile_has_no_cache_entries()
int xcache_get_entry_count(void)
static bool xcache_entry_set_request_recompile_flag(THREAD_ENTRY *thread_p, XASL_CACHE_ENTRY *xcache_entry, bool set_flag)
enum xasl_cache_search_mode XASL_CACHE_SEARCH_MODE
#define free_and_init(ptr)
BH_TRY_INSERT_RESULT bh_try_insert(BINARY_HEAP *heap, void *elem, void *replaced)
int qfile_get_list_cache_number_of_entries(int ht_no)
int cache_clones_capacity
static void * xcache_entry_alloc(void)
void xcache_dump(THREAD_ENTRY *thread_p, FILE *fp)
#define QFILE_IS_LIST_CACHE_DISABLED
bool prm_get_bool_value(PARAM_ID prm_id)
BINARY_HEAP * bh_create(THREAD_ENTRY *thread_p, int max_capacity, int elem_size, bh_key_comparator cmp_func, BH_CMP_ARG cmp_arg)
#define XCACHE_LOG_TRAN_ARGS(thrd)
#define XCACHE_ENTRY_SKIP_TO_BE_RECOMPILED
#define XCACHE_RT_MAX_THRESHOLD
static bool xcache_check_recompilation_threshold(THREAD_ENTRY *thread_p, XASL_CACHE_ENTRY *xcache_entry)
xasl_unpack_info * xasl_buf
int SHA1Compare(void *a, void *b)
#define xcache_Max_clones
static BH_CMP_RESULT xcache_compare_cleanup_candidates(const void *left, const void *right, BH_CMP_ARG ignore_arg)
#define XCACHE_LOG_SHA1_ARGS(sha1)
#define pthread_mutex_lock(a)
#define catalog_free_class_info_and_init(class_info_p)
#define XCACHE_LOG_ENTRY_OBJECT_ARGS(xent, oidx)
int qmgr_get_sql_id(THREAD_ENTRY *thread_p, char **sql_id_buf, char *query, size_t sql_len)
#define XCACHE_ATOMIC_CAS_CACHE_FLAG(xid, oldcf, newcf)
xcache_hashmap_type hashmap
#define xcache_Entry_count
static void xcache_invalidate_entries(THREAD_ENTRY *thread_p, bool(*invalidate_check)(XASL_CACHE_ENTRY *, const OID *), const OID *arg)
static LF_ENTRY_DESCRIPTOR xcache_Entry_descriptor
struct timeval time_last_used
#define XASL_ID_SET_NULL(X)
pthread_mutex_t cache_clones_mutex
#define xcache_Time_threshold
#define XASL_SERIAL_OID_TCARD
#define XCACHE_ENTRY_FLAGS_MASK
void xcache_drop_all(THREAD_ENTRY *thread_p)
#define XCACHE_ENTRY_DELETED_BY_ME
int qfile_clear_list_cache(THREAD_ENTRY *thread_p, int list_ht_no)
#define XCACHE_PTR_TO_ENTRY(ptr)
#define XCACHE_LOG_TRAN_TEXT
#define xcache_Last_cleaned_time
#define pthread_mutex_destroy(a)