44 #if !defined(SERVER_MODE) 45 #define pthread_mutex_init(a, b) 46 #define pthread_mutex_destroy(a) 47 #define pthread_mutex_lock(a) 0 48 #define pthread_mutex_unlock(a) 71 #define NCACHE_OBJECTS 100 120 #if defined (SERVER_MODE) 160 #if defined(SERVER_MODE) 207 OID serial_class_oid;
240 attr_info_p = &attr_info;
250 pr_share_value (cur_val, result_num);
260 if (attr_info_p !=
NULL)
283 int num_alloc,
int is_auto_increment,
bool force_set_last_insert_id)
287 bool is_cache_mutex_locked =
false;
288 bool is_oid_locked =
false;
289 #if defined (SERVER_MODE) 320 is_cache_mutex_locked =
true;
341 if (is_oid_locked ==
false)
349 is_cache_mutex_locked =
false;
354 is_oid_locked =
true;
360 is_oid_locked =
true;
372 assert (is_oid_locked ==
true);
374 is_oid_locked =
false;
379 if (is_cache_mutex_locked ==
true)
382 is_cache_mutex_locked =
false;
394 if (is_cache_mutex_locked)
397 is_cache_mutex_locked =
false;
403 is_oid_locked =
false;
421 bool exhausted =
false;
443 num_alloc, &next_val);
459 if (exhausted ==
true)
485 num_alloc, &next_val);
514 OID serial_class_oid;
556 attr_info_p = &attr_info;
579 &entry->
oid, &key_val);
597 if (attr_info_p !=
NULL)
634 OID serial_class_oid;
665 attr_info_p = &attr_info;
695 pr_share_value (val, &cur_val);
703 pr_share_value (val, &inc_val);
711 pr_share_value (val, &max_val);
719 pr_share_value (val, &min_val);
727 pr_share_value (val, &cyclic);
735 pr_share_value (val, &started);
751 pr_share_value (&cur_val, &next_val);
758 serial_get_nth_value (&inc_val, &cur_val, &min_val, &max_val, &cyclic, (nturns * (cached_num - 1)),
773 serial_get_nth_value (&inc_val, &cur_val, &min_val, &max_val, &cyclic, (nturns * cached_num), &last_val);
778 ret =
serial_get_nth_value (&inc_val, &cur_val, &min_val, &max_val, &cyclic, num_alloc, &next_val);
793 if (cached_num > 1 && !
DB_IS_NULL (&last_val))
808 serial_oidp, &key_val);
815 pr_share_value (&next_val, result_num);
839 pr_share_value (&next_val, &cur_val);
852 if (attr_info_p !=
NULL)
874 const OID * serial_class_oidp,
const OID * serial_oidp,
DB_VALUE * key_val)
903 repl_start_flush_mark (thread_p);
937 repl_add_update_lsa (thread_p, serial_oidp);
941 repl_end_flush_mark (thread_p,
false);
978 DB_VALUE tmp_val, cmp_result, add_val;
984 if (inc_val_flag < 0)
998 pr_share_value (inc_val, &add_val);
1002 if (inc_val_flag > 0)
1020 pr_share_value (min_val, result_val);
1051 pr_share_value (max_val, result_val);
1077 if (serial_Cache_pool.
ht !=
NULL)
1083 if (serial_Cache_pool.
area ==
NULL)
1092 if (serial_Cache_pool.
ht ==
NULL)
1117 if (serial_Cache_pool.
ht !=
NULL)
1120 serial_Cache_pool.
ht =
NULL;
1123 while (serial_Cache_pool.
area)
1125 tmp_area = serial_Cache_pool.
area;
1178 char *attr_name_p, *
string =
NULL;
1179 int alloced_string = 0;
1202 for (i = 0; i < attr_info.num_values; i++)
1214 attr_name_p = string;
1215 if (attr_name_p ==
NULL)
1266 if (
string !=
NULL && alloced_string)
1344 if (tmp_area ==
NULL)
1349 tmp_area->
next = serial_Cache_pool.
area;
1350 serial_Cache_pool.
area = tmp_area;
1369 #if defined (SERVER_MODE) 1401 if (tmp_area ==
NULL)
1417 for (i = 0; i < num - 1; i++)
1426 #if defined (SERVER_MODE) 1470 serial_get_index_btid (
BTID * output)
1477 BTID_COPY (output, &serial_Cached_btid);
#define SERIAL_ATTR_CLASS_NAME
DB_VALUE * heap_attrinfo_access(ATTR_ID attrid, HEAP_CACHE_ATTRINFO *attr_info)
static int serial_load_attribute_info_of_db_serial(THREAD_ENTRY *thread_p)
#define SERIAL_ATTR_OWNER
pthread_mutex_t cache_pool_mutex
#define pthread_mutex_lock(a)
void set_external_buffer(char *buf, std::size_t buf_size)
int heap_scancache_quick_start_modify_with_class_oid(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, OID *class_oid)
SCAN_CODE heap_get_visible_version(THREAD_ENTRY *thread_p, const OID *oid, OID *class_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking, int old_chn)
int db_get_int(const DB_VALUE *value)
static void serial_clear_value(SERIAL_CACHE_ENTRY *entry)
int mht_rem(MHT_TABLE *ht, const void *key, int(*rem_func)(const void *key, void *data, void *args), void *func_args)
int xserial_get_current_value(THREAD_ENTRY *thread_p, DB_VALUE *result_num, const OID *oid_p, int cached_num)
const void * mht_put(MHT_TABLE *ht, const void *key, void *data)
int db_make_numeric(DB_VALUE *value, const DB_C_NUMERIC num, const int precision, const int scale)
#define ASSERT_ERROR_AND_SET(error_code)
#define SERIAL_ATTR_CACHED_NUM
#define assert_release(e)
#define LOG_CHECK_LOG_APPLIER(thread_p)
int numeric_db_value_compare(const DB_VALUE *dbv1, const DB_VALUE *dbv2, DB_VALUE *answer)
int lock_object(THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock, int cond_flag)
void log_sysop_start(THREAD_ENTRY *thread_p)
#define OID_SET_NULL(oidp)
int numeric_db_value_sub(const DB_VALUE *dbv1, const DB_VALUE *dbv2, DB_VALUE *answer)
void xcache_remove_by_oid(THREAD_ENTRY *thread_p, const OID *oid)
void xserial_decache(THREAD_ENTRY *thread_p, OID *oidp)
ATTR_ID serial_Attrs_id[SERIAL_ATTR_MAX_INDEX]
int heap_scancache_end(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
SERIAL_CACHE_ENTRY * free_list
struct serial_cache_area * next
#define COPY_OID(dest_oid_ptr, src_oid_ptr)
LOCK lock_get_object_lock(const OID *oid, const OID *class_oid)
bool spage_is_updatable(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, int record_descriptor_length)
std::size_t get_size(void) const
int spage_update(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, const RECDES *record_descriptor_p)
SERIAL_CACHE_ENTRY * obj_area
void mht_destroy(MHT_TABLE *ht)
int heap_attrinfo_start(THREAD_ENTRY *thread_p, const OID *class_oid, int requested_num_attrs, const ATTR_ID *attrids, HEAP_CACHE_ATTRINFO *attr_info)
static SERIAL_CACHE_AREA * serial_alloc_cache_area(int num)
#define RECDES_INITIALIZER
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
#define ER_QPROC_INVALID_PARAMETER
#define DB_MAX_NUMERIC_PRECISION
#define SERIAL_ATTR_MAX_VAL
static SERIAL_CACHE_ENTRY * serial_alloc_cache_entry(void)
#define ER_OUT_OF_VIRTUAL_MEMORY
#define SERIAL_ATTR_CYCLIC
static int xserial_get_next_value_internal(THREAD_ENTRY *thread_p, DB_VALUE *result_num, const OID *serial_oidp, int num_alloc)
SCAN_CODE heap_attrinfo_transform_to_disk(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, RECDES *old_recdes, record_descriptor *new_recdes)
static int serial_get_next_cached_value(THREAD_ENTRY *thread_p, SERIAL_CACHE_ENTRY *entry, int num_alloc)
#define ER_QPROC_SERIAL_RANGE_OVERFLOW
#define ER_QPROC_CANNOT_FETCH_SERIAL
static int serial_update_serial_object(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, RECDES *recdesc, HEAP_CACHE_ATTRINFO *attr_info, const OID *serial_class_oidp, const OID *serial_oidp, DB_VALUE *key_val)
void lock_unlock_object(THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock, bool force)
int heap_attrinfo_read_dbvalues(THREAD_ENTRY *thread_p, const OID *inst_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, HEAP_CACHE_ATTRINFO *attr_info)
OID * oid_Serial_class_oid
void * mht_get(MHT_TABLE *ht, const void *key)
void numeric_coerce_int_to_num(int arg, DB_C_NUMERIC answer)
int heap_scancache_quick_start_with_class_oid(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, OID *class_oid)
static int xserial_get_current_value_internal(THREAD_ENTRY *thread_p, DB_VALUE *result_num, const OID *serial_oidp)
static int serial_get_attrid(THREAD_ENTRY *thread_p, int attr_index, ATTR_ID &attrid)
#define db_private_free_and_init(thrd, ptr)
int xserial_get_next_value(THREAD_ENTRY *thread_p, DB_VALUE *result_num, const OID *oid_p, int cached_num, int num_alloc, int is_auto_increment, bool force_set_last_insert_id)
SERIAL_CACHE_POOL serial_Cache_pool
int numeric_db_value_is_positive(const DB_VALUE *dbvalue)
MHT_TABLE * mht_create(const char *name, int est_size, unsigned int(*hash_func)(const void *key, unsigned int ht_size), int(*cmp_func)(const void *key1, const void *key2))
struct serial_entry * next
int xsession_set_cur_insert_id(THREAD_ENTRY *thread_p, const DB_VALUE *value, bool force)
unsigned int oid_hash(const void *key_oid, unsigned int htsize)
PGBUF_WATCHER page_watcher
int numeric_db_value_mul(const DB_VALUE *dbv1, const DB_VALUE *dbv2, DB_VALUE *answer)
#define CEIL_PTVDIV(dividend, divisor)
int pr_clear_value(DB_VALUE *value)
#define SERIAL_ATTR_CURRENT_VAL
void serial_finalize_cache_pool(void)
void log_sysop_abort(THREAD_ENTRY *thread_p)
#define pthread_mutex_destroy(a)
int oid_compare_equals(const void *key_oid1, const void *key_oid2)
#define SERIAL_ATTR_INCREMENT_VAL
static void error(const char *msg)
const recdes & get_recdes(void) const
int heap_get_btid_from_index_name(THREAD_ENTRY *thread_p, const OID *p_class_oid, const char *index_name, BTID *p_found_btid)
#define LOG_FIND_THREAD_TRAN_INDEX(thrd)
int pr_clone_value(const DB_VALUE *src, DB_VALUE *dest)
#define pthread_mutex_init(a, b)
int serial_initialize_cache_pool(THREAD_ENTRY *thread_p)
#define free_and_init(ptr)
#define BTID_COPY(btid_ptr1, btid_ptr2)
int or_get_attrname(RECDES *record, int attrid, char **string, int *alloced_string)
#define ER_HEAP_UNKNOWN_OBJECT
void log_sysop_commit(THREAD_ENTRY *thread_p)
#define pthread_mutex_unlock(a)
static void serial_set_cache_entry(SERIAL_CACHE_ENTRY *entry, DB_VALUE *inc_val, DB_VALUE *cur_val, DB_VALUE *min_val, DB_VALUE *max_val, DB_VALUE *started, DB_VALUE *cyclic, DB_VALUE *last_val, int cached_num)
#define CHECK_MODIFICATION_NO_RETURN(error)
int db_make_null(DB_VALUE *value)
#define DB_IS_NULL(value)
#define SERIAL_ATTR_STARTED
#define DB_NUMERIC_BUF_SIZE
#define BTID_IS_NULL(btid)
int db_make_int(DB_VALUE *value, const int num)
void heap_attrinfo_end(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info)
static int serial_update_cur_val_of_serial(THREAD_ENTRY *thread_p, SERIAL_CACHE_ENTRY *entry)
int numeric_db_value_add(const DB_VALUE *dbv1, const DB_VALUE *dbv2, DB_VALUE *answer)
void set_type(std::int16_t type)
bool log_does_allow_replication(void)
int heap_attrinfo_set(const OID *inst_oid, ATTR_ID attrid, DB_VALUE *attr_val, HEAP_CACHE_ATTRINFO *attr_info)
#define SERIAL_ATTR_ATT_NAME
#define SERIAL_ATTR_MIN_VAL
void oid_get_serial_oid(OID *oid)
void log_append_redo_recdes(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, const RECDES *recdes)
static int serial_get_nth_value(DB_VALUE *inc_val, DB_VALUE *cur_val, DB_VALUE *min_val, DB_VALUE *max_val, DB_VALUE *cyclic, int nth, DB_VALUE *result_val)
#define ER_QPROC_CANNOT_UPDATE_SERIAL
SCAN_CODE heap_get_class_record(THREAD_ENTRY *thread_p, const OID *class_oid, RECDES *recdes_p, HEAP_SCANCACHE *scan_cache, int ispeeking)