CUBRID Engine
latest
|
#include "xasl.h"
Go to the source code of this file.
Classes | |
struct | xcache_related_object |
struct | xasl_clone |
struct | execution_info |
struct | xasl_cache_ent |
Macros | |
#define | XASL_CLONE_INITIALIZER { NULL, NULL } |
#define | XASL_CLONE_AS_ARGS(clone) (clone)->xasl, (clone)->xasl_buf |
#define | EXEINFO_HASH_TEXT_STRING(einfo) ((einfo)->sql_hash_text ? (einfo)->sql_hash_text : "UNKNOWN HASH TEXT") |
#define | EXEINFO_USER_TEXT_STRING(einfo) ((einfo)->sql_user_text ? (einfo)->sql_user_text : "UNKNOWN USER TEXT") |
#define | EXEINFO_PLAN_TEXT_STRING(einfo) ((einfo)->sql_plan_text ? (einfo)->sql_plan_text : "UNKNOWN PLAN TEXT") |
#define | EXEINFO_AS_ARGS(einfo) EXEINFO_USER_TEXT_STRING(einfo), EXEINFO_PLAN_TEXT_STRING(einfo), EXEINFO_HASH_TEXT_STRING(einfo) |
Typedefs | |
typedef struct xcache_related_object | XCACHE_RELATED_OBJECT |
typedef enum xcache_cleanup_reason | XCACHE_CLEANUP_REASON |
typedef struct xasl_clone | XASL_CLONE |
typedef struct execution_info | EXECUTION_INFO |
typedef struct xasl_cache_ent | XASL_CACHE_ENTRY |
typedef enum xasl_cache_search_mode | XASL_CACHE_SEARCH_MODE |
Enumerations | |
enum | xcache_cleanup_reason { XCACHE_CLEANUP_NONE, XCACHE_CLEANUP_FULL, XCACHE_CLEANUP_TIMEOUT } |
enum | xasl_cache_search_mode { XASL_CACHE_SEARCH_FOR_EXECUTE = 0, XASL_CACHE_SEARCH_FOR_PREPARE = 1, XASL_CACHE_SEARCH_GENERIC = XASL_CACHE_SEARCH_FOR_EXECUTE } |
enum | xasl_cache_rt_check_result { XASL_CACHE_RECOMPILE_NOT_NEEDED = 0, XASL_CACHE_RECOMPILE_EXECUTE = 1, XASL_CACHE_RECOMPILE_PREPARE = 2 } |
#define EXEINFO_AS_ARGS | ( | einfo | ) | EXEINFO_USER_TEXT_STRING(einfo), EXEINFO_PLAN_TEXT_STRING(einfo), EXEINFO_HASH_TEXT_STRING(einfo) |
Definition at line 84 of file xasl_cache.h.
#define EXEINFO_HASH_TEXT_STRING | ( | einfo | ) | ((einfo)->sql_hash_text ? (einfo)->sql_hash_text : "UNKNOWN HASH TEXT") |
Definition at line 80 of file xasl_cache.h.
#define EXEINFO_PLAN_TEXT_STRING | ( | einfo | ) | ((einfo)->sql_plan_text ? (einfo)->sql_plan_text : "UNKNOWN PLAN TEXT") |
Definition at line 82 of file xasl_cache.h.
#define EXEINFO_USER_TEXT_STRING | ( | einfo | ) | ((einfo)->sql_user_text ? (einfo)->sql_user_text : "UNKNOWN USER TEXT") |
Definition at line 81 of file xasl_cache.h.
#define XASL_CLONE_AS_ARGS | ( | clone | ) | (clone)->xasl, (clone)->xasl_buf |
Definition at line 68 of file xasl_cache.h.
Definition at line 67 of file xasl_cache.h.
Referenced by xqmgr_execute_query().
typedef struct execution_info EXECUTION_INFO |
Definition at line 73 of file xasl_cache.h.
typedef struct xasl_cache_ent XASL_CACHE_ENTRY |
Definition at line 89 of file xasl_cache.h.
typedef enum xasl_cache_search_mode XASL_CACHE_SEARCH_MODE |
Definition at line 145 of file xasl_cache.h.
typedef struct xasl_clone XASL_CLONE |
Definition at line 61 of file xasl_cache.h.
typedef enum xcache_cleanup_reason XCACHE_CLEANUP_REASON |
Definition at line 56 of file xasl_cache.h.
typedef struct xcache_related_object XCACHE_RELATED_OBJECT |
Definition at line 42 of file xasl_cache.h.
Enumerator | |
---|---|
XASL_CACHE_RECOMPILE_NOT_NEEDED | |
XASL_CACHE_RECOMPILE_EXECUTE | |
XASL_CACHE_RECOMPILE_PREPARE |
Definition at line 147 of file xasl_cache.h.
Enumerator | |
---|---|
XASL_CACHE_SEARCH_FOR_EXECUTE | |
XASL_CACHE_SEARCH_FOR_PREPARE | |
XASL_CACHE_SEARCH_GENERIC |
Definition at line 138 of file xasl_cache.h.
Enumerator | |
---|---|
XCACHE_CLEANUP_NONE | |
XCACHE_CLEANUP_FULL | |
XCACHE_CLEANUP_TIMEOUT |
Definition at line 50 of file xasl_cache.h.
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().
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().
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().
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().
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().
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().