26 #define __STDC_FORMAT_MACROS 65 #if defined(ENABLE_SYSTEMTAP) 77 #if !defined(SERVER_MODE) 78 #define pthread_mutex_init(a, b) 79 #define pthread_mutex_destroy(a) 80 #define pthread_mutex_lock(a) 0 81 #define pthread_mutex_trylock(a) 0 82 #define pthread_mutex_unlock(a) 86 #define HEAP_BESTSPACE_SYNC_THRESHOLD (0.1f) 90 #define OR_FIXED_ATTRIBUTES_OFFSET_BY_OBJ(obj, nvars) \ 91 (OR_HEADER_SIZE(obj) + OR_VAR_TABLE_SIZE_INTERNAL(nvars, OR_GET_OFFSET_SIZE(obj))) 93 #define HEAP_GUESS_NUM_ATTRS_REFOIDS 100 94 #define HEAP_GUESS_NUM_INDEXED_ATTRS 100 96 #define HEAP_CLASSREPR_MAXCACHE 1024 98 #define HEAP_STATS_ENTRY_MHT_EST_SIZE 1000 99 #define HEAP_STATS_ENTRY_FREELIST_SIZE 1000 102 #define HEAP_DROP_FREE_SPACE (int)(DB_PAGESIZE * 0.3) 104 #define HEAP_DEBUG_SCANCACHE_INITPATTERN (12345) 106 #if defined(CUBRID_DEBUG) 107 #define HEAP_DEBUG_ISVALID_SCANRANGE(scan_range) \ 108 heap_scanrange_isvalid(scan_range) 110 #define HEAP_DEBUG_ISVALID_SCANRANGE(scan_range) (DISK_VALID) 113 #define HEAP_IS_PAGE_OF_OID(thread_p, pgptr, oid) \ 115 && pgbuf_get_volume_id (pgptr) == (oid)->volid \ 116 && pgbuf_get_page_id (pgptr) == (oid)->pageid) 118 #define MVCC_SET_DELETE_INFO(mvcc_delete_info_p, row_delete_id, \ 119 satisfies_del_result) \ 122 assert ((mvcc_delete_info_p) != NULL); \ 123 (mvcc_delete_info_p)->row_delid = (row_delete_id); \ 124 (mvcc_delete_info_p)->satisfies_delete_result = (satisfies_del_result); \ 128 #define HEAP_MVCC_SET_HEADER_MAXIMUM_SIZE(mvcc_rec_header_p) \ 131 if (!MVCC_IS_FLAG_SET (mvcc_rec_header_p, OR_MVCC_FLAG_VALID_INSID)) \ 133 MVCC_SET_FLAG_BITS (mvcc_rec_header_p, OR_MVCC_FLAG_VALID_INSID); \ 134 MVCC_SET_INSID (mvcc_rec_header_p, MVCCID_ALL_VISIBLE); \ 136 if (!MVCC_IS_FLAG_SET (mvcc_rec_header_p, OR_MVCC_FLAG_VALID_DELID)) \ 138 MVCC_SET_FLAG_BITS (mvcc_rec_header_p, OR_MVCC_FLAG_VALID_DELID); \ 139 MVCC_SET_DELID (mvcc_rec_header_p, MVCCID_NULL); \ 141 if (!MVCC_IS_FLAG_SET (mvcc_rec_header_p, OR_MVCC_FLAG_VALID_PREV_VERSION)) \ 143 MVCC_SET_FLAG_BITS (mvcc_rec_header_p, OR_MVCC_FLAG_VALID_PREV_VERSION); \ 144 LSA_SET_NULL(&(mvcc_rec_header_p)->prev_version_lsa); \ 149 #if defined (SERVER_MODE) 150 #define HEAP_UPDATE_IS_MVCC_OP(is_mvcc_class, update_style) \ 151 ((is_mvcc_class) && (!HEAP_IS_UPDATE_INPLACE (update_style)) ? (true) : (false)) 153 #define HEAP_UPDATE_IS_MVCC_OP(is_mvcc_class, update_style) (false) 156 #define HEAP_SCAN_ORDERED_HFID(scan) \ 157 (((scan) != NULL) ? (&(scan)->node.hfid) : (PGBUF_ORDERED_NULL_HFID)) 182 #define HEAP_NUM_BEST_SPACESTATS 10 185 #define HEAP_STATS_NEXT_BEST_INDEX(i) \ 186 (((i) + 1) % HEAP_NUM_BEST_SPACESTATS) 187 #define HEAP_STATS_PREV_BEST_INDEX(i) \ 188 (((i) == 0) ? (HEAP_NUM_BEST_SPACESTATS - 1) : ((i) - 1)); 240 #define HEAP_PAGE_FLAG_VACUUM_STATUS_MASK 0xC0000000 241 #define HEAP_PAGE_FLAG_VACUUM_ONCE 0x80000000 242 #define HEAP_PAGE_FLAG_VACUUM_UNKNOWN 0x40000000 244 #define HEAP_PAGE_SET_VACUUM_STATUS(chain, status) \ 247 assert ((status) == HEAP_PAGE_VACUUM_NONE \ 248 || (status) == HEAP_PAGE_VACUUM_ONCE \ 249 || (status) == HEAP_PAGE_VACUUM_UNKNOWN); \ 250 (chain)->flags &= ~HEAP_PAGE_FLAG_VACUUM_STATUS_MASK; \ 251 if ((status) == HEAP_PAGE_VACUUM_ONCE) \ 253 (chain)->flags |= HEAP_PAGE_FLAG_VACUUM_ONCE; \ 255 else if ((status) == HEAP_PAGE_VACUUM_UNKNOWN) \ 257 (chain)->flags |= HEAP_PAGE_FLAG_VACUUM_UNKNOWN; \ 262 #define HEAP_PAGE_GET_VACUUM_STATUS(chain) \ 263 (((chain)->flags & HEAP_PAGE_FLAG_VACUUM_STATUS_MASK) == 0 \ 264 ? HEAP_PAGE_VACUUM_NONE \ 265 : ((((chain)->flags & HEAP_PAGE_FLAG_VACUUM_STATUS_MASK) \ 266 == HEAP_PAGE_FLAG_VACUUM_ONCE) \ 267 ? HEAP_PAGE_VACUUM_ONCE : HEAP_PAGE_VACUUM_UNKNOWN)) 280 #define HEAP_CHK_ADD_UNFOUND_RELOCOIDS 100 303 #define DEFAULT_REPR_INCREMENT 16 375 #ifdef DEBUG_CLASSREPR_CACHE 377 pthread_mutex_t num_fix_entries_mutex;
388 PTHREAD_MUTEX_INITIALIZER,
392 PTHREAD_MUTEX_INITIALIZER,
396 #ifdef DEBUG_CLASSREPR_CACHE 397 , 0, PTHREAD_MUTEX_INITIALIZER
401 #define CLASSREPR_REPR_INCREMENT 10 402 #define CLASSREPR_HASH_SIZE (heap_Classrepr_cache.num_entries * 2) 403 #define REPR_HASH(class_oid) (OID_PSEUDO_KEY(class_oid)%CLASSREPR_HASH_SIZE) 405 #define HEAP_MAYNEED_DECACHE_GUESSED_LASTREPRS(class_oid, hfid) \ 408 if (heap_Classrepr != NULL && (hfid) != NULL) \ 410 if (HFID_IS_NULL (&(heap_Classrepr->rootclass_hfid))) \ 411 (void) boot_find_root_heap (&(heap_Classrepr->rootclass_hfid)); \ 412 if (HFID_EQ ((hfid), &(heap_Classrepr->rootclass_hfid))) \ 413 (void) heap_classrepr_decache_guessed_last (class_oid); \ 418 #define HEAP_CHNGUESS_FUDGE_MININDICES (100) 419 #define HEAP_NBITS_IN_BYTE (8) 420 #define HEAP_NSHIFTS (3) 421 #define HEAP_BITMASK (HEAP_NBITS_IN_BYTE - 1) 422 #define HEAP_NBITS_TO_NBYTES(bit_cnt) \ 423 ((unsigned int)((bit_cnt) + HEAP_BITMASK) >> HEAP_NSHIFTS) 424 #define HEAP_NBYTES_TO_NBITS(byte_cnt) ((unsigned int)(byte_cnt) << HEAP_NSHIFTS) 425 #define HEAP_NBYTES_CLEARED(byte_ptr, byte_cnt) \ 426 memset((byte_ptr), '\0', (byte_cnt)) 427 #define HEAP_BYTEOFFSET_OFBIT(bit_num) ((unsigned int)(bit_num) >> HEAP_NSHIFTS) 428 #define HEAP_BYTEGET(byte_ptr, bit_num) \ 429 ((unsigned char *)(byte_ptr) + HEAP_BYTEOFFSET_OFBIT(bit_num)) 431 #define HEAP_BITMASK_INBYTE(bit_num) \ 432 (1 << ((unsigned int)(bit_num) & HEAP_BITMASK)) 433 #define HEAP_BIT_GET(byte_ptr, bit_num) \ 434 (*HEAP_BYTEGET(byte_ptr, bit_num) & HEAP_BITMASK_INBYTE(bit_num)) 435 #define HEAP_BIT_SET(byte_ptr, bit_num) \ 436 (*HEAP_BYTEGET(byte_ptr, bit_num) = \ 437 *HEAP_BYTEGET(byte_ptr, bit_num) | HEAP_BITMASK_INBYTE(bit_num)) 438 #define HEAP_BIT_CLEAR(byte_ptr, bit_num) \ 439 (*HEAP_BYTEGET(byte_ptr, bit_num) = \ 440 *HEAP_BYTEGET(byte_ptr, bit_num) & ~HEAP_BITMASK_INBYTE(bit_num)) 500 { 0,
NULL,
NULL, 0, 0, 0,
NULL, PTHREAD_MUTEX_INITIALIZER };
510 #define heap_hfid_table_log(thp, oidp, msg, ...) \ 511 if (heap_Hfid_table->logging) \ 512 er_print_callstack (ARG_FILE_LINE, "HEAP_INFO_CACHE[thr(%d),tran(%d,%d),OID(%d|%d|%d)]: " msg "\n", \ 513 (thp)->index, LOG_FIND_CURRENT_TDES (thp)->tran_index, LOG_FIND_CURRENT_TDES (thp)->trid, \ 514 OID_AS_ARGS (oidp), __VA_ARGS__) 517 #define HEAP_RV_FLAG_VACUUM_STATUS_CHANGE 0x8000 519 #define HEAP_PERF_START(thread_p, context) \ 520 PERF_UTIME_TRACKER_START (thread_p, (context)->time_track) 521 #define HEAP_PERF_TRACK_PREPARE(thread_p, context) \ 524 if ((context)->time_track == NULL) break; \ 525 switch ((context)->type) { \ 526 case HEAP_OPERATION_INSERT: \ 527 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_INSERT_PREPARE); \ 529 case HEAP_OPERATION_DELETE: \ 530 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_DELETE_PREPARE); \ 532 case HEAP_OPERATION_UPDATE: \ 533 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_UPDATE_PREPARE); \ 540 #define HEAP_PERF_TRACK_EXECUTE(thread_p, context) \ 543 if ((context)->time_track == NULL) break; \ 544 switch ((context)->type) { \ 545 case HEAP_OPERATION_INSERT: \ 546 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, \ 547 (context)->time_track,\ 548 PSTAT_HEAP_INSERT_EXECUTE); \ 550 case HEAP_OPERATION_DELETE: \ 551 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_DELETE_EXECUTE); \ 553 case HEAP_OPERATION_UPDATE: \ 554 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_UPDATE_EXECUTE); \ 561 #define HEAP_PERF_TRACK_LOGGING(thread_p, context) \ 564 if ((context)->time_track == NULL) break; \ 565 switch ((context)->type) { \ 566 case HEAP_OPERATION_INSERT: \ 567 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_INSERT_LOG); \ 569 case HEAP_OPERATION_DELETE: \ 570 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_DELETE_LOG); \ 572 case HEAP_OPERATION_UPDATE: \ 573 PERF_UTIME_TRACKER_ADD_TIME_AND_RESTART (thread_p, (context)->time_track, PSTAT_HEAP_UPDATE_LOG); \ 581 #define heap_bestspace_log(...) \ 582 if (prm_get_bool_value (PRM_ID_DEBUG_BESTSPACE)) _er_log_debug (ARG_FILE_LINE, __VA_ARGS__) 588 #define heap_scan_pb_lock_and_fetch(...) \ 589 heap_scan_pb_lock_and_fetch_debug (__VA_ARGS__, ARG_FILE_LINE) 594 const int caller_line);
607 #ifdef DEBUG_CLASSREPR_CACHE 608 static int heap_classrepr_dump_cache (
bool simple_dump);
623 #if defined(ENABLE_UNUSED_FUNCTION) 624 static int heap_stats_quick_num_fit_in_bestspace (
HEAP_BESTSPACE * bestspace,
int num_entries,
int unit_size,
629 int record_length,
int needed_space,
634 VPID * hdr_vpid,
bool scan_all,
bool can_cycle);
648 #if defined(CUBRID_DEBUG) 659 int *ovf_overhead,
int *ovf_free_space);
664 const OID *
class_oid,
int cache_last_fix_page,
bool is_queryscan,
676 INT64 * num_recs_inovf, INT64 *
num_pages,
int *avg_freespace,
int *avg_freespace_nolast,
677 int *avg_reclength,
int *avg_overhead);
701 int func_col_id,
int func_attr_index_start,
TP_DOMAIN * midxkey_domain);
712 #if defined (SA_MODE) 715 static int heap_file_map_chkreloc (
THREAD_ENTRY * thread_p,
PAGE_PTR * page,
bool * stop,
void *args);
737 int lob_create_flag);
740 #if defined (ENABLE_UNUSED_FUNCTION) 749 HFID * class_hfid,
REPR_ID * repr_id,
int *has_partition_info);
753 static unsigned int heap_hash_vpid (
const void *key_vpid,
unsigned int htsize);
755 static unsigned int heap_hash_hfid (
const void *key_hfid,
unsigned int htsize);
767 bool reversed_direction,
DB_VALUE ** cache_recordinfo);
782 #if defined(ENABLE_UNUSED_FUNCTION) 789 const VPID * fwd_vpid_p,
const OID * fwd_oid_p,
793 const VPID * home_vpid_p,
const OID * oid_p,
797 int *again_count,
int again_max)
825 RECDES * recdes_p,
bool is_mvcc_op,
bool is_redistribute_op);
853 char **classname_out);
855 char **classname_out);
859 bool vacuum_status_change);
862 OID * partition_oid);
869 RECDES * recdes_p,
int size);
895 bool is_page_watcher_inited);
899 const VPID new_next_vpid,
const VPID new_last_vpid,
const int new_num_pages);
910 const VPID *vpid = (
VPID *) key_vpid;
912 return ((vpid->
pageid | ((
unsigned int) vpid->
volid) << 24) % htsize);
924 const VPID *vpid1 = (
VPID *) key_vpid1;
925 const VPID *vpid2 = (
VPID *) key_vpid2;
939 const HFID *hfid = (
HFID *) key_hfid;
941 return ((hfid->
hpgid | ((
unsigned int) hfid->
vfid.
volid) << 24) % htsize);
953 const HFID *hfid1 = (
HFID *) key_hfid1;
954 const HFID *hfid2 = (
HFID *) key_hfid2;
1001 PERF_UTIME_TRACKER time_best_space = PERF_UTIME_TRACKER_INITIALIZER;
1005 PERF_UTIME_TRACKER_START (thread_p, &time_best_space);
1102 PERF_UTIME_TRACKER time_best_space = PERF_UTIME_TRACKER_INITIALIZER;
1104 PERF_UTIME_TRACKER_START (thread_p, &time_best_space);
1118 assert (del_cnt <= heap_Bestspace->num_stats_entries);
1141 PERF_UTIME_TRACKER time_best_space = PERF_UTIME_TRACKER_INITIALIZER;
1143 PERF_UTIME_TRACKER_START (thread_p, &time_best_space);
1169 #if defined (ENABLE_UNUSED_FUNCTION) 1221 #if defined (NDEBUG) 1229 const char *caller_file,
const int caller_line)
1236 if (scan_cache !=
NULL)
1264 if (pg_watcher !=
NULL)
1266 #if defined (NDEBUG) 1267 if (pgbuf_ordered_fix_release (thread_p, vpid_ptr, fetch_mode, page_latch_mode, pg_watcher) !=
NO_ERROR)
1270 caller_file, caller_line) !=
NO_ERROR)
1275 pgptr = pg_watcher->
pgptr;
1279 #if defined (NDEBUG) 1348 template <
typename ErF,
typename ... Args>
1354 er_input_str (
"HEAP_CLASSREPR[tran=%d,thrd=%d]: %s\n", msg);
1356 std::forward<Args> (args)...);
1358 #define heap_classrepr_log_er(msg, ...) \ 1359 if (prm_get_bool_value (PRM_ID_REPR_CACHE_LOG)) \ 1360 heap_classrepr_logging_template (ARG_FILE_LINE, _er_log_debug, msg, __VA_ARGS__) 1361 #define heap_classrepr_log_stack(msg, ...) \ 1362 if (prm_get_bool_value (PRM_ID_REPR_CACHE_LOG)) \ 1363 heap_classrepr_logging_template (ARG_FILE_LINE, er_print_callstack, msg, __VA_ARGS__) 1379 if (heap_Classrepr !=
NULL)
1391 heap_Classrepr_cache.
area =
1393 if (heap_Classrepr_cache.
area ==
NULL)
1401 cache_entry = heap_Classrepr_cache.
area;
1402 for (i = 0; i < heap_Classrepr_cache.
num_entries; i++)
1406 cache_entry[
i].
idx =
i;
1407 cache_entry[
i].
fcnt = 0;
1419 if (cache_entry[i].repr ==
NULL)
1425 memset (cache_entry[i].repr, 0, cache_entry[i].max_reprid *
sizeof (
OR_CLASSREP *));
1441 hash_entry = heap_Classrepr_cache.
hash_table;
1442 for (i = 0; i < heap_Classrepr_cache.
num_hash; i++)
1445 hash_entry[
i].
idx =
i;
1459 lock_entry = heap_Classrepr_cache.
lock_table;
1505 if (heap_Classrepr ==
NULL)
1510 #ifdef DEBUG_CLASSREPR_CACHE 1511 ret = heap_classrepr_dump_anyfixed ();
1519 cache_entry = heap_Classrepr_cache.
area;
1520 for (i = 0; cache_entry !=
NULL && i < heap_Classrepr_cache.
num_entries; i++)
1524 if (cache_entry[i].repr ==
NULL)
1532 if (cache_entry[i].repr[j] !=
NULL)
1540 if (heap_Classrepr_cache.
area !=
NULL)
1547 hash_entry = heap_Classrepr_cache.
hash_table;
1548 for (i = 0; hash_entry !=
NULL && i < heap_Classrepr_cache.
num_hash; i++)
1552 heap_Classrepr_cache.
num_hash = -1;
1571 heap_Classrepr =
NULL;
1589 if (cache_entry ==
NULL)
1610 t = cache_entry->
repr;
1616 cache_entry->
repr = t;
1685 if (class_oid !=
NULL)
1724 if (cache_entry ==
NULL)
1738 while (cur_entry !=
NULL)
1740 if (cur_entry == cache_entry)
1744 prev_entry = cur_entry;
1749 if (cur_entry ==
NULL)
1758 if (prev_entry ==
NULL)
1783 int save_fcnt = cache_entry->
fcnt;
1784 if (cache_entry->
fcnt == 0)
1899 if (*idx_incache < 0)
1905 cache_entry = &heap_Classrepr_cache.
area[*idx_incache];
1908 cache_entry->
fcnt--;
1909 if (cache_entry->
fcnt == 0)
1914 #ifdef DEBUG_CLASSREPR_CACHE 1916 heap_Classrepr_cache.num_fix_entries--;
1969 { NEED_TO_RETRY = 0, LOCK_ACQUIRED };
1984 if (thread_p ==
NULL)
1987 if (thread_p ==
NULL)
1992 cur_thrd_entry = thread_p;
1994 for (cur_lock_entry = hash_anchor->
lock_next; cur_lock_entry !=
NULL; cur_lock_entry = cur_lock_entry->
lock_next)
2007 return NEED_TO_RETRY;
2018 cur_lock_entry = &heap_Classrepr_cache.
lock_table[cur_thrd_entry->index];
2022 hash_anchor->
lock_next = cur_lock_entry;
2026 return LOCK_ACQUIRED;
2037 heap_classrepr_unlock_class (
HEAP_CLASSREPR_HASH * hash_anchor,
const OID * class_oid,
int need_hash_mutex)
2044 if (need_hash_mutex)
2049 prev_lock_entry =
NULL;
2050 cur_lock_entry = hash_anchor->
lock_next;
2051 while (cur_lock_entry !=
NULL)
2057 prev_lock_entry = cur_lock_entry;
2058 cur_lock_entry = cur_lock_entry->
lock_next;
2062 if (cur_lock_entry ==
NULL)
2068 if (prev_lock_entry ==
NULL)
2082 cur_thrd_entry->next_wait_thrd =
NULL;
2110 goto check_LRU_list;
2143 if (cache_entry->
fcnt == 0)
2154 if (cache_entry ==
NULL)
2161 if (cache_entry->
fcnt != 0)
2164 goto check_LRU_list;
2172 while (cur_entry !=
NULL)
2174 if (cur_entry == cache_entry)
2178 prev_entry = cur_entry;
2182 if (cur_entry ==
NULL)
2190 if (prev_entry ==
NULL)
2254 if (last_reprid !=
NULL)
2259 if (class_recdes !=
NULL)
2261 recdes = class_recdes;
2270 recdes = &peek_recdes;
2274 if (last_reprid !=
NULL)
2280 if (class_recdes ==
NULL)
2351 if (cache_entry ==
NULL)
2353 if (repr_from_record ==
NULL)
2363 if (page_of_class ==
NULL)
2375 if (repr_from_record ==
NULL)
2379 if (page_of_class !=
NULL)
2388 reprid = last_reprid;
2390 if (reprid != last_reprid && repr_last ==
NULL)
2393 if (repr_last ==
NULL)
2398 if (page_of_class ==
NULL)
2415 r = heap_classrepr_lock_class (thread_p, hash_anchor, class_oid);
2416 if (r != LOCK_ACQUIRED)
2418 if (r == NEED_TO_RETRY)
2432 if (cache_entry ==
NULL)
2438 (void) heap_classrepr_unlock_class (hash_anchor, class_oid,
true);
2441 if (repr_last !=
NULL)
2447 return repr_from_record;
2464 (void) heap_classrepr_unlock_class (hash_anchor, class_oid,
true);
2478 if (reprid <= NULL_REPRID || reprid > last_reprid || reprid > cache_entry->
max_reprid)
2485 (void) heap_classrepr_unlock_class (hash_anchor, class_oid,
true);
2498 cache_entry->
repr[reprid] = repr_from_record;
2499 repr = cache_entry->
repr[reprid];
2500 repr_from_record =
NULL;
2502 if (reprid != last_reprid)
2506 cache_entry->
repr[last_reprid] = repr_last;
2510 cache_entry->
fcnt = 1;
2512 #ifdef DEBUG_CLASSREPR_CACHE 2514 heap_Classrepr_cache.num_fix_entries++;
2518 *idx_incache = cache_entry->
idx;
2526 (void) heap_classrepr_unlock_class (hash_anchor, class_oid,
false);
2554 repr = cache_entry->
repr[reprid];
2558 if (repr_from_record ==
NULL)
2564 if (repr_from_record ==
NULL)
2574 cache_entry->
repr[reprid] = repr_from_record;
2575 repr = repr_from_record;
2576 repr_from_record =
NULL;
2582 cache_entry->
fcnt++;
2583 *idx_incache = cache_entry->
idx;
2588 if (repr_from_record !=
NULL)
2592 if (repr_last !=
NULL)
2599 #ifdef DEBUG_CLASSREPR_CACHE 2608 heap_classrepr_dump_cache (
bool simple_dump)
2616 if (heap_Classrepr ==
NULL)
2621 (void) fflush (stderr);
2622 (void) fflush (stdout);
2624 fprintf (stdout,
"*** Class Representation cache dump *** \n");
2625 fprintf (stdout,
" Number of entries = %d, Number of used entries = %d\n", heap_Classrepr->
num_entries,
2628 for (cache_entry = heap_Classrepr->
area, i = 0; i < heap_Classrepr->num_entries; cache_entry++, i++)
2630 fprintf (stdout,
" \nEntry_id %d\n", cache_entry->
idx);
2635 classrepr = cache_entry->
repr[j];
2636 if (classrepr ==
NULL)
2638 fprintf (stdout,
".....\n");
2641 fprintf (stdout,
" Fix count = %d, force_decache = %d\n", cache_entry->
fcnt, cache_entry->
force_decache);
2643 if (simple_dump ==
true)
2645 fprintf (stdout,
" Class_oid = %d|%d|%d, Reprid = %d\n", (
int) cache_entry->
class_oid.
volid,
2647 fprintf (stdout,
" Representation address = %p\n", classrepr);
2678 const char *attr_name;
2686 char *index_name =
NULL;
2687 char *
string =
NULL;
2688 int alloced_string = 0;
2714 " Class-OID = %d|%d|%d, Classname = %s, reprid = %d,\n" 2715 " Attrs: Tot = %d, Nfix = %d, Nvar = %d, Nshare = %d, Nclass = %d,\n Total_length_of_fixattrs = %d\n",
2723 fprintf (fp,
" Attribute Specifications:\n");
2726 for (i = 0, attrepr = repr->
attributes; i < repr->n_attributes; i++, attrepr++)
2738 if (attr_name ==
NULL)
2740 attr_name =
"?????";
2743 fprintf (fp,
"\n Attrid = %d, Attrname = %s, type = %s,\n location = %d, position = %d,\n", attrepr->
id,
2746 if (
string !=
NULL && alloced_string == 1)
2758 fprintf (fp,
" Inherited from Class: oid = %d|%d|%d, Name = %s\n", (
int) attrepr->
classoid.
volid,
2765 fprintf (fp,
" Number of Btids = %d,\n", attrepr->
n_btids);
2766 for (k = 0; k < attrepr->
n_btids; k++)
2779 fprintf (fp,
" BTID: VFID %d|%d, Root_PGID %d, %s\n", (
int) attrepr->
btids[k].
vfid.
volid,
2781 (index_name ==
NULL) ?
"unknown" : index_name);
2788 fprintf (fp,
" Default disk value format:\n");
2793 fprintf (fp,
"NULL");
2800 switch (_setjmp (buf.
env))
2819 fprintf (fp,
"PR_TYPE is NULL");
2826 fprintf (fp,
"Error transforming the default value\n");
2841 fprintf (fp,
"Dump has been aborted...");
2846 #ifdef DEBUG_CLASSREPR_CACHE 2864 heap_classrepr_dump_anyfixed (
void)
2868 if (heap_Classrepr->num_fix_entries > 0)
2871 ret = heap_classrepr_dump_cache (
true);
2903 if (min_freespace < (header_size + 20))
2905 min_freespace = header_size + 20;
2910 min_freespace = header_size + 20;
2917 return min_freespace;
2939 int freespace,
error;
2945 if (prev_freespace < freespace)
2966 else if (need_update ==
true)
2971 else if (need_update ==
true)
3009 if (hdr_pgptr ==
NULL)
3077 addr.
pgptr = hdr_pgptr;
3182 #if defined(ENABLE_UNUSED_FUNCTION) 3199 int total_nunits = 0;
3207 for (i = 0; i < num_entries; i++)
3209 if ((bestspace[i].freespace - unfill_space) >= unit_size)
3218 return total_nunits;
3241 int *idx_badspace,
int record_length,
int needed_space,
HEAP_SCANCACHE * scan_cache,
3244 #define BEST_PAGE_SEARCH_MAX_COUNT 100 3253 int i, best_array_index = -1;
3254 bool hash_is_available;
3255 bool best_hint_is_used;
3256 PERF_UTIME_TRACKER time_best_space = PERF_UTIME_TRACKER_INITIALIZER;
3257 PERF_UTIME_TRACKER time_find_page_best_space = PERF_UTIME_TRACKER_INITIALIZER;
3261 PERF_UTIME_TRACKER_START (thread_p, &time_find_page_best_space);
3274 best_array_index = 0;
3280 best_hint_is_used =
false;
3282 if (hash_is_available)
3284 PERF_UTIME_TRACKER_START (thread_p, &time_best_space);
3318 if (bestspace[best_array_index].freespace >= needed_space)
3320 best.
vpid = bestspace[best_array_index].
vpid;
3323 best_hint_is_used =
true;
3346 #if defined (SERVER_MODE) 3375 if (best_hint_is_used ==
true)
3379 bestspace[best_array_index].
freespace = 0;
3405 if (hash_is_available)
3411 if (best_hint_is_used ==
true)
3427 if (best_hint_is_used)
3443 if (bestspace[idx_worstspace].freespace > bestspace[i].freespace)
3460 *idx_badspace = idx_worstspace;
3496 int try_find, try_sync;
3497 int num_pages_found;
3498 float other_high_best_ratio;
3501 PERF_UTIME_TRACKER time_find_best_page = PERF_UTIME_TRACKER_INITIALIZER;
3503 PERF_UTIME_TRACKER_START (thread_p, &time_find_best_page);
3547 if (isnew_rec ==
true)
3589 other_high_best_ratio = 0;
3593 other_high_best_ratio =
3610 if (scan_cache !=
NULL)
3623 "hfid { vfid { fileid %d volid %d } hpgid %d } hdr_vpid { pageid %d volid %d } " 3625 hdr_vpidp->
volid, 0);
3628 if (num_pages_found < 0)
3635 while (num_pages_found == 0 && try_sync <= 2);
3638 if (num_pages_found <= 0)
3667 return pg_watcher->
pgptr;
3697 bool scan_all,
bool can_cycle)
3710 int npages = 0, nrecords = 0, rec_length;
3711 int num_iterations = 0, max_iterations;
3713 bool iterate_all =
false;
3714 bool search_all =
false;
3717 PERF_UTIME_TRACKER timer_sync_best_space = PERF_UTIME_TRACKER_INITIALIZER;
3719 PERF_UTIME_TRACKER_START (thread_p, &timer_sync_best_space);
3728 num_high_best = num_other_best = 0;
3730 if (scan_all !=
true)
3774 if (search_all ==
true)
3785 if (can_cycle ==
true)
3814 while (!
VPID_ISNULL (&next_vpid) || can_cycle ==
true)
3816 if (can_cycle ==
true &&
VPID_ISNULL (&next_vpid))
3828 && (can_cycle ==
true || !
VPID_EQ (&next_vpid, &stopat_vpid)))
3830 if (scan_all ==
false)
3832 if (++num_iterations > max_iterations)
3835 "next_vpid { pageid %d volid %d }\n", num_iterations, num_high_best,
3841 if (start_pos != -1 && num_high_best == 0)
3845 best_pages_hint_p[start_pos].
freespace = 0;
3882 num_pages += npages;
3883 num_recs += nrecords;
3884 recs_sumlen += rec_length;
3897 best_pages_hint_p[
best].
vpid = vpid;
3918 if (scan_all ==
false 3920 || (can_cycle ==
false &&
VPID_EQ (&next_vpid, &stopat_vpid))))
3928 heap_bestspace_log (
"heap_stats_sync_bestspace: scans from {%d|%d} to {%d|%d}, num_iterations(%d) " 3929 "max_iterations(%d) num_high_best(%d)\n", start_vpid.
volid, start_vpid.
pageid, vpid.
volid,
3930 vpid.
pageid, num_iterations, max_iterations, num_high_best);
4021 #if !defined (NDEBUG) 4051 VPID vpid_heap_header;
4070 if (hdr_stats ==
NULL)
4112 recdes.
data = (
char *) header_stats;
4113 recdes.
area_size =
sizeof (*header_stats);
4159 memcpy (chain, recdes.
data, sizeof (*chain));
4194 recdes.
data = (
char *) &chain;
4248 error_code =
heap_get_last_page (thread_p, hfid, heap_hdr, scan_cache, &last_vpid, &last_pg_watcher);
4269 new_page_chain.
flags = 0;
4283 if (last_pg_watcher.
pgptr == hdr_pgptr)
4302 chain_prev = *chain;
4345 addr.
pgptr = hdr_pgptr;
4347 &heap_hdr_prev, heap_hdr);
4512 memcpy (&chain, recdes.
data, sizeof (chain));
4524 recdes.
data = (
char *) &chain;
4571 memcpy (&chain, recdes.
data, sizeof (chain));
4583 recdes.
data = (
char *) &chain;
4656 bool is_system_op_started =
false;
4699 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid, page_vpid.
pageid);
4706 *page_ptr = crt_watcher.
pgptr;
4715 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid, page_vpid.
pageid);
4726 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid,
4739 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid,
4749 *page_ptr = crt_watcher.
pgptr;
4755 "Candidate heap page %d|%d to remove was changed and has new data.", page_vpid.
volid,
4767 "Candidate heap page %d|%d to remove has waiters.", page_vpid.
volid, page_vpid.
pageid);
4784 is_system_op_started =
true;
4788 copy_recdes.
area_size =
sizeof (heap_hdr);
4793 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid, page_vpid.
pageid);
4796 memcpy (&heap_hdr, copy_recdes.
data, sizeof (heap_hdr));
4816 if (
VPID_EQ (&prev_vpid, &header_vpid))
4827 update_recdes.
data = (
char *) &heap_hdr;
4828 update_recdes.
length =
sizeof (heap_hdr);
4833 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid, page_vpid.
pageid);
4837 sizeof (heap_hdr),
sizeof (heap_hdr), copy_recdes.
data, update_recdes.
data);
4852 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid,
4856 memcpy (&chain, copy_recdes.
data, copy_recdes.
length);
4858 update_recdes.
data = (
char *) &chain;
4859 update_recdes.
length =
sizeof (chain);
4864 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid,
4869 sizeof (chain),
sizeof (chain), copy_recdes.
data, update_recdes.
data);
4882 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid,
4886 memcpy (&chain, copy_recdes.
data, sizeof (chain));
4888 update_recdes.
data = (
char *) &chain;
4889 update_recdes.
length =
sizeof (chain);
4895 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid,
4900 sizeof (chain),
sizeof (chain), copy_recdes.
data, update_recdes.
data);
4911 "Could not remove candidate empty heap page %d|%d.", page_vpid.
volid, page_vpid.
pageid);
4920 is_system_op_started =
false;
4938 if (is_system_op_started)
4954 if (*page_ptr !=
NULL)
4956 if (*page_ptr != crt_watcher.
pgptr)
4960 *page_ptr = crt_watcher.
pgptr;
5074 #define HEAP_MAX_FIRSTSLOTID_LENGTH (sizeof (HEAP_HDR_STATS)) 5181 if (class_oid ==
NULL)
5185 memset (hfid, 0,
sizeof (
HFID));
5188 memset (&des, 0,
sizeof (des));
5290 memset (&heap_hdr, 0,
sizeof (heap_hdr));
5333 recdes.
data = (
char *) &heap_hdr;
5409 bool something_deleted =
false;
5431 something_deleted =
true;
5434 return something_deleted;
5463 recdes.
data = (
char *) &tmp_hdr_stats;
5471 recdes.
data = (
char *) &tmp_chain;
5541 if (hdr_pgptr ==
NULL)
5575 is_header_page = (hdr_pgptr == pgptr) ? 1 : 0;
5585 addr.
offset = is_header_page;
5599 addr.
offset = is_header_page;
5685 addr.
pgptr = hdr_pgptr;
5698 if (hdr_pgptr !=
NULL)
5706 #if defined(CUBRID_DEBUG) 5713 heap_hfid_isvalid (
HFID * hfid)
5741 if (scan_range !=
NULL)
5743 valid_pg = heap_hfid_isvalid (&scan_range->
scan_cache.hfid);
5920 if (expected_length <= 0)
5928 if (recdes.
length > (-expected_length))
5930 expected_length = recdes.
length;
5934 expected_length = -expected_length;
6024 forward_recdes.
data = (
char *) &forward_oid;
6060 forward_recdes.
data = (
char *) &forward_oid;
6133 int npages, nrecords, rec_length;
6156 hdr_recdes.
data = (
char *) &heap_hdr;
6157 hdr_recdes.
area_size =
sizeof (heap_hdr);
6166 memcpy (&initial_heap_hdr, hdr_recdes.
data, sizeof (initial_heap_hdr));
6204 curr_page_watcher.
pgptr =
6282 if (best < HEAP_NUM_BEST_SPACESTATS)
6319 &initial_heap_hdr, hdr_recdes.
data);
6390 if (docreate ==
true)
6400 memset (&des, 0,
sizeof (des));
6529 ovf_vfid_p = (ovf_vfid_p !=
NULL) ? ovf_vfid_p : &ovf_vfid;
6631 scan =
overflow_get (thread_p, &ovf_vpid, recdes, mvcc_snapshot);
6649 int *ovf_overhead,
int *ovf_free_space)
6656 return overflow_get_capacity (thread_p, &ovf_vpid, ovf_len, ovf_num_pages, ovf_overhead, ovf_free_space);
6675 if (*scan_cache !=
NULL)
6682 else if (!
HFID_EQ (&(*scan_cache)->node.hfid, hfid) ||
OID_ISNULL (&(*scan_cache)->node.class_oid))
6720 const OID * class_oid,
int cache_last_fix_page,
bool is_queryscan,
int is_indexscan,
6725 if (class_oid !=
NULL)
6732 if (is_queryscan ==
true)
6871 int classrepr_cacheindex = -1;
6880 if (class_oid !=
NULL)
6897 if (classrepr ==
NULL)
6908 for (i = 0; i < scan_cache->
num_btids; i++)
6963 const OID * class_oid)
6973 if (class_oid !=
NULL)
7142 while (curr_node !=
NULL)
7144 next_node = curr_node->
next;
7146 curr_node = next_node;
7287 if (ispeeking ==
PEEK)
7475 if (try_count++ < try_max)
7556 #if defined(SA_MODE) 7629 oid = context->
oid_p;
7779 VPID *vpidptr_incache;
7784 int get_rec_info = cache_recordinfo !=
NULL;
7785 bool is_null_recdata;
7791 #if defined(CUBRID_DEBUG) 7801 "heap_next: scan_cache without heap.. heap file must be given to heap_scancache_start () when" 7802 " scan_cache is used with heap_first, heap_next, heap_prev heap_last");
7819 if (reversed_direction)
7844 is_null_recdata = (recdes->
data ==
NULL);
7863 if (
VPID_EQ (&vpid, vpidptr_incache))
7876 curr_page_watcher.
pgptr =
7878 &curr_page_watcher);
7900 if (reversed_direction)
7924 if (reversed_direction)
7958 if (reversed_direction)
8003 heap_get_record_info (thread_p, oid, recdes, forward_recdes, &curr_page_watcher, scan_cache, ispeeking,
8038 if (is_null_recdata)
8049 if (is_null_recdata)
8104 return heap_next (thread_p, hfid, class_oid, oid, recdes, scan_cache, ispeeking);
8132 return heap_prev (thread_p, hfid, class_oid, oid, recdes, scan_cache, ispeeking);
8135 #if defined (ENABLE_UNUSED_FUNCTION) 8160 compare = memcmp (recdes->
data, peek_recdes.
data, peek_recdes.
length);
8168 compare = memcmp (recdes->
data, peek_recdes.
data, recdes->
length);
8169 if (compare == 0 && recdes->
length != peek_recdes.
length)
8277 if (start_oid !=
NULL)
8386 if (last_oid !=
NULL)
8541 #if defined (ENABLE_UNUSED_FUNCTION) 8573 scan = heap_get (thread_p, prev_oid, recdes, &scan_range->
scan_cache, ispeeking,
NULL_CHN);
8639 scan = heap_get (thread_p, first_oid, recdes, &scan_range->
scan_cache, ispeeking,
NULL_CHN);
8684 scan = heap_get (thread_p, last_oid, recdes, &scan_range->
scan_cache, ispeeking,
NULL_CHN);
8719 bool doesexist =
true;
8721 bool old_check_interrupt;
8783 if (class_oid ==
NULL)
8785 class_oid = &tmp_oid;
8851 bool doesexist =
false;
8857 bool is_scancache_started =
false;
8875 if (class_oid ==
NULL)
8877 class_oid = &local_class_oid;
8884 is_scancache_started =
true;
8887 if (mvcc_snapshot_ptr ==
NULL)
8893 mvcc_snapshot_ptr->
copy_to (copy_mvcc_snapshot);
8911 if (is_scancache_started)
9021 if (hdr_pgptr ==
NULL)
9062 int ignore_npages = -1;
9063 int ignore_avg_reclen = -1;
9066 if (
heap_estimate (thread_p, hfid, &ignore_npages, &nobjs, &ignore_avg_reclen) == -1)
9091 if (
heap_estimate (thread_p, hfid, &ignore_npages, &ignore_nobjs, &avg_reclen) == -1)
9117 INT64 * num_recs_inovf, INT64 *
num_pages,
int *avg_freespace,
int *avg_freespace_nolast,
9118 int *avg_reclength,
int *avg_overhead)
9132 INT64 sum_freespace = 0;
9133 INT64 sum_reclength = 0;
9134 INT64 sum_overhead = 0;
9146 *num_recs_relocated = 0;
9147 *num_recs_inovf = 0;
9174 sum_freespace += last_freespace;
9187 *num_recs_relocated += 1;
9205 *num_recs_inovf += 1;
9208 ovf_oid = (
OID *) recdes.
data;
9212 sum_reclength += ovf_len;
9213 *num_pages += ovf_num_pages;
9214 sum_freespace += ovf_free_space;
9215 sum_overhead += ovf_overhead;
9251 *avg_freespace_nolast = ((*num_pages > 1) ? (
int) ((sum_freespace - last_freespace) / (*num_pages - 1)) : 0);
9252 *avg_freespace = (int) (sum_freespace / *num_pages);
9253 *avg_overhead = (int) (sum_overhead / *num_pages);
9258 *avg_reclength = (int) (sum_reclength / *num_recs);
9352 char **classname_out)
9354 char *classname =
NULL;
9364 if (guess_classname ==
NULL || strcmp (guess_classname, classname) != 0)
9369 *classname_out =
strdup (classname);
9370 if (*classname_out ==
NULL)
9373 (
strlen (classname) + 1) *
sizeof (
char));
9382 *classname_out = guess_classname;
9388 *classname_out =
NULL;
9430 HEAP_ATTRVALUE *value;
9435 if (requested_num_attrs == 0)
9442 attr_info->num_values = -1;
9446 if (requested_num_attrs < 0)
9461 attr_info->last_cacheindex = -1;
9462 attr_info->read_cacheindex = -1;
9464 attr_info->last_classrepr =
NULL;
9465 attr_info->read_classrepr =
NULL;
9469 attr_info->values =
NULL;
9470 attr_info->num_values = -1;
9479 attr_info->last_classrepr =
9481 if (attr_info->last_classrepr ==
NULL)
9491 if (requested_num_attrs < 0)
9493 requested_num_attrs = attr_info->last_classrepr->n_attributes;
9495 else if (requested_num_attrs >
9496 (attr_info->last_classrepr->n_attributes + attr_info->last_classrepr->n_shared_attrs +
9497 attr_info->last_classrepr->n_class_attrs))
9499 fprintf (stdout,
" XXX There are not that many attributes. Num_attrs = %d, Num_requested_attrs = %d\n",
9500 attr_info->last_classrepr->n_attributes, requested_num_attrs);
9501 requested_num_attrs =
9502 attr_info->last_classrepr->n_attributes + attr_info->last_classrepr->n_shared_attrs +
9503 attr_info->last_classrepr->n_class_attrs;
9506 if (requested_num_attrs > 0)
9509 (HEAP_ATTRVALUE *)
db_private_alloc (thread_p, requested_num_attrs *
sizeof (*(attr_info->values)));
9510 if (attr_info->values ==
NULL)
9517 attr_info->values =
NULL;
9520 attr_info->num_values = requested_num_attrs;
9528 for (i = 0; i < attr_info->num_values; i++)
9530 value = &attr_info->values[
i];
9537 value->attrid = *attrids++;
9539 value->state = HEAP_UNINIT_ATTRVALUE;
9540 value->do_increment = 0;
9541 value->last_attrepr =
NULL;
9542 value->read_attrepr =
NULL;
9578 HEAP_ATTRVALUE *new_values;
9579 HEAP_ATTRVALUE *value;
9588 if (attr_info->num_values == -1)
9596 for (i = 0; i < attr_info->num_values; i++)
9598 value = &attr_info->values[
i];
9599 if (value !=
NULL && value->attrid == attrid)
9609 i = (attr_info->num_values + 1) *
sizeof (*(attr_info->values));
9612 if (new_values ==
NULL)
9617 attr_info->values = new_values;
9619 value = &attr_info->values[attr_info->num_values];
9620 value->attrid = attrid;
9621 value->state = HEAP_UNINIT_ATTRVALUE;
9622 value->last_attrepr =
NULL;
9623 value->read_attrepr =
NULL;
9624 attr_info->num_values++;
9633 ||
db_value_domain_init (&value->dbvalue, value->read_attrepr->type, value->read_attrepr->domain->precision,
9634 value->read_attrepr->domain->scale) !=
NO_ERROR)
9636 attr_info->num_values--;
9680 HEAP_ATTRVALUE *value;
9681 int num_found_attrs;
9683 int srch_num_shared;
9693 if (islast_reset ==
true)
9695 srch_num_attrs = attr_info->last_classrepr->n_attributes;
9699 srch_num_attrs = attr_info->read_classrepr->n_attributes;
9703 srch_num_shared = attr_info->last_classrepr->n_shared_attrs;
9704 srch_num_class = attr_info->last_classrepr->n_class_attrs;
9706 for (num_found_attrs = 0, curr_attr = 0; curr_attr < attr_info->num_values; curr_attr++)
9712 isattr_found =
false;
9713 if (islast_reset ==
true)
9715 search_attrepr = attr_info->last_classrepr->attributes;
9719 search_attrepr = attr_info->read_classrepr->attributes;
9722 value = &attr_info->values[curr_attr];
9724 if (value->attrid == -1)
9727 value->attrid = search_attrepr[curr_attr].
id;
9730 for (i = 0; isattr_found ==
false && i < srch_num_attrs; i++, search_attrepr++)
9735 if (value->attrid == search_attrepr->
id)
9741 isattr_found =
true;
9742 value->attr_type = HEAP_INSTANCE_ATTR;
9743 if (islast_reset ==
true)
9745 value->last_attrepr = search_attrepr;
9754 if (value->state == HEAP_UNINIT_ATTRVALUE)
9757 value->last_attrepr->domain->precision, value->last_attrepr->domain->scale);
9762 value->read_attrepr = search_attrepr;
9782 for (i = 0, search_attrepr = attr_info->last_classrepr->shared_attrs;
9783 isattr_found ==
false && i < srch_num_shared; i++, search_attrepr++)
9788 if (value->attrid == search_attrepr->
id)
9794 isattr_found =
true;
9795 value->attr_type = HEAP_SHARED_ATTR;
9796 value->last_attrepr = search_attrepr;
9805 if (value->state == HEAP_UNINIT_ATTRVALUE)
9808 value->last_attrepr->domain->precision, value->last_attrepr->domain->scale);
9820 for (i = 0, search_attrepr = attr_info->last_classrepr->class_attrs; isattr_found ==
false && i < srch_num_class;
9821 i++, search_attrepr++)
9827 if (value->attrid == search_attrepr->
id)
9833 isattr_found =
true;
9834 value->attr_type = HEAP_CLASS_ATTR;
9835 if (islast_reset ==
true)
9837 value->last_attrepr = search_attrepr;
9841 value->read_attrepr = search_attrepr;
9851 if (value->state == HEAP_UNINIT_ATTRVALUE)
9854 value->last_attrepr->domain->precision, value->last_attrepr->domain->scale);
9861 if (num_found_attrs != attr_info->num_values && islast_reset ==
true)
9889 HEAP_ATTRVALUE *value;
9898 if (attr_info->read_classrepr !=
NULL)
9900 if (attr_info->read_classrepr->id == reprid)
9908 if (attr_info->read_classrepr != attr_info->last_classrepr)
9912 attr_info->read_classrepr =
NULL;
9920 if (reprid == attr_info->last_classrepr->id)
9925 if (attr_info->values !=
NULL)
9927 for (i = 0; i < attr_info->num_values; i++)
9929 value = &attr_info->values[
i];
9930 value->read_attrepr = value->last_attrepr;
9933 attr_info->read_classrepr = attr_info->last_classrepr;
9934 attr_info->read_cacheindex = -1;
9941 if (attr_info->values !=
NULL)
9943 for (i = 0; i < attr_info->num_values; i++)
9945 value = &attr_info->values[
i];
9946 value->read_attrepr =
NULL;
9949 attr_info->read_classrepr =
9951 if (attr_info->read_classrepr ==
NULL)
9984 if (attr_info->num_values == -1)
9995 if (attr_info->last_classrepr !=
NULL)
10000 if (attr_info->values)
10009 attr_info->num_values = -1;
10024 HEAP_ATTRVALUE *value;
10030 if (attr_info->num_values == -1)
10035 if (attr_info->values !=
NULL)
10037 for (i = 0; i < attr_info->num_values; i++)
10039 value = &attr_info->values[
i];
10040 if (value->state != HEAP_UNINIT_ATTRVALUE)
10046 attrepr = ((value->read_attrepr !=
NULL) ? value->read_attrepr : value->last_attrepr);
10047 if (attrepr !=
NULL)
10053 value->state = HEAP_UNINIT_ATTRVALUE;
10080 char *disk_data =
NULL;
10081 int disk_bound =
false;
10082 volatile int disk_length = -1;
10087 disk_bound =
false;
10094 if (recdes ==
NULL || recdes->
data ==
NULL || value->read_attrepr ==
NULL || value->attr_type == HEAP_SHARED_ATTR
10095 || value->attr_type == HEAP_CLASS_ATTR)
10102 attrepr = value->last_attrepr;
10104 if (disk_length > 0)
10106 disk_data = (
char *) value->last_attrepr->default_value.value;
10112 attrepr = value->read_attrepr;
10114 if (value->read_attrepr->is_fixed != 0)
10120 attr_info->read_classrepr->fixed_length, value->read_attrepr->position))
10126 ((
char *) recdes->
data 10128 attr_info->read_classrepr->n_variable)
10129 + value->read_attrepr->location);
10156 attr_info->read_classrepr->n_variable);
10173 if (value->state != HEAP_UNINIT_ATTRVALUE)
10182 if (disk_data ==
NULL || disk_bound ==
false)
10188 goto exit_on_error;
10190 value->state = HEAP_READ_ATTRVALUE;
10200 switch (_setjmp (buf.
env))
10212 value->state = HEAP_READ_ATTRVALUE;
10220 value->state = HEAP_UNINIT_ATTRVALUE;
10244 char *disk_data =
NULL;
10254 if (
or_rep_id (recdes) != attr_info->last_classrepr->id)
10257 for (i = 0; i < attr_info->read_classrepr->n_attributes; i++)
10259 if (attr_info->read_classrepr->attributes[i].id == att->
id)
10261 att = &attr_info->read_classrepr->attributes[
i];
10268 if (found ==
false)
10283 attr_info->read_classrepr->fixed_length, att->
position))
10287 ((
char *) recdes->
data +
10289 attr_info->read_classrepr->n_variable) + att->
location);
10308 if (disk_data !=
NULL)
10312 or_init (&buf, disk_data, -1);
10342 HEAP_ATTRVALUE *value;
10346 if (attr_info->num_values == -1)
10359 if (attr_info->read_classrepr ==
NULL || attr_info->read_classrepr->id != reprid)
10365 goto exit_on_error;
10374 for (i = 0; i < attr_info->num_values; i++)
10376 value = &attr_info->values[
i];
10380 goto exit_on_error;
10389 attr_info->inst_chn =
or_chn (recdes);
10390 attr_info->inst_oid = *inst_oid;
10405 HEAP_ATTRVALUE *value;
10409 if (attr_info->num_values == -1)
10418 if (recdes !=
NULL)
10422 if (attr_info->read_classrepr ==
NULL || attr_info->read_classrepr->id != reprid)
10428 goto exit_on_error;
10437 for (i = 0; i < attr_info->num_values; i++)
10439 value = &attr_info->values[
i];
10443 goto exit_on_error;
10467 HEAP_ATTRVALUE *value;
10471 assert (attr_info->num_values > 0);
10477 if (recdes !=
NULL)
10481 if (attr_info->read_classrepr ==
NULL || attr_info->read_classrepr->id != reprid)
10487 goto exit_on_error;
10496 for (i = 0; i < attr_info->num_values; i++)
10498 value = &attr_info->values[
i];
10501 if (value->state == HEAP_UNINIT_ATTRVALUE && recdes !=
NULL)
10506 goto exit_on_error;
10519 value->state = HEAP_WRITTEN_ATTRVALUE;
10543 HEAP_ATTRVALUE *value;
10547 if (attr_info->num_values == -1)
10549 fprintf (fp,
" Empty attrinfo\n");
10557 if (dump_schema ==
true)
10559 ret =
heap_classrepr_dump (thread_p, fp, &attr_info->class_oid, attr_info->read_classrepr);
10562 for (i = 0; i < attr_info->num_values; i++)
10564 value = &attr_info->values[
i];
10565 fprintf (fp,
" Attrid = %d, state = %d, type = %s\n", value->attrid, value->state,
10571 fprintf (fp,
" Memory_value_format:\n");
10572 fprintf (fp,
" value = ");
10574 fprintf (fp,
"\n\n");
10592 HEAP_ATTRVALUE *value;
10595 for (i = 0, value = attr_info->values; i < attr_info->num_values; i++, value++)
10597 if (attrid == value->attrid)
10615 HEAP_ATTRVALUE *value;
10618 for (i = 0, value = attr_info->values; i < attr_info->num_values; i++, value++)
10620 if (attrid == value->attrid)
10623 return (value->read_attrepr !=
NULL) ? value->read_attrepr : value->last_attrepr;
10639 HEAP_ATTRVALUE *value;
10642 for (i = 0, value = attr_info->values; i < attr_info->num_values; i++, value++)
10644 if (attrid == value->attrid)
10646 return value->last_attrepr;
10667 HEAP_ATTRVALUE *value;
10670 if (attr_info->num_values == -1)
10676 if (value ==
NULL || value->state == HEAP_UNINIT_ATTRVALUE)
10683 return &value->dbvalue;
10786 HFID * class_hfid,
REPR_ID * repr_id,
int *has_partition_info)
10818 if (class_hfid !=
NULL)
10846 char *attr_name =
NULL;
10847 bool is_scan_cache_started =
false, is_attrinfo_started =
false;
10848 char *
string =
NULL;
10849 int alloced_string = 0;
10851 if (type_id ==
NULL || values_id ==
NULL)
10864 is_scan_cache_started =
true;
10871 is_attrinfo_started =
true;
10881 alloced_string = 0;
10891 attr_name = string;
10892 if (attr_name ==
NULL)
10897 if (strcmp (attr_name,
"ptype") == 0)
10902 if (strcmp (attr_name,
"pvalues") == 0)
10907 if (
string !=
NULL && alloced_string == 1)
10920 if (is_attrinfo_started)
10924 if (is_scan_cache_started)
10949 int part_idx = 0,
i;
10953 int has_partition_info = 0;
10972 &has_partition_info);
10978 if (has_partition_info == 0)
10984 COPY_OID (&(parts[part_idx].class_oid), &subclasses[i]);
10985 HFID_COPY (&(parts[part_idx].class_hfid), &part_hfid);
10986 parts[part_idx].
rep_id = repr_id;
10990 *parts_count = part_idx;
10996 for (i = 1; i < part_idx; i++)
10998 if (parts[i].values !=
NULL)
11018 int subclasses_count = 0;
11025 int has_partition_info = 0;
11041 if (has_partition_info == 0)
11054 else if (subclasses_count == 0)
11066 if (partitions ==
NULL)
11081 COPY_OID (&partitions[0].class_oid, class_oid);
11082 HFID_COPY (&partitions[0].class_hfid, &class_hfid);
11084 partitions[0].
rep_id = class_repr_id;
11089 if (partitions[0].values ==
NULL)
11098 *parts = partitions;
11101 if (subclasses !=
NULL)
11132 for (i = 0; i < parts_count; i++)
11134 if (parts[i].values !=
NULL)
11190 if (inst_oid !=
NULL)
11195 if (!
OID_EQ (&attr_info->inst_oid, inst_oid))
11201 attr_info->inst_oid.pageid, attr_info->inst_oid.slotid, inst_oid->
volid, inst_oid->
pageid,
11203 goto exit_on_error;
11206 attr_info->inst_oid = *inst_oid;
11216 goto exit_on_error;
11241 HEAP_ATTRVALUE *value;
11250 if (attr_info->num_values == -1)
11258 goto exit_on_error;
11264 goto exit_on_error;
11268 if (pr_type ==
NULL)
11270 goto exit_on_error;
11276 goto exit_on_error;
11280 db_value_domain_init (&value->dbvalue, value->last_attrepr->type, value->last_attrepr->domain->precision,
11281 value->last_attrepr->domain->scale);
11284 goto exit_on_error;
11317 goto exit_on_error;
11320 value->state = HEAP_WRITTEN_ATTRVALUE;
11353 HEAP_ATTRVALUE *value;
11359 goto exit_on_error;
11366 if (recdes !=
NULL)
11372 reprid = attr_info->last_classrepr->id;
11375 if (attr_info->read_classrepr ==
NULL || attr_info->read_classrepr->id != reprid)
11381 goto exit_on_error;
11389 for (i = 0; i < attr_info->num_values; i++)
11391 value = &attr_info->values[
i];
11392 if (value->state == HEAP_UNINIT_ATTRVALUE)
11397 goto exit_on_error;
11400 else if (value->state == HEAP_WRITTEN_ATTRVALUE
11411 goto exit_on_error;
11425 ret = (ret >= 0 ?
NO_ERROR : ret);
11428 goto exit_on_error;
11431 value->state = HEAP_WRITTEN_ATTRVALUE;
11437 if (recdes !=
NULL)
11439 attr_info->inst_chn =
or_chn (recdes);
11443 attr_info->inst_chn = -1;
11468 HEAP_ATTRVALUE *value;
11474 for (i = 0; i < attr_info->num_values; i++)
11476 value = &attr_info->values[
i];
11478 if (value->last_attrepr->is_fixed != 0)
11498 size +=
OR_BOUND_BIT_BYTES (attr_info->last_classrepr->n_attributes - attr_info->last_classrepr->n_variable);
11572 char *ptr_bound, *ptr_varvals;
11573 HEAP_ATTRVALUE *value;
11576 unsigned int repid_bits;
11580 size_t expected_size;
11582 volatile int offset_size;
11583 volatile int mvcc_wasted_space = 0;
11585 bool is_mvcc_class;
11587 std::set<int> incremented_attrids;
11593 if (attr_info->num_values == -1)
11615 if (old_recdes !=
NULL)
11624 expected_size += mvcc_wasted_space;
11632 switch (_setjmp (buf->
env))
11642 repid_bits = attr_info->last_classrepr->id;
11646 if ((attr_info->last_classrepr->n_attributes - attr_info->last_classrepr->n_variable) != 0)
11659 attr_info->inst_chn++;
11662 if (old_recdes ==
NULL)
11696 attr_info->last_classrepr->fixed_length);
11702 ptr_varvals = (ptr_bound
11704 - attr_info->last_classrepr->n_variable));
11709 if (ptr_varvals + mvcc_wasted_space > buf->
endptr)
11713 goto resize_and_start;
11716 for (i = 0; i < attr_info->num_values; i++)
11718 value = &attr_info->values[
i];
11719 dbvalue = &value->dbvalue;
11720 pr_type = value->last_attrepr->domain->type;
11721 if (pr_type ==
NULL)
11729 if (value->last_attrepr->is_fixed != 0)
11739 + value->last_attrepr->location);
11741 if (value->do_increment && (incremented_attrids.find (i) == incremented_attrids.end ()))
11748 incremented_attrids.insert (i);
11760 value->last_attrepr->
domain->precision, value->last_attrepr->domain->scale);
11761 dbvalue = &temp_dbvalue;
11794 if (value->do_increment != 0)
11810 buf->
ptr = ptr_varvals;
11815 DB_ELO dest_elo, *elo_p;
11816 char *save_meta_data, *new_meta_data;
11829 || new_meta_data ==
NULL)
11844 value->state = HEAP_WRITTEN_LOB_ATTRVALUE;
11861 ptr_varvals = buf->
ptr;
11866 if (attr_info->last_classrepr->n_variable > 0)
11884 if (ptr_varvals + mvcc_wasted_space <= buf->endptr)
11896 goto resize_and_start;
11926 int num_found_attrs;
11928 int classrepr_cacheindex = -1;
11933 attr_info->num_values = -1;
11941 if (classrepr ==
NULL)
11954 if (set_attrids ==
NULL)
11964 set_attrids = guess_attrids;
11967 for (i = 0, num_found_attrs = 0; i < classrepr->
n_attributes; i++)
11972 set_attrids[num_found_attrs++] = search_attrepr->
id;
11976 ret =
heap_attrinfo_start (thread_p, class_oid, num_found_attrs, set_attrids, attr_info);
11978 if (set_attrids != guess_attrids)
12002 int num_found_attrs;
12004 int classrepr_cacheindex = -1;
12007 HEAP_ATTRVALUE *value;
12017 set_attrids = guess_attrids;
12018 attr_info->num_values = -1;
12021 if (classrepr ==
NULL)
12029 if (set_attrids ==
NULL)
12039 set_attrids = guess_attrids;
12047 for (j = 0; j < *num_btids; j++)
12049 indexp = &classrepr->
indexes[j];
12050 if (indexp->
n_atts == 1)
12054 else if (indexp->
n_atts > 1)
12069 for (i = 0, num_found_attrs = 0, search_attrepr = classrepr->
attributes; i < classrepr->n_attributes;
12070 i++, search_attrepr++)
12072 if (search_attrepr->
n_btids <= 0)
12079 for (j = 0; j < *num_btids; j++)
12081 indexp = &classrepr->
indexes[j];
12082 if (indexp->
n_atts == 1 && indexp->
atts[0]->
id == search_attrepr->
id)
12084 set_attrids[num_found_attrs++] = search_attrepr->
id;
12098 attr_info->num_values = -1;
12107 attr_info->last_cacheindex = classrepr_cacheindex;
12108 attr_info->read_cacheindex = -1;
12109 attr_info->last_classrepr = classrepr;
12110 attr_info->read_classrepr =
NULL;
12113 attr_info->num_values = num_found_attrs;
12115 if (num_found_attrs <= 0)
12117 attr_info->values =
NULL;
12121 attr_info->values =
12122 (HEAP_ATTRVALUE *)
db_private_alloc (thread_p, (num_found_attrs *
sizeof (HEAP_ATTRVALUE)));
12123 if (attr_info->values ==
NULL)
12127 attr_info->num_values = -1;
12137 for (i = 0; i < attr_info->num_values; i++)
12139 value = &attr_info->values[
i];
12140 value->attrid = set_attrids[
i];
12141 value->state = HEAP_UNINIT_ATTRVALUE;
12142 value->last_attrepr =
NULL;
12143 value->read_attrepr =
NULL;
12158 if (set_attrids != guess_attrids)
12169 return num_found_attrs;
12175 if (set_attrids != guess_attrids)
12198 for (i = 0; i < classrepr->
n_indexes; i++)
12244 int classrepr_cacheindex = -1;
12245 int num_found_attrs = 0;
12251 set_attrids = guess_attrids;
12253 attr_info->num_values = -1;
12259 if (classrepr ==
NULL)
12268 if (index_id == -1)
12283 set_attrids = (
ATTR_ID *) malloc (num_found_attrs *
sizeof (
ATTR_ID));
12284 if (set_attrids ==
NULL)
12291 for (i = 0; i < num_found_attrs; i++)
12301 if (num_found_attrs > 0)
12312 if (set_attrids != guess_attrids)
12327 if (set_attrids != guess_attrids)
12335 #if defined (ENABLE_UNUSED_FUNCTION) 12346 heap_attrvalue_get_index (
int value_index,
ATTR_ID * attrid,
int *n_btids,
BTID ** btids,
12349 HEAP_ATTRVALUE *value;
12352 if (idx_attrinfo->num_values == -1)
12357 if (value_index > idx_attrinfo->num_values || value_index < 0)
12366 value = &idx_attrinfo->values[value_index];
12367 *n_btids = value->last_attrepr->n_btids;
12368 *btids = value->last_attrepr->btids;
12369 *attrid = value->attrid;
12370 return &value->dbvalue;
12392 int num_atts,
i, k;
12401 num_atts = index->
n_atts;
12402 atts = index->
atts;
12411 nullmap_ptr = midxkey->
buf;
12414 for (i = 0; i < num_atts && k < num_atts; i++)
12426 if (key_domain !=
NULL)
12432 if (set_domain ==
NULL)
12437 next_domain = set_domain;
12447 next_domain = next_domain->
next;
12468 if (key_domain !=
NULL)
12474 if (set_domain ==
NULL)
12483 next_domain = set_domain;
12497 next_domain = next_domain->
next;
12507 if (key_domain !=
NULL)
12530 for (td = set_domain, next =
NULL; td !=
NULL; td = next)
12555 int func_attr_index_start,
TP_DOMAIN * midxkey_domain)
12558 int num_vals,
i, reprid, k;
12568 if (recdes !=
NULL)
12572 if (attrinfo->read_classrepr ==
NULL || attrinfo->read_classrepr->id != reprid)
12586 nullmap_ptr = midxkey->
buf;
12589 num_vals = attrinfo->num_values;
12592 num_vals = func_attr_index_start + 1;
12596 for (i = 0; i < num_vals && k < num_vals; i++)
12598 if (i == func_col_id)
12635 midxkey->
domain = midxkey_domain;
12678 int fi_attr_index_start = -1;
12679 int fi_col_id = -1;
12683 if (func_index_info)
12686 fi_col_id = func_index_info->
col_id;
12692 fi_res = db_valuep;
12699 if ((n_atts > 1 && func_index_info ==
NULL) || (func_index_info && (func_index_info->
attr_index_start + 1) > 1))
12702 int midxkey_size = recdes->
length;
12704 if (func_index_info !=
NULL)
12726 fi_attr_index_start, midxkey_domain) ==
NULL)
12740 ret_valp = db_valuep;
12748 if (func_index_info)
12750 ret_valp = db_valuep;
12755 if (ret_valp !=
NULL && atts_prefix_length && n_atts == 1)
12762 ret_valp = db_valuep;
12807 int n_atts, reprid;
12818 if ((idx_attrinfo->num_values == -1) || (btid_index >= idx_attrinfo->last_classrepr->n_indexes))
12826 if (recdes !=
NULL)
12830 if (idx_attrinfo->read_classrepr ==
NULL || idx_attrinfo->read_classrepr->id != reprid)
12840 index = &(idx_attrinfo->last_classrepr->indexes[btid_index]);
12842 *btid = index->
btid;
12848 func_indx_pred, &fi_domain) !=
NO_ERROR)
12864 int midxkey_size = recdes->
length;
12903 ret_val = db_value;
12916 if (key_domain !=
NULL)
12931 ret_val = db_value;
12935 if (key_domain !=
NULL)
12953 if (prefix_dom ==
NULL)
12956 if (prefix_dom !=
NULL)
12965 if (prefix_dom ==
NULL)
12993 if (btid_index != -1 && btid_index < attrinfo->last_classrepr->n_indexes)
12995 return &(attrinfo->last_classrepr->indexes[btid_index].btid);
13012 if (btid_index != -1 && btid_index < attrinfo->last_classrepr->n_indexes)
13014 return attrinfo->last_classrepr->indexes[btid_index].n_atts;
13035 if (btid_index != -1 && (btid_index < attrinfo->last_classrepr->n_indexes))
13037 for (i = 0; i < attrinfo->last_classrepr->indexes[btid_index].n_atts; i++)
13039 attrids[
i] = attrinfo->last_classrepr->indexes[btid_index].atts[
i]->id;
13055 int len_attrs_prefix_length)
13057 int i, length = -1;
13060 if (attrs_prefix_length && len_attrs_prefix_length > 0)
13062 for (i = 0; i < len_attrs_prefix_length; i++)
13064 attrs_prefix_length[
i] = -1;
13068 if (btid_index != -1 && (btid_index < attrinfo->last_classrepr->n_indexes))
13070 if (attrinfo->last_classrepr->indexes[btid_index].attrs_prefix_length && attrs_prefix_length)
13072 length = MIN (attrinfo->last_classrepr->indexes[btid_index].n_atts, len_attrs_prefix_length);
13073 for (i = 0; i < length; i++)
13075 attrs_prefix_length[
i] = attrinfo->last_classrepr->indexes[btid_index].attrs_prefix_length[
i];
13095 int idx_in_cache,
i;
13102 if (classrep ==
NULL)
13107 for (i = 0; i < classrep->
n_indexes; i++)
13109 if (strcasecmp (classrep->
indexes[i].
btname, index_name) == 0)
13115 if (classrep !=
NULL)
13135 int *num_attrs,
ATTR_ID ** attr_ids,
int **attrs_prefix_length,
char **btnamepp,
13136 int *func_index_col_id)
13140 int idx_in_cache,
i, n = 0;
13160 if (attrs_prefix_length)
13162 *attrs_prefix_length =
NULL;
13165 if (func_index_col_id)
13167 *func_index_col_id = -1;
13172 if (classrepp ==
NULL)
13174 goto exit_on_error;
13181 goto exit_on_error;
13183 indexp = &classrepp->
indexes[idx];
13188 *type = indexp->
type;
13194 *num_attrs = n = indexp->
n_atts;
13201 if (*attr_ids ==
NULL)
13203 goto exit_on_error;
13207 for (i = 0; i < n; i++)
13209 (*attr_ids)[
i] = indexp->
atts[
i]->
id;
13220 *attrs_prefix_length = (
int *)
db_private_alloc (thread_p, n *
sizeof (
int));
13222 if (*attrs_prefix_length ==
NULL)
13224 goto exit_on_error;
13227 for (i = 0; i < n; i++)
13235 (*attrs_prefix_length)[
i] = -1;
13252 if (attr_ids && *attr_ids)
13257 if (btnamepp && *btnamepp)
13262 if (attrs_prefix_length)
13264 if (*attrs_prefix_length)
13268 *attrs_prefix_length =
NULL;
13304 int *max_oid_cnt,
OID ** oid_list)
13308 HEAP_ATTRVALUE *value;
13332 if (*oid_list ==
NULL)
13336 else if (*max_oid_cnt <= 0)
13350 oid_ptr = *oid_list;
13352 for (i = 0; i < attr_info.num_values; i++)
13354 value = &attr_info.values[
i];
13362 if (oid_cnt == *max_oid_cnt)
13368 if (*max_oid_cnt <= 0)
13371 new_max_oid = attr_info.num_values;
13375 new_max_oid = (int) (*max_oid_cnt * 1.5) + 1;
13376 if (new_max_oid < attr_info.num_values)
13378 new_max_oid = attr_info.num_values;
13382 if (new_max_oid < 10)
13387 oid_ptr = (
OID *) realloc (*oid_list, new_max_oid *
sizeof (
OID));
13388 if (oid_ptr ==
NULL)
13397 *oid_list = oid_ptr;
13398 oid_ptr += *max_oid_cnt;
13399 *max_oid_cnt = new_max_oid;
13401 *oid_ptr = *attr_oid;
13417 for (j = 0; j < cnt; j++)
13428 if (oid_cnt == *max_oid_cnt)
13434 if (*max_oid_cnt <= 0)
13437 new_max_oid = attr_info.num_values;
13441 new_max_oid = (int) (*max_oid_cnt * 1.5) + 1;
13442 if (new_max_oid < attr_info.num_values)
13444 new_max_oid = attr_info.num_values;
13447 if (new_max_oid < 10)
13452 oid_ptr = (
OID *) realloc (*oid_list, new_max_oid *
sizeof (
OID));
13453 if (oid_ptr ==
NULL)
13456 new_max_oid *
sizeof (
OID));
13463 *oid_list = oid_ptr;
13464 oid_ptr += *max_oid_cnt;
13465 *max_oid_cnt = new_max_oid;
13467 *oid_ptr = *attr_oid;
13482 if (*oid_list !=
NULL)
13517 INT16 right_slotid, left_slotid;
13549 right_slotid = oid->
slotid;
13550 left_slotid = oid->
slotid;
13567 COPY_OID (&((*prefetch->
obj)->class_oid), class_oid);
13569 (*prefetch->
obj)->oid.pageid = oid->
pageid;
13570 (*prefetch->
obj)->oid.
slotid = right_slotid;
13572 (*prefetch->
obj)->offset = *prefetch->
offset;
13576 *prefetch->
offset += round_length;
13595 COPY_OID (&((*prefetch->
obj)->class_oid), class_oid);
13597 (*prefetch->
obj)->oid.pageid = oid->
pageid;
13598 (*prefetch->
obj)->oid.
slotid = left_slotid;
13600 (*prefetch->
obj)->offset = *prefetch->
offset;
13604 *prefetch->
offset += round_length;
13623 INT32 * num_checked)
13626 VPID *vpidptr_ofpgptr;
13629 bool spg_error =
false;
13678 if (
VPID_EQ (&vpid, vpidptr_ofpgptr))
13686 if (chk_objs !=
NULL)
13700 *num_checked = npages;
13701 return (spg_error ==
true) ?
DISK_ERROR : valid_pg;
13704 #if defined (SA_MODE) 13787 #if defined (SA_MODE) 13804 #if defined (SA_MODE) 13810 if (file_numpages != -1 && file_numpages != npages)
13815 if (chk_objs !=
NULL)
13817 chk_objs->
verify =
false;
13827 tmp_valid_pg = heap_check_all_pages_by_file_table (thread_p, hfid, chk_objs);
13829 if (chk_objs !=
NULL)
13837 chk_objs->
verify =
false;
13842 if (npages != file_numpages)
13845 hfid->
hpgid, npages, file_numpages);
13850 valid_pg = tmp_valid_pg;
13856 if (chk_objs !=
NULL)
13902 #if defined(SA_MODE) 13946 #if !defined (NDEBUG) 13964 #if !defined (NDEBUG) 14012 goto exit_on_error;
14024 goto exit_on_error;
14063 fprintf (fp,
"unfill_space = %4d\n", heap_hdr->
unfill_space);
14064 fprintf (fp,
"Estimated: num_pages = %d, num_recs = %d, avg reclength = %d\n", heap_hdr->
estimates.
num_pages,
14066 fprintf (fp,
"Estimated: num high best = %d, num others(not in array) high best = %d\n",
14068 fprintf (fp,
"Hint of best set of vpids with head = %d\n", heap_hdr->
estimates.
head);
14072 if (j != 0 && j % 5 == 0)
14074 fprintf (fp,
"\n");
14079 fprintf (fp,
"\n");
14081 fprintf (fp,
"Second best: num hints = %d, head of hints = %d, tail (next to insert) of hints = %d, num subs = %d\n",
14086 if (j != 0 && j % 5 == 0)
14088 fprintf (fp,
"\n");
14092 fprintf (fp,
"\n");
14131 fprintf (fp,
"\n\n*** DUMPING HEAP FILE: ");
14132 fprintf (fp,
"volid = %d, Fileid = %d, Header-pageid = %d ***\n", hfid->
vfid.
volid, hfid->
vfid.
fileid, hfid->
hpgid);
14203 fprintf (fp,
"\nOVERFLOW FILE INFORMATION FOR HEAP FILE\n\n");
14236 if (dump_records ==
true)
14250 fprintf (fp,
"Object-OID = %2d|%4d|%2d,\n Length on disk = %d,\n", oid.
volid, oid.
pageid, oid.
slotid,
14255 fprintf (fp,
" Error ... continue\n");
14269 fprintf (fp,
"\n\n*** END OF DUMP FOR HEAP FILE ***\n\n");
14284 INT64 num_recs_relocated = 0;
14285 INT64 num_recs_inovf = 0;
14287 int avg_freespace = 0;
14288 int avg_freespace_nolast = 0;
14289 int avg_reclength = 0;
14290 int avg_overhead = 0;
14301 heap_get_capacity (thread_p, hfid, &num_recs, &num_recs_relocated, &num_recs_inovf, &num_pages, &avg_freespace,
14302 &avg_freespace_nolast, &avg_reclength, &avg_overhead);
14308 fprintf (fp,
"HFID:%d|%d|%d, Num_recs = %" PRId64
", Num_reloc_recs = %" PRId64
",\n Num_recs_inovf = %" PRId64
14309 ", Avg_reclength = %d,\n Num_pages = %" PRId64
", Avg_free_space_per_page = %d,\n" 14310 " Avg_free_space_per_page_without_lastpage = %d\n Avg_overhead_per_page = %d\n",
14312 avg_reclength, num_pages, avg_freespace, avg_freespace_nolast, avg_overhead);
14338 fprintf (fp,
"\n");
14425 if (chk->
verify ==
true)
14430 if (forward !=
NULL)
14453 #if defined (SA_MODE) 14471 #if defined (SA_MODE) 14479 return valid_reloc;
14498 if (chk->
verify ==
true)
14501 "Unable to find relocated record with oid=%d|%d|%d for home object with oid=%d|%d|%d\n",
14504 #if defined (SA_MODE) 14540 #define HEAP_CHKRELOC_UNFOUND_SHORT 5 14554 if (chk->
verify !=
true)
14588 peek_oid = (
OID *) recdes.
data;
14612 if (found ==
false)
14618 if (forward ==
NULL)
14645 VPID overflow_vpid;
14649 overflow_oid = (
OID *) recdes.
data;
14661 if (overflow_page ==
NULL)
14738 if (forward !=
NULL)
14826 if (heap_Guesschn !=
NULL)
14831 goto exit_on_error;
14854 heap_Guesschn_area.
ht =
14856 if (heap_Guesschn_area.
ht ==
NULL)
14858 goto exit_on_error;
14868 goto exit_on_error;
14879 goto exit_on_error;
14885 for (i = 0; i < heap_Guesschn_area.
num_entries; i++)
14887 entry = &heap_Guesschn_area.
entries[
i];
14915 unsigned char *save_bitindex;
14920 if (heap_Guesschn ==
NULL)
14928 save_bitindex = heap_Guesschn_area.
bitindex;
14929 save_nbytes = heap_Guesschn_area.
nbytes;
14955 heap_Guesschn_area.
bitindex = save_bitindex;
14956 heap_Guesschn_area.
nbytes = save_nbytes;
14958 goto exit_on_error;
14965 for (i = 0; i < heap_Guesschn_area.
num_entries; i++)
14967 entry = &heap_Guesschn_area.
entries[
i];
14972 memcpy (entry->
bits, &save_bitindex[i * save_nbytes], save_nbytes);
14998 if (heap_Guesschn ==
NULL)
15006 heap_Guesschn->
ht =
NULL;
15011 heap_Guesschn->
nbytes = 0;
15013 heap_Guesschn =
NULL;
15027 if (heap_Bestspace !=
NULL)
15032 goto exit_on_error;
15046 goto exit_on_error;
15053 goto exit_on_error;
15080 if (heap_Bestspace ==
NULL)
15117 heap_Bestspace =
NULL;
15139 if (heap_Guesschn ==
NULL)
15191 #if defined (CUBRID_DEBUG) 15199 heap_chnguess_dump (FILE * fp)
15201 int max_tranindex, tran_index,
i;
15204 if (heap_Guesschn !=
NULL)
15206 fprintf (fp,
"*** Dump of CLASS_OID to CHNGUESS at clients *** \n");
15207 fprintf (fp,
"Schema_change = %d, clock_hand = %d,\n", heap_Guesschn->
schema_change, heap_Guesschn->
clock_hand);
15208 fprintf (fp,
"Nentries = %d, Nactive_entries = %u, maxnum of clients = %d, nbytes = %d\n",
15211 fprintf (fp,
"Hash Table = %p, Entries = %p, Bitindex = %p\n", heap_Guesschn->
ht, heap_Guesschn->
entries,
15217 entry = &heap_Guesschn_area.
entries[
i];
15221 fprintf (fp,
" \nEntry_id %d", entry->
idx);
15222 fprintf (fp,
"OID = %2d|%4d|%2d, chn = %d, recently_free = %d,", entry->
oid.
volid, entry->
oid.
pageid,
15226 for (tran_index = 0; tran_index < max_tranindex; tran_index++)
15228 if (tran_index % 40 == 0)
15230 fprintf (fp,
"\n ");
15232 else if (tran_index % 10 == 0)
15238 fprintf (fp,
"\n");
15265 if (heap_Guesschn !=
NULL)
15312 if (heap_Guesschn ==
NULL)
15340 if (entry->
chn != chn)
15352 can_continue =
true;
15353 while (entry ==
NULL && can_continue ==
true)
15355 can_continue =
false;
15376 can_continue =
true;
15426 if (heap_Guesschn !=
NULL)
15430 entry = &heap_Guesschn_area.
entries[
i];
15555 fprintf (fp,
"CLASS_OID = %2d|%4d|%2d, PREV_VPID = %2d|%4d, NEXT_VPID = %2d|%4d, MAX_MVCCID=%llu, flags=%d.\n",
15576 recdes.
type = *(INT16 *) (rcv->
data);
15577 recdes.
data = (
char *) (rcv->
data) +
sizeof (recdes.
type);
15621 #define HEAP_LOG_MVCC_INSERT_MAX_REDO_CRUMBS 4 15623 int n_redo_crumbs = 0, data_copy_offset = 0, chn_offset;
15643 redo_crumbs[n_redo_crumbs].
length =
sizeof (p_recdes->
type);
15644 redo_crumbs[n_redo_crumbs++].
data = &p_recdes->
type;
15653 redo_crumbs[n_redo_crumbs++].
data = p_recdes->
data;
15657 redo_crumbs[n_redo_crumbs++].
data = p_recdes->
data + chn_offset;
15664 redo_crumbs[n_redo_crumbs].
length = p_recdes->
length - data_copy_offset;
15665 redo_crumbs[n_redo_crumbs++].
data = p_recdes->
data + data_copy_offset;
15672 if (thread_p->no_logging)
15694 int chn, sp_success;
15697 bool vacuum_status_change =
false;
15705 vacuum_status_change =
true;
15707 slotid = slotid & (~HEAP_RV_FLAG_VACUUM_STATUS_CHANGE);
15710 record_type = *(INT16 *) rcv->
data;
15715 rcv->
data + sizeof (record_type));
15720 int repid_and_flags, offset, mvcc_flag, offset_size;
15722 offset =
sizeof (record_type);
15833 int redo_data_size = 0;
15862 assert ((ptr - redo_data_buffer) <= (
int)
sizeof (redo_data_buffer));
15865 if (thread_p->no_logging)
16034 bool vacuum_status_change =
false;
16042 vacuum_status_change =
true;
16044 slotid = slotid & (~HEAP_RV_FLAG_VACUUM_STATUS_CHANGE);
16177 recdes_type = *(INT16 *) (rcv->
data);
16212 recdes_type = *(INT16 *) (rcv->
data);
16257 recdes.
type = *(INT16 *) (rcv->
data);
16258 recdes.
data = (
char *) (rcv->
data) +
sizeof (recdes.
type);
16289 const bool is_header_page = ((rcv->
offset != 0) ?
true :
false);
16301 if (!is_header_page)
16340 const bool is_header_page = ((rcv->
offset != 0) ?
true :
false);
16347 if (!is_header_page)
16384 fprintf (fp,
"Delete all objects in page for reuse purposes of page\n");
16406 num =
heap_estimate (thread_p, hfid, npages, nobjs, &length);
16439 if (has_visible_instance)
16442 if (mvcc_snapshot ==
NULL)
16453 r =
heap_first (thread_p, hfid, class_oid, &oid, &recdes, &scan_cache,
true);
16480 int idx_incache = -1;
16482 if (!class_oid || !idx_incache)
16510 int i, idx_in_cache;
16511 char *classname =
NULL;
16512 char *attr_name =
NULL;
16515 HEAP_ATTRVALUE *value;
16516 DB_VALUE dbvalue_numeric, *dbvalue, key_val;
16518 OID serial_class_oid;
16524 bool use_local_scan_cache =
false;
16526 int alloced_string = 0;
16527 char *
string =
NULL;
16529 if (!attr_info || !scan_cache)
16539 for (i = 0; i < attr_info->num_values; i++)
16541 value = &attr_info->values[
i];
16542 dbvalue = &value->dbvalue;
16543 att = &attr_info->last_classrepr->attributes[
i];
16550 memset (serial_name,
'\0',
sizeof (serial_name));
16556 scan_cache = &local_scan_cache;
16558 use_local_scan_cache =
true;
16564 goto exit_on_error;
16570 goto exit_on_error;
16574 alloced_string = 0;
16580 goto exit_on_error;
16583 attr_name = string;
16584 if (attr_name ==
NULL)
16587 goto exit_on_error;
16592 if (
string !=
NULL && alloced_string == 1)
16603 goto exit_on_error;
16610 goto exit_on_error;
16614 if (classrep ==
NULL)
16617 goto exit_on_error;
16633 goto exit_on_error;
16645 goto exit_on_error;
16657 goto exit_on_error;
16663 goto exit_on_error;
16674 goto exit_on_error;
16679 value->state = HEAP_READ_ATTRVALUE;
16683 if (use_local_scan_cache)
16691 if (classname !=
NULL)
16696 if (use_local_scan_cache)
16714 if (attr_info ==
NULL)
16734 FILE_TYPE * ftype_out,
char **classname_out)
16738 error_code =
heap_hfid_cache_get (thread_p, class_oid, hfid_out, ftype_out, classname_out);
16764 if (class_oid ==
NULL)
16795 goto exit_on_error;
16806 goto exit_on_error;
16822 goto exit_on_error;
16829 goto exit_on_error;
16836 goto exit_on_error;
16881 bool need_free_classname =
false;
16885 classname = (
char *)
"unknown";
16890 need_free_classname =
true;
16898 fprintf (fp,
"*** Dumping representations of class %s\n Classname = %s, Class-OID = %d|%d|%d, #Repr = %d\n",
16899 classname, classname, (
int) class_oid->
volid, class_oid->
pageid, (
int) class_oid->
slotid, count);
16901 for (i = 0; i <
count; i++)
16908 fprintf (fp,
"\n*** End of dump.\n");
16914 if (need_free_classname)
16939 BTID * p_found_btid)
16942 int classrepr_cacheindex = -1;
16958 if (classrepr ==
NULL)
16970 for (idx_cnt = 0, curr_index = classrepr->
indexes; idx_cnt < classrepr->n_indexes; idx_cnt++, curr_index++)
16972 if (curr_index ==
NULL)
17015 HEAP_ATTRVALUE *value =
NULL;
17016 int force_count = 0, updated_n_attrs_id = 0;
17023 if (upd_scancache ==
NULL || attr_info ==
NULL || oid ==
NULL)
17030 for (i = 0, value = attr_info->values; i < attr_info->num_values; i++, value++)
17032 TP_DOMAIN *dest_dom = value->last_attrepr->domain;
17033 bool log_warning =
false;
17042 if (att_id != value->attrid)
17079 if (dest_prec < curr_prec)
17091 log_warning =
true;
17134 bool set_default_value =
false;
17135 bool set_min_value =
false;
17136 bool set_max_value =
false;
17149 int is_positive = -1;
17155 is_positive = ((
db_get_int (&value->dbvalue) >= 0) ? 1 : 0);
17158 is_positive = ((
db_get_short (&value->dbvalue) >= 0) ? 1 : 0);
17161 is_positive = ((
db_get_bigint (&value->dbvalue) >= 0) ? 1 : 0);
17164 is_positive = ((
db_get_float (&value->dbvalue) >= 0) ? 1 : 0);
17167 is_positive = ((
db_get_double (&value->dbvalue) >= 0) ? 1 : 0);
17183 const char *
p =
NULL;
17192 is_positive = ((p < str_end && (*p) ==
'-') ? 0 : 1);
17201 if (is_positive == 1)
17203 set_max_value =
true;
17205 else if (is_positive == 0)
17207 set_min_value =
true;
17211 set_default_value =
true;
17216 set_default_value =
true;
17221 log_warning =
true;
17240 else if (set_min_value)
17255 assert (set_default_value ==
true);
17296 value->state = HEAP_WRITTEN_ATTRVALUE;
17297 atts_id[updated_n_attrs_id] = value->attrid;
17298 updated_n_attrs_id++;
17304 assert (updated_n_attrs_id == 1);
17306 if (updated_n_attrs_id != 1 || attr_info->read_classrepr ==
NULL || attr_info->last_classrepr ==
NULL 17307 || attr_info->read_classrepr->id >= attr_info->last_classrepr->id)
17358 char *expr_stream =
NULL;
17359 int expr_stream_size = 0;
17365 bool atts_free =
false, attrinfo_clear =
false, attrinfo_end =
false;
17368 if (func_index_info ==
NULL && btid_index > -1 && n_atts == -1)
17370 index = &(attr_info->last_classrepr->indexes[btid_index]);
17371 if (func_pred_cache)
17373 func_pred = func_pred_cache->
func_pred;
17375 nr_atts = index->
n_atts;
17381 nr_atts = index->
n_atts;
17390 for (i = 0; i < nr_atts; i++)
17394 cache_attr_info = attr_info;
17405 func_pred = func_index_info->
expr;
17408 if (func_index_info ==
NULL)
17411 if (func_pred ==
NULL)
17425 attrinfo_end =
true;
17433 attrinfo_clear =
true;
17437 &cache_attr_info->inst_oid,
NULL, &res);
17449 if (fi_domain !=
NULL)
17460 if (attrinfo_clear && cache_attr_info)
17464 if (attrinfo_end && cache_attr_info)
17468 if (atts_free && atts)
17499 int *att_ids =
NULL;
17503 int *attr_info_started =
NULL;
17506 if (attr_info ==
NULL || class_oid ==
NULL || func_indx_preds ==
NULL)
17511 *func_indx_preds =
NULL;
17513 n_indexes = attr_info->last_classrepr->n_indexes;
17514 for (i = 0; i < n_indexes; i++)
17516 idx = &(attr_info->last_classrepr->indexes[
i]);
17520 if (fi_preds ==
NULL)
17530 for (j = 0; j < n_indexes; j++)
17536 size = n_indexes *
sizeof (int);
17538 if (attr_info_started ==
NULL)
17544 for (j = 0; j < n_indexes; j++)
17546 attr_info_started[j] = 0;
17566 for (j = 0; j < idx->
n_atts; j++)
17568 att_ids[j] = idx->
atts[j]->
id;
17578 attr_info_started[
i] = 1;
17587 if (attr_info_started !=
NULL)
17592 *func_indx_preds = fi_preds;
17602 if (attr_info_started !=
NULL)
17607 return error_status;
17622 int *attr_info_started)
17626 if (func_indx_preds ==
NULL)
17631 for (i = 0; i < n_indexes; i++)
17635 if (attr_info_started ==
NULL || attr_info_started[i])
17637 assert (func_indx_preds[i].func_pred->cache_attrinfo);
17638 (void)
heap_attrinfo_end (thread_p, func_indx_preds[i].func_pred->cache_attrinfo);
17643 if (func_indx_preds[i].unpack_info)
17665 const char *class_name =
NULL;
17672 int parts_count = 0;
17673 bool is_all =
false;
17720 for (i = 0; i < parts_count; i++)
17791 char *class_name =
NULL;
17792 int avg_length = 0;
17793 char buf[512] = { 0 };
17794 char temp[64] = { 0 };
17804 hfid_p = &ctx->
hfids[cursor];
17906 end = buf +
sizeof (buf);
17945 end = buf +
sizeof (buf);
17986 assert (idx == out_cnt);
17995 if (class_name !=
NULL)
18021 char *classname =
NULL;
18022 char class_oid_str[64] = { 0 };
18023 bool is_heap_attrinfo_started =
false;
18025 INT64 num_relocated_recs = 0;
18026 INT64 num_overflowed_recs = 0;
18028 int avg_rec_len = 0;
18029 int avg_free_space_per_page = 0;
18030 int avg_free_space_without_last_page = 0;
18031 int avg_overhead_per_page = 0;
18043 hfid_p = &ctx->
hfids[cursor];
18046 heap_get_capacity (thread_p, hfid_p, &num_recs, &num_relocated_recs, &num_overflowed_recs, &num_pages,
18047 &avg_free_space_per_page, &avg_free_space_without_last_page, &avg_rec_len,
18048 &avg_overhead_per_page);
18067 is_heap_attrinfo_started =
true;
18069 repr = attr_info.last_classrepr;
18125 db_make_int (out_values[idx], avg_free_space_per_page);
18128 db_make_int (out_values[idx], avg_free_space_without_last_page);
18131 db_make_int (out_values[idx], avg_overhead_per_page);
18156 assert (idx == out_cnt);
18160 if (classname !=
NULL)
18165 if (is_heap_attrinfo_started)
18207 buf[buf_size - 1] =
'\0';
18231 int len = (int)
strlen (str);
18233 if (*start + len >= end)
18238 memcpy (*start, str, len);
18262 if (page_info ==
NULL)
18465 if (slot_p ==
NULL)
18578 db_make_null (record_info[HEAP_RECORD_INFO_T_REPRID]);
18580 db_make_null (record_info[HEAP_RECORD_INFO_T_MVCC_INSID]);
18582 db_make_null (record_info[HEAP_RECORD_INFO_T_MVCC_FLAGS]);
18625 return heap_next_internal (thread_p, hfid, class_oid, next_oid, recdes, scan_cache, ispeeking,
false,
NULL);
18651 return heap_next_internal (thread_p, hfid, class_oid, next_oid, recdes, scan_cache, ispeeking,
false,
18674 return heap_next_internal (thread_p, hfid, class_oid, next_oid, recdes, scan_cache, ispeeking,
true,
NULL);
18700 return heap_next_internal (thread_p, hfid, class_oid, next_oid, recdes, scan_cache, ispeeking,
true,
18721 if (peek_recdes ==
NULL)
18723 peek_recdes = &ovf_recdes;
18789 if (scan_cache !=
NULL 18878 if (thread_p->no_logging)
18921 bool vacuum_status_change =
false;
18930 vacuum_status_change =
true;
18932 slotid = slotid & (~HEAP_RV_FLAG_VACUUM_STATUS_CHANGE);
18961 int num_btids,
i, j, k;
18963 if (attr_info ==
NULL || att_id ==
NULL)
18968 num_btids = attr_info->last_classrepr->n_indexes;
18969 for (i = 0; i < num_btids; i++)
18971 index = &(attr_info->last_classrepr->indexes[
i]);
18974 for (j = 0; j < n_att_id; j++)
18976 for (k = 0; k < index->
n_atts; k++)
18990 #if defined(ENABLE_UNUSED_FUNCTION) 19015 if (*hdr_pgptr_p !=
NULL)
19022 if (*hdr_pgptr_p ==
NULL)
19035 if (*home_pgptr_p ==
NULL)
19038 if ((*again_count_p)++ >= again_max)
19078 const OID * oid_p,
PAGE_PTR * fwd_pgptr_p,
const VPID * fwd_vpid_p,
const OID * fwd_oid_p,
19084 if (*fwd_pgptr_p !=
NULL)
19091 if (*fwd_pgptr_p ==
NULL)
19104 if (*home_pgptr_p ==
NULL)
19107 if ((*again_count_p)++ >= again_max)
19148 heap_try_fetch_header_with_forward_page (
THREAD_ENTRY * thread_p,
PAGE_PTR * home_pgptr_p,
const VPID * home_vpid_p,
19150 PAGE_PTR * fwd_pgptr_p,
const VPID * fwd_vpid_p,
const OID * fwd_oid_p,
19156 if (*hdr_pgptr_p !=
NULL)
19164 if (*hdr_pgptr_p ==
NULL)
19177 if (*home_pgptr_p ==
NULL)
19180 if ((*again_count_p)++ >= again_max)
19200 if (*fwd_pgptr_p ==
NULL)
19204 if ((*again_count_p)++ >= again_max)
19462 char *classname =
NULL;
19632 if (forward_oid_hint ==
NULL)
19642 COPY_OID (&forward_oid, forward_oid_hint);
19662 #if defined(CUBRID_DEBUG) 19688 recdes_p->
type = rec_type;
19689 recdes_p->
data = (
char *) forward_oid;
19711 int repid_and_flag_bits = 0, mvcc_flags = 0;
19712 char *new_ins_mvccid_pos_p, *start_p, *existing_data_p;
19714 bool use_optimization =
false;
19725 #if defined (SERVER_MODE) 19732 if (use_optimization)
19753 existing_data_p = new_ins_mvccid_pos_p;
19754 memmove (new_ins_mvccid_pos_p +
OR_MVCCID_SIZE, existing_data_p,
19773 #if defined (SERVER_MODE) 19774 if (is_mvcc_class && !insert_context->
is_bulk_op)
19790 int curr_header_size, new_header_size;
19798 record_size -= (curr_header_size - new_header_size);
19842 int repid_and_flag_bits = 0, mvcc_flags = 0, update_mvcc_flags;
19843 char *start_p, *new_ins_mvccid_pos_p, *existing_data_p, *new_data_p;
19845 bool use_optimization =
false;
19847 bool is_mvcc_op =
false;
19860 #if defined (SERVER_MODE) 19864 if (use_optimization)
19878 if ((mvcc_flags & update_mvcc_flags) != update_mvcc_flags)
19881 existing_data_p = new_ins_mvccid_pos_p;
19900 assert (existing_data_p < new_data_p);
19903 memmove (new_data_p, existing_data_p,
19927 #if defined (SERVER_MODE) 19944 int curr_header_size, new_header_size;
19952 record_size -= (curr_header_size - new_header_size);
19956 #if defined (SERVER_MODE) 20049 int slot_count, slot_id, lk_result;
20058 if (home_hint_p ==
NULL)
20114 for (slot_id = 0; slot_id <= slot_count; slot_id++)
20139 #if !defined(NDEBUG) 20194 #if defined(CUBRID_DEBUG) 20198 "heap_insert_internal: This function does not accept" 20211 #if !defined(NDEBUG) 20214 OID heap_class_oid;
20298 if (out_oid_p !=
NULL)
20306 if (newhome_pg_watcher !=
NULL)
20341 #if defined(CUBRID_DEBUG) 20346 "heap_insert_internal: This function does not accept" 20354 OID heap_class_oid;
20389 bool is_mvcc_op,
bool is_redistribute_op)
20394 log_addr.
vfid = vfid_p;
20396 log_addr.
pgptr = page_p;
20400 if (is_redistribute_op)
20414 INT16 bytes_reserved;
20420 temp_recdes.
type = recdes_p->
type;
20421 temp_recdes.
area_size =
sizeof (bytes_reserved);
20422 temp_recdes.
length =
sizeof (bytes_reserved);
20423 bytes_reserved = (INT16) recdes_p->
length;
20424 temp_recdes.
data = (
char *) &bytes_reserved;
20456 if (need_mvcc_header_max_size)
20489 if (
VPID_EQ (&vpid, vpid_incache_p))
20523 #if !defined(NDEBUG) 20526 OID heap_class_oid;
20571 VPID overflow_vpid;
20738 RECDES new_forward_recdes, new_home_recdes;
20742 OID new_forward_oid;
20744 bool fits_in_home, fits_in_forward;
20745 bool update_old_home =
false;
20746 bool update_old_forward =
false;
20747 bool remove_old_forward =
false;
20748 bool is_adjusted_size_big =
false;
20749 int delid_offset, repid_and_flag_bits, mvcc_flags;
20750 char *build_recdes_data;
20751 bool use_optimization;
20755 adjusted_size = forward_recdes.
length;
20762 use_optimization =
true;
20767 if (is_adjusted_size_big)
20770 use_optimization =
false;
20776 is_adjusted_size_big =
false;
20777 use_optimization =
false;
20780 #if !defined(NDEBUG) 20781 if (is_adjusted_size_big)
20793 if (is_adjusted_size_big || (!fits_in_forward && !fits_in_home))
20818 use_optimization =
false;
20820 #if !defined(NDEBUG) 20821 if (is_adjusted_size_big)
20835 if (use_optimization)
20840 build_recdes_data = start_p = new_forward_recdes.
data;
20843 memcpy (build_recdes_data, forward_recdes.
data, delid_offset);
20844 build_recdes_data += delid_offset;
20855 #if !defined(NDEBUG) 20868 memcpy (build_recdes_data, forward_recdes.
data + delid_offset, forward_recdes.
length - delid_offset);
20869 new_forward_recdes.
length = adjusted_size;
20873 int forward_rec_header_size;
20888 memcpy (new_forward_recdes.
data + new_forward_recdes.
length, forward_recdes.
data + forward_rec_header_size,
20889 forward_recdes.
length - forward_rec_header_size);
20890 new_forward_recdes.
length += forward_recdes.
length - forward_rec_header_size;
20895 if (is_adjusted_size_big)
20907 remove_old_forward =
true;
20908 update_old_home =
true;
20912 else if (fits_in_home)
20915 new_home_recdes = new_forward_recdes;
20920 new_forward_recdes.
length = 0;
20925 remove_old_forward =
true;
20926 update_old_home =
true;
20930 else if (fits_in_forward)
20936 update_old_forward =
true;
20955 remove_old_forward =
true;
20956 update_old_home =
true;
20966 if (update_old_home)
21024 if (update_old_forward)
21039 &new_forward_recdes);
21051 if (remove_old_forward)
21147 &forward_recdes,
true,
NULL);
21208 RECDES forwarding_recdes;
21209 RECDES *home_page_updated_recdes;
21214 bool is_adjusted_size_big =
false;
21215 int delid_offset, repid_and_flag_bits, mvcc_flags;
21216 char *build_recdes_data;
21217 bool use_optimization;
21225 use_optimization =
true;
21230 if (is_adjusted_size_big)
21233 use_optimization =
false;
21239 is_adjusted_size_big =
false;
21240 use_optimization =
false;
21243 #if !defined(NDEBUG) 21244 if (is_adjusted_size_big)
21254 if (use_optimization)
21260 build_recdes_data = start_p = built_recdes.
data;
21264 build_recdes_data += delid_offset;
21275 #if !defined(NDEBUG) 21290 built_recdes.
length = adjusted_size;
21318 if (is_adjusted_size_big)
21402 home_page_updated_recdes = &forwarding_recdes;
21420 home_page_updated_recdes = &built_recdes;
21428 home_page_updated_recdes);
21513 bool mark_reusable,
LOG_LSA * undo_lsa)
21525 log_addr.
pgptr = page_p;
21526 log_addr.
vfid = vfid_p;
21532 INT16 bytes_reserved;
21534 temp_recdes.
type = recdes_p->
type;
21535 temp_recdes.
area_size =
sizeof (bytes_reserved);
21536 temp_recdes.
length =
sizeof (bytes_reserved);
21537 bytes_reserved = (INT16) recdes_p->
length;
21538 temp_recdes.
data = (
char *) &bytes_reserved;
21571 bool is_old_home_updated;
21613 if (first_pgptr ==
NULL)
21639 is_old_home_updated =
false;
21664 is_old_home_updated =
true;
21673 new_home_recdes = *context->
recdes_p;
21704 is_old_home_updated =
true;
21709 if (is_old_home_updated)
21751 OID new_forward_oid;
21752 bool fits_in_home, fits_in_forward;
21753 bool update_old_home =
false;
21754 bool update_old_forward =
false;
21755 bool remove_old_forward =
false;
21822 remove_old_forward =
true;
21823 update_old_home =
true;
21827 else if (!fits_in_forward && !fits_in_home)
21834 newhome_pg_watcher_p = &newhome_pg_watcher;
21851 remove_old_forward =
true;
21852 update_old_home =
true;
21856 else if (fits_in_home)
21860 new_home_recdes = *context->
recdes_p;
21863 remove_old_forward =
true;
21864 update_old_home =
true;
21868 else if (fits_in_forward)
21874 update_old_forward =
true;
21887 assert (remove_old_forward != update_old_forward);
21889 assert (remove_old_forward == update_old_home);
21894 if (update_old_home)
21915 if (remove_old_forward)
21937 &forward_recdes,
true, &prev_version_lsa);
21953 if (update_old_forward)
21994 &prev_version_lsa);
22008 if (newhome_pg_watcher_p !=
NULL && newhome_pg_watcher_p->
pgptr !=
NULL)
22027 RECDES forwarding_recdes;
22046 #if defined(CUBRID_DEBUG) 22048 "heap_update_home: ** SYSTEM_ERROR ** update" 22049 " mvcc update was attempted on REC_ASSIGN_ADDRESS home record");
22055 #if defined (SERVER_MODE) 22093 home_page_updated_recdes_p = &forwarding_recdes;
22105 newhome_pg_watcher_p = &newhome_pg_watcher;
22131 home_page_updated_recdes_p = &forwarding_recdes;
22140 home_page_updated_recdes_p = context->
recdes_p;
22168 &context->
home_recdes, home_page_updated_recdes_p, undo_rcvindex);
22176 home_page_updated_recdes_p);
22188 newhome_pg_watcher_p, &prev_version_lsa);
22205 if (newhome_pg_watcher_p !=
NULL && newhome_pg_watcher_p->
pgptr !=
NULL)
22226 INT16 old_record_type;
22237 scancode =
spage_update (thread_p, page_p, slot_id, recdes_p);
22250 #if defined(CUBRID_DEBUG) 22252 "heap_update_physical: ** SYSTEM_ERROR ** update operation failed even when have already checked" 22260 if (old_record_type != recdes_p->
type)
22290 address.
pgptr = page_p;
22291 address.
vfid = vfid_p;
22332 if (class_oid_p !=
NULL)
22430 PERF_UTIME_TRACKER time_track;
22431 bool is_mvcc_class;
22453 #if defined (SERVER_MODE) 22460 is_mvcc_op =
false;
22463 is_mvcc_op =
false;
22478 #if defined(ENABLE_SYSTEMTAP) 22479 CUBRID_OBJ_INSERT_START (&context->
class_oid);
22587 #if defined(ENABLE_SYSTEMTAP) 22588 CUBRID_OBJ_INSERT_END (&context->
class_oid, (rc < 0));
22610 PERF_UTIME_TRACKER time_track;
22666 #if defined (SERVER_MODE) 22669 is_mvcc_op =
false;
22676 is_mvcc_op =
false;
22679 #if defined(ENABLE_SYSTEMTAP) 22680 CUBRID_OBJ_DELETE_START (&context->
class_oid);
22757 #if defined(ENABLE_SYSTEMTAP) 22775 PERF_UTIME_TRACKER time_track;
22776 bool is_mvcc_class;
22845 #if defined (SERVER_MODE) 22851 #if defined(ENABLE_SYSTEMTAP) 22852 CUBRID_OBJ_UPDATE_START (&context->
class_oid);
22970 #if defined(ENABLE_SYSTEMTAP) 22993 if (class_oid ==
NULL || hfid ==
NULL)
23008 if (classname !=
NULL)
23032 if (new_entry ==
NULL)
23039 return (
void *) new_entry;
23080 if (entry_p ==
NULL)
23138 static unsigned int 23166 if (
OID_EQ (key1, key2))
23190 if (heap_Hfid_table !=
NULL)
23244 if (heap_Hfid_table !=
NULL)
23250 heap_Hfid_table =
NULL;
23269 heap_hfid_table_log (thread_p, class_oid,
"heap_delete_hfid_from_cache success=%d", success);
23289 int max_num_slots,
i;
23297 memset (&worker, 0,
sizeof (worker));
23312 for (i = 0; i < max_num_slots; i++)
23355 &upd_scancache->
node.
hfid, &reusable,
false);
23393 const char *classname_in)
23399 char *classname_local =
NULL;
23424 if (classname_in !=
NULL)
23426 classname_local =
strdup (classname_in);
23444 heap_hfid_table_log (thread_p, class_oid,
"heap_cache_class_info failed error=%d", error_code);
23446 if (classname_local !=
NULL)
23448 free (classname_local);
23455 entry->
ftype = ftype;
23457 char *dummy_null =
NULL;
23458 if (!entry->
classname.compare_exchange_strong (dummy_null, classname_local))
23460 free (classname_local);
23465 heap_hfid_table_log (thread_p, class_oid,
"heap_cache_class_info hfid=%d|%d|%d, ftype=%s, classname = %s",
23485 char **classname_out)
23490 char *classname_local =
NULL;
23534 heap_hfid_table_log (thread_p, class_oid,
"heap_hfid_cache_get failed error = %d", error_code);
23537 entry->
hfid = hfid_local;
23539 char *dummy_null =
NULL;
23541 if (!entry->
classname.compare_exchange_strong (dummy_null, classname_local))
23544 free (classname_local);
23563 heap_hfid_table_log (thread_p, class_oid,
"heap_hfid_cache_get failed error = %d", error_code);
23566 entry->
ftype = ftype_local;
23570 if (hfid_out !=
NULL)
23572 *hfid_out = entry->
hfid;
23574 if (ftype_out !=
NULL)
23576 *ftype_out = entry->
ftype;
23578 if (classname_out !=
NULL)
23585 heap_hfid_table_log (thread_p, class_oid,
"heap_hfid_cache_get hfid=%d|%d|%d, ftype = %s, classname = %s",
23632 switch (vacuum_status)
23639 "Changed vacuum status for page %d|%d, lsa=%lld|%d from no vacuum to vacuum once.",
23647 "Changed vacuum status for page %d|%d, lsa=%lld|%d from vacuum once to unknown.",
23658 "Changed vacuum status for page %d|%d, lsa=%lld|%d from unknown to vacuum once.",
23678 (
unsigned long long int) mvccid);
23716 if (vacuum_status_change)
23720 switch (vacuum_status)
23727 "Change heap page %d|%d, lsa=%lld|%d, status from %s to once.",
23735 "Change heap page %d|%d, lsa=%lld|%d, status from once to unknown.",
23883 bool vacuum_status_change =
false;
23987 #define HEAP_LOG_MVCC_REDISTRIBUTE_MAX_REDO_CRUMBS 4 23989 int n_redo_crumbs = 0, data_copy_offset = 0;
24010 redo_crumbs[n_redo_crumbs].
length =
sizeof (p_recdes->
type);
24011 redo_crumbs[n_redo_crumbs++].
data = &p_recdes->
type;
24020 redo_crumbs[n_redo_crumbs++].
data = p_recdes->
data;
24023 redo_crumbs[n_redo_crumbs++].
data = &delid;
24030 redo_crumbs[n_redo_crumbs].
length = p_recdes->
length - data_copy_offset;
24031 redo_crumbs[n_redo_crumbs++].
data = p_recdes->
data + data_copy_offset;
24056 bool vacuum_status_change =
false;
24063 vacuum_status_change =
true;
24065 slotid = slotid & (~HEAP_RV_FLAG_VACUUM_STATUS_CHANGE);
24068 record_type = *(INT16 *) rcv->
data;
24073 rcv->
data + sizeof (record_type));
24078 int repid_and_flags, offset, mvcc_flag, offset_size;
24080 offset =
sizeof (record_type);
24160 if (recdes ==
NULL)
24162 recdes = &local_recdes;
24168 if (
LSA_LT (&oldest_prior_lsa, previous_version_lsa))
24175 assert (!
LSA_LT (&oldest_prior_lsa, previous_version_lsa));
24278 heap_init_get_context (thread_p, &context, oid, class_oid, recdes, scan_cache, ispeeking, old_chn);
24315 heap_init_get_context (thread_p, &context, oid, class_oid, recdes, scan_cache, ispeeking, old_chn);
24385 if (mvcc_snapshot !=
NULL)
24389 snapshot_res = mvcc_snapshot->
snapshot_fnc (thread_p, &mvcc_header, mvcc_snapshot);
24446 RECDES recdes, forward_recdes;
24475 forward_oid = *((
OID *) recdes.
data);
24499 forward_oid = *((
OID *) recdes.
data);
24700 context->
oid_p = oid;
24787 #if !defined(NDEBUG) 24797 #if !defined(NDEBUG) 24848 hfid->
vfid = *vfid;
24902 const size_t DEFAULT_MINSIZE = (size_t)
DB_PAGESIZE * 2;
24904 if (size <= DEFAULT_MINSIZE)
24906 size = DEFAULT_MINSIZE;
24951 if (m_area ==
NULL)
24968 m_area->reserve (size);
24974 reserve_area (size);
24976 recdes.
data = m_area->get_ptr ();
24977 recdes.
area_size = (int) m_area->get_size ();
24983 return m_area !=
NULL && recdes.
data == m_area->get_ptr ();
24990 return m_area->get_block_allocator ();
24995 VPID * new_page_vpid)
25009 new_page_chain.
flags = 0;
25056 VPID heap_hdr_vpid;
25057 VPID heap_last_page_vpid;
25059 bool skip_last_page_links =
false;
25060 VPID heap_header_next_vpid;
25062 size_t array_size = 0;
25063 std::vector <VPID> heap_pages_array;
25078 assert (unpack_int >= 0);
25079 array_size = (size_t) unpack_int;
25082 for (
size_t i = 0;
i < array_size;
i++)
25091 heap_pages_array.push_back (vpid);
25095 assert (array_size == heap_pages_array.size ());
25106 if (array_size == 0)
25116 for (
size_t i = 0;
i < array_size;
i++)
25132 for (
size_t i = 0;
i < array_size;
i++)
25136 VPID_COPY (&prev_vpid, ((
i == 0) ? (&null_vpid) : (&heap_pages_array[
i - 1])));
25137 VPID_COPY (&next_vpid, ((
i == array_size - 1) ? (&null_vpid) : (&heap_pages_array[
i + 1])));
25140 &page_watcher,
false,
false);
25171 if (heap_hdr ==
NULL)
25179 heap_header_next_vpid = heap_hdr->
next_vpid;
25182 error_code =
heap_get_last_page (thread_p, &hfid, heap_hdr,
NULL, &heap_last_page_vpid, &heap_last_page_watcher);
25198 if (
VPID_EQ (&heap_hdr_vpid, &heap_last_page_vpid))
25202 skip_last_page_links =
true;
25204 heap_header_next_vpid = heap_pages_array[0];
25209 &page_watcher,
false,
false);
25217 if (!skip_last_page_links)
25220 &heap_last_page_watcher,
true,
true);
25230 heap_pages_array[array_size - 1], array_size);
25251 if (page_watcher.
pgptr)
25256 if (heap_last_page_watcher.
pgptr)
25261 if (heap_header_watcher.
pgptr)
25276 const char *ptr = (
const char *) data;
25332 bool is_page_watcher_inited)
25338 if (!is_page_watcher_inited)
25368 chain_prev = *chain;
25371 if (prev_link !=
NULL)
25377 if (next_link !=
NULL)
25394 if (!keep_page_fixed)
25409 const int new_num_pages)
25418 heap_hdr_prev = *heap_hdr;
25431 &heap_hdr_prev, heap_hdr);
25441 const std::vector<VPID> &heap_pages_array)
25443 if (heap_pages_array.empty ())
25450 size_t array_size = heap_pages_array.size ();
25455 char *ptr = log_data;
25474 for (
size_t i = 0;
i < array_size;
i++)
25480 assert ((ptr - log_data) == log_data_size);
SCAN_CODE heap_get_record_data_when_all_ready(THREAD_ENTRY *thread_p, HEAP_GET_CONTEXT *context)
HEAP_CLASSREPR_LOCK * lock_next
static int heap_stats_sync_bestspace(THREAD_ENTRY *thread_p, const HFID *hfid, HEAP_HDR_STATS *heap_hdr, VPID *hdr_vpid, bool scan_all, bool can_cycle)
#define HEAP_PAGE_SET_VACUUM_STATUS(chain, status)
static int heap_stats_bestspace_finalize(void)
DISK_ISVALID not_vacuumed_res
static int heap_chnguess_decache(const OID *oid)
MIN_MAX_COLUMN_INFO min_max_val
#define OR_SET_VAR_OFFSET_SIZE(val, offset_size)
DB_C_FLOAT db_get_float(const DB_VALUE *value)
int heap_vpid_prev(THREAD_ENTRY *thread_p, const HFID *hfid, PAGE_PTR pgptr, VPID *prev_vpid)
PAGE_PTR pgbuf_fix_debug(THREAD_ENTRY *thread_p, const VPID *vpid, PAGE_FETCH_MODE fetch_mode, PGBUF_LATCH_MODE request_mode, PGBUF_LATCH_CONDITION condition, const char *caller_file, int caller_line)
int data_readval(struct or_buf *buf, DB_VALUE *value, const tp_domain *domain, int size, bool copy, char *copy_buf, int copy_buf_len) const
#define HEAP_PERF_TRACK_PREPARE(thread_p, context)
static int heap_insert_newhome(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *parent_context, RECDES *recdes_p, OID *out_oid_p, PGBUF_WATCHER *newhome_pg_watcher)
#define ER_PAGE_LATCH_ABORTED
DISK_ISVALID pgbuf_is_valid_page(THREAD_ENTRY *thread_p, const VPID *vpid, bool no_error, DISK_ISVALID(*fun)(const VPID *vpid, void *args), void *args)
#define CLASSREPR_HASH_SIZE
DB_VALUE * heap_attrinfo_access(ATTR_ID attrid, HEAP_CACHE_ATTRINFO *attr_info)
void assign_recdes_to_area(RECDES &recdes, size_t size=0)
#define PGBUF_PAGE_VPID_AS_ARGS(pg)
#define OR_GET_HFID(ptr, hfid)
SCAN_CODE heap_capacity_next_scan(THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
SCAN_CODE heap_scanrange_next(THREAD_ENTRY *thread_p, OID *next_oid, RECDES *recdes, HEAP_SCANRANGE *scan_range, int ispeeking)
void heap_scancache_end_modify(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
bool tp_domain_references_objects(const TP_DOMAIN *dom)
int tp_domain_disk_size(TP_DOMAIN *domain)
#define PGBUF_WATCHER_COPY_GROUP(w_dst, w_src)
DB_VALUE * heap_attrvalue_get_key(THREAD_ENTRY *thread_p, int btid_index, HEAP_CACHE_ATTRINFO *idx_attrinfo, RECDES *recdes, BTID *btid, DB_VALUE *db_value, char *buf, FUNC_PRED_UNPACK_INFO *func_indx_pred, TP_DOMAIN **key_domain)
#define OR_PUT_OID(ptr, oid)
int heap_object_upgrade_domain(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *upd_scancache, HEAP_CACHE_ATTRINFO *attr_info, OID *oid, const ATTR_ID att_id)
#define vacuum_er_log_error(er_log_level, msg,...)
static int heap_hfid_table_entry_uninit(void *entry)
int heap_rv_mark_deleted_on_postpone(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
static HEAP_STATS_BESTSPACE_CACHE heap_Bestspace_cache_area
static HEAP_CHNGUESS heap_Guesschn_area
#define pgbuf_attach_watcher(...)
int xheap_get_class_num_objects_pages(THREAD_ENTRY *thread_p, const HFID *hfid, int approximation, int *nobjs, int *npages)
cubthread::entry * thread_get_thread_entry_info(void)
int heap_header_capacity_start_scan(THREAD_ENTRY *thread_p, int show_type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
static SCAN_CODE heap_next_internal(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, OID *next_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, bool ispeeking, bool reversed_direction, DB_VALUE **cache_recordinfo)
int mht_map_no_key(THREAD_ENTRY *thread_p, const MHT_TABLE *ht, int(*map_func)(THREAD_ENTRY *thread_p, void *data, void *args), void *func_args)
static DISK_ISVALID heap_chkreloc_end(HEAP_CHKALL_RELOCOIDS *chk)
char * get_data_for_modify(void)
void log_append_redo_data(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int length, const void *data)
int or_rep_id(RECDES *record)
#define MVCC_IS_HEADER_DELID_VALID(rec_header_p)
DB_COLLECTION * db_get_set(const DB_VALUE *value)
int heap_get_class_oid_from_page(THREAD_ENTRY *thread_p, PAGE_PTR page_p, OID *class_oid)
#define MVCC_GET_INSID(header)
HEAP_CLASSREPR_HASH * hash_table
#define LANG_SYS_COLLATION
int pr_data_writeval_disk_size(DB_VALUE *value)
MVCC_SNAPSHOT * logtb_get_mvcc_snapshot(THREAD_ENTRY *thread_p)
#define MVCC_IS_CHN_UPTODATE(rec_header_p, chn)
static int heap_classrepr_dump(THREAD_ENTRY *thread_p, FILE *fp, const OID *class_oid, const OR_CLASSREP *repr)
#define pgbuf_ordered_fix(thread_p, req_vpid, fetch_mode, requestmode, req_watcher)
#define VACUUM_ER_LOG_RECOVERY
#define LF_EM_NOT_USING_MUTEX
void log_append_undoredo_data2(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, const VFID *vfid, PAGE_PTR pgptr, PGLENGTH offset, int undo_length, int redo_length, const void *undo_data, const void *redo_data)
static void heap_scancache_block_allocate(cubmem::block &b, size_t size)
TP_DOMAIN_STATUS tp_domain_check(const TP_DOMAIN *domain, const DB_VALUE *value, TP_MATCH exact_match)
int xheap_has_instance(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, int has_visible_instance)
void add_empty(const BTID &index)
SCAN_CODE heap_last(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, OID *oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking)
static void heap_stats_put_second_best(HEAP_HDR_STATS *heap_hdr, VPID *vpid)
int db_value_domain_min(DB_VALUE *value, const DB_TYPE type, const int precision, const int scale, const int codeset, const int collation_id, const DB_ENUMERATION *enumeration)
int vacuum_heap_page(THREAD_ENTRY *thread_p, VACUUM_HEAP_OBJECT *heap_objects, int n_heap_objects, MVCCID threshold_mvccid, HFID *hfid, bool *reusable, bool was_interrupted)
HEAP_SCANCACHE * scan_cache_p
#define HEAP_RV_FLAG_VACUUM_STATUS_CHANGE
static int heap_dump_hdr(FILE *fp, HEAP_HDR_STATS *heap_hdr)
void log_append_undoredo_crumbs(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int num_undo_crumbs, int num_redo_crumbs, const LOG_CRUMB *undo_crumbs, const LOG_CRUMB *redo_crumbs)
OR_FUNCTION_INDEX * func_index_info
#define OID_GT(oidp1, oidp2)
void or_class_tde_algorithm(RECDES *record, TDE_ALGORITHM *tde_algo)
SCAN_CODE heap_scanrange_to_prior(THREAD_ENTRY *thread_p, HEAP_SCANRANGE *scan_range, OID *last_oid)
static int heap_ovf_get_capacity(THREAD_ENTRY *thread_p, const OID *ovf_oid, int *ovf_len, int *ovf_num_pages, int *ovf_overhead, int *ovf_free_space)
VACUUM_HEAP_OBJECT * heap_objects
STATIC_INLINE HEAP_CHAIN * heap_get_chain_ptr(THREAD_ENTRY *thread_p, PAGE_PTR page_heap) __attribute__((ALWAYS_INLINE))
#define HEAP_MAYNEED_DECACHE_GUESSED_LASTREPRS(class_oid, hfid)
static int heap_ovf_get_length(THREAD_ENTRY *thread_p, const OID *ovf_oid)
int file_descriptor_update(THREAD_ENTRY *thread_p, const VFID *vfid, void *des_new)
#define heap_classrepr_log_er(msg,...)
unsigned int of_local_next
HEAP_BESTSPACE best[HEAP_NUM_BEST_SPACESTATS]
void lf_hash_destroy(LF_HASH_TABLE *table)
void logpb_fatal_error(THREAD_ENTRY *thread_p, bool logexit, const char *file_name, const int lineno, const char *fmt,...)
int heap_rv_redo_reuse_page(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int data_writeval(struct or_buf *buf, const DB_VALUE *value) const
static int heap_attrinfo_check(const OID *inst_oid, HEAP_CACHE_ATTRINFO *attr_info)
static int heap_get_record_location(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context)
int file_dealloc(THREAD_ENTRY *thread_p, const VFID *vfid, const VPID *vpid, FILE_TYPE file_type_hint)
#define QSTR_IS_ANY_CHAR(s)
static int heap_update_and_log_header(THREAD_ENTRY *thread_p, const HFID *hfid, const PGBUF_WATCHER heap_header_watcher, HEAP_HDR_STATS *heap_hdr, const VPID new_next_vpid, const VPID new_last_vpid, const int new_num_pages)
bool is_redistribute_insert_with_delid
int heap_scancache_start_modify(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, const HFID *hfid, const OID *class_oid, int op_type, MVCC_SNAPSHOT *mvcc_snapshot)
#define LOG_DATA_ADDR_INITIALIZER
static OR_CLASSREP * heap_classrepr_get_from_record(THREAD_ENTRY *thread_p, REPR_ID *last_reprid, const OID *class_oid, RECDES *class_recdes, REPR_ID reprid)
int heap_scancache_quick_start_modify_with_class_oid(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, OID *class_oid)
LF_ENTRY_INITIALIZE_FUNC f_init
static void heap_page_rv_chain_update(THREAD_ENTRY *thread_p, PAGE_PTR heap_page, MVCCID mvccid, bool vacuum_status_change)
void LSA_COPY(log_lsa *plsa1, const log_lsa *plsa2)
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 heap_attrinfo_delete_lob(THREAD_ENTRY *thread_p, RECDES *recdes, HEAP_CACHE_ATTRINFO *attr_info)
static int heap_attrinfo_recache_attrepr(HEAP_CACHE_ATTRINFO *attr_info, bool islast_reset)
int heap_classrepr_restart_cache(void)
#define TP_IS_SET_TYPE(typenum)
#define ER_TF_BUFFER_OVERFLOW
void set_free(DB_COLLECTION *set)
int spage_insert(THREAD_ENTRY *thread_p, PAGE_PTR page_p, RECDES *record_descriptor_p, PGSLOTID *out_slot_id_p)
static void heap_log_delete_physical(THREAD_ENTRY *thread_p, PAGE_PTR page_p, VFID *vfid_p, OID *oid_p, RECDES *recdes_p, bool mark_reusable, LOG_LSA *undo_lsa)
#define VPID_COPY(dest_ptr, src_ptr)
PAGEID pgbuf_get_page_id(PAGE_PTR pgptr)
int db_make_bigint(DB_VALUE *value, const DB_BIGINT num)
int db_get_int(const DB_VALUE *value)
int heap_prepare_object_page(THREAD_ENTRY *thread_p, const OID *oid, PGBUF_WATCHER *page_watcher_p, PGBUF_LATCH_MODE latch_mode)
int heap_manager_finalize(void)
void heap_finalize_hfid_table(void)
SCAN_CODE heap_prepare_get_context(THREAD_ENTRY *thread_p, HEAP_GET_CONTEXT *context, bool is_heap_scan, NON_EXISTENT_HANDLING non_ex_handling_type)
#define ER_HEAP_NODATA_NEWADDRESS
int logtb_get_number_of_total_tran_indices(void)
#define heap_hfid_table_log(thp, oidp, msg,...)
LOG_LSA * log_get_append_lsa(void)
int logpb_fetch_page(THREAD_ENTRY *thread_p, const LOG_LSA *req_lsa, LOG_CS_ACCESS_MODE access_mode, LOG_PAGE *log_pgptr)
LOG_LSA * logtb_find_current_tran_lsa(THREAD_ENTRY *thread_p)
void log_sysop_start_atomic(THREAD_ENTRY *thread_p)
DB_C_DOUBLE db_get_double(const DB_VALUE *value)
#define OR_MVCC_DELETE_ID_SIZE
PGBUF_WATCHER overflow_page_watcher
int db_make_varchar(DB_VALUE *value, const int max_char_length, DB_CONST_C_CHAR str, const int char_str_byte_size, const int codeset, const int collation_id)
void spage_initialize(THREAD_ENTRY *thread_p, PAGE_PTR page_p, INT16 slot_type, unsigned short alignment, bool is_saving)
bool mvcc_is_mvcc_disabled_class(const OID *class_oid)
pthread_mutex_t hash_mutex
static SCAN_CODE heap_get_visible_version_from_log(THREAD_ENTRY *thread_p, RECDES *recdes, LOG_LSA *previous_version_lsa, HEAP_SCANCACHE *scan_cache, int has_chn)
int file_get_type(THREAD_ENTRY *thread_p, const VFID *vfid, FILE_TYPE *ftype_out)
#define csect_enter(a, b, c)
TRAN_ABORT_REASON tran_abort_reason
#define DEFAULT_REPR_INCREMENT
DB_COLLECTION * set_copy(DB_COLLECTION *set)
int file_tracker_reuse_heap(THREAD_ENTRY *thread_p, const OID *class_oid, HFID *hfid_out)
#define OR_MVCC_REPID_MASK
DISK_ISVALID file_check_vpid(THREAD_ENTRY *thread_p, const VFID *vfid, const VPID *vpid_lookup)
SCAN_CODE spage_previous_record_dont_skip_empty(PAGE_PTR page_p, PGSLOTID *out_slot_id_p, RECDES *record_descriptor_p, int is_peeking)
int mht_rem(MHT_TABLE *ht, const void *key, int(*rem_func)(const void *key, void *data, void *args), void *func_args)
LF_ENTRY_UNINITIALIZE_FUNC f_uninit
#define HEAP_BIT_SET(byte_ptr, bit_num)
static int heap_scancache_check_with_hfid(THREAD_ENTRY *thread_p, HFID *hfid, OID *class_oid, HEAP_SCANCACHE **scan_cache)
REPR_ID heap_get_class_repr_id(THREAD_ENTRY *thread_p, OID *class_oid)
void set_record_length(std::size_t length)
static HEAP_CLASSREPR_CACHE heap_Classrepr_cache
TP_DOMAIN_STATUS tp_value_auto_cast(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain)
int heap_rv_undo_update(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define HEAP_MAX_FIRSTSLOTID_LENGTH
#define SAFEGUARD_RVSPACE
#define ER_CT_UNKNOWN_REPRID
void logpb_force_flush_pages(THREAD_ENTRY *thread_p)
HEAP_STATS_ENTRY * free_list
void heap_rv_dump_chain(FILE *fp, int ignore_length, void *data)
static int heap_attrinfo_start_refoids(THREAD_ENTRY *thread_p, OID *class_oid, HEAP_CACHE_ATTRINFO *attr_info)
multi_index_unique_stats * m_index_stats
const void * mht_put(MHT_TABLE *ht, const void *key, void *data)
static int heap_get_page_with_watcher(THREAD_ENTRY *thread_p, const VPID *page_vpid, PGBUF_WATCHER *pg_watcher)
static int heap_classrepr_finalize_cache(void)
PGBUF_WATCHER home_page_watcher
#define ASSERT_ERROR_AND_SET(error_code)
static int heap_update_home(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context, bool is_mvcc_op)
struct heap_chain HEAP_CHAIN
SPAGE_SLOT * spage_get_slot(PAGE_PTR page_p, PGSLOTID slot_id)
#define OR_MVCC_FLAG_VALID_INSID
LF_ENTRY_FREE_FUNC f_free
#define assert_release(e)
HEAP_CLASSREPR_ENTRY * area
void pgbuf_set_dirty(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, bool free_page)
char * overflow_get_first_page_data(char *page_ptr)
void LOG_CS_ENTER(THREAD_ENTRY *thread_p)
SCAN_CODE overflow_get(THREAD_ENTRY *thread_p, const VPID *ovf_vpid, RECDES *recdes, MVCC_SNAPSHOT *mvcc_snapshot)
void spage_update_record_type(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, INT16 record_type)
int or_mvcc_get_header(RECDES *record, MVCC_REC_HEADER *mvcc_header)
int pr_midxkey_init_boundbits(char *bufptr, int n_atts)
PGBUF_WATCHER * overflow_page_watcher_p
void heap_page_set_vacuum_status_none(THREAD_ENTRY *thread_p, PAGE_PTR heap_page)
int lock_object(THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock, int cond_flag)
#define ER_CSS_PTHREAD_MUTEX_LOCK
void log_sysop_start(THREAD_ENTRY *thread_p)
#define OR_GET_BOUND_BIT_FLAG(ptr)
INT16 heap_rv_remove_flags_from_offset(INT16 offset)
int heap_scancache_quick_start_root_hfid(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
int heap_dump_capacity(THREAD_ENTRY *thread_p, FILE *fp, const HFID *hfid)
#define OR_MVCC_FLAG_VALID_DELID
static int heap_chkreloc_print_notfound(const void *ignore_reloc_oid, void *ent, void *xchk)
static void heap_mvcc_log_delete(THREAD_ENTRY *thread_p, LOG_DATA_ADDR *p_addr, LOG_RCVINDEX rcvindex)
#define LOG_IS_MVCC_HEAP_OPERATION(rcvindex)
#define OR_MVCC_PREV_VERSION_LSA_OFFSET(mvcc_flags)
static int heap_scancache_start_internal(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, const HFID *hfid, const OID *class_oid, int cache_last_fix_page, bool is_queryscan, int is_indexscan, MVCC_SNAPSHOT *mvcc_snapshot)
bool oid_is_system_class(const OID *class_oid)
static int heap_insert_handle_multipage_record(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context)
DISK_ISVALID heap_check_all_pages(THREAD_ENTRY *thread_p, HFID *hfid)
static int heap_update_set_prev_version(THREAD_ENTRY *thread_p, const OID *oid, PGBUF_WATCHER *home_pg_watcher, PGBUF_WATCHER *fwd_pg_watcher, LOG_LSA *prev_version_lsa)
static int heap_get_insert_location_with_lock(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context, PGBUF_WATCHER *home_hint_p)
int index_writeval(struct or_buf *buf, const DB_VALUE *value) const
#define OID_SET_NULL(oidp)
static void heap_delete_adjust_header(MVCC_REC_HEADER *header_p, MVCCID mvcc_id, bool need_mvcc_header_max_size)
#define OID_LT(oidp1, oidp2)
#define OR_GET_BOUND_BITS(obj, nvars, fsize)
#define OR_PUT_VPID_ALIGNED(ptr, vpid)
static const OID * heap_ovf_update(THREAD_ENTRY *thread_p, const HFID *hfid, const OID *ovf_oid, RECDES *recdes)
#define OR_VAR_ELEMENT_PTR(obj, index)
#define OR_MVCC_FLAG_SHIFT_BITS
HEAP_CLASSREPR_ENTRY * free_top
void thread_suspend_wakeup_and_unlock_entry(cubthread::entry *thread_p, thread_resume_suspend_status suspended_reason)
void heap_rv_dump_statistics(FILE *fp, int ignore_length, void *data)
int heap_get_best_space_num_stats_entries(void)
int db_elo_copy(DB_ELO *src, DB_ELO *dest)
struct spage_slot SPAGE_SLOT
TP_DOMAIN * tp_domain_copy(const TP_DOMAIN *domain, bool check_cache)
int lock_scan(THREAD_ENTRY *thread_p, const OID *class_oid, int cond_flag, LOCK class_lock)
void or_free_classrep(OR_CLASSREP *rep)
#define lf_tran_end_with_mb(entry)
static int heap_classrepr_initialize_cache(void)
TP_DOMAIN * tp_domain_find_charbit(DB_TYPE type, int codeset, int collation_id, unsigned char collation_flag, int precision, bool is_desc)
int or_mvcc_add_header(RECDES *record, MVCC_REC_HEADER *mvcc_rec_header, int bound_bit, int variable_offset_size)
void pgbuf_ordered_set_dirty_and_free(THREAD_ENTRY *thread_p, PGBUF_WATCHER *pg_watcher)
#define MVCC_CLEAR_FLAG_BITS(rec_header_p, flag)
#define BTID_IS_EQUAL(b1, b2)
PAGE_PTR pgbuf_flush_with_wal(THREAD_ENTRY *thread_p, PAGE_PTR pgptr)
int xheap_destroy_newly_created(THREAD_ENTRY *thread_p, const HFID *hfid, const OID *class_oid)
int heap_rv_mark_deleted_on_undo(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
SCAN_CODE heap_get_last_version(THREAD_ENTRY *thread_p, HEAP_GET_CONTEXT *context)
int * attrs_prefix_length
int file_get_sticky_first_page(THREAD_ENTRY *thread_p, const VFID *vfid, VPID *vpid_out)
#define MVCC_SET_DELID(header, mvcc_id)
LF_FREELIST hfid_hash_freelist
#define OR_BOUND_BIT_BYTES(count)
#define PGBUF_IS_CLEAN_WATCHER(w)
bool spage_reclaim(THREAD_ENTRY *thread_p, PAGE_PTR page_p)
int heap_scancache_end_when_scan_will_resume(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
static int heap_get_capacity(THREAD_ENTRY *thread_p, const HFID *hfid, INT64 *num_recs, INT64 *num_recs_relocated, INT64 *num_recs_inovf, INT64 *num_pages, int *avg_freespace, int *avg_freespace_nolast, int *avg_reclength, int *avg_overhead)
static SCAN_CODE heap_get_bigone_content(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, bool ispeeking, OID *forward_oid, RECDES *recdes)
#define PTR_ALIGN(addr, boundary)
static int heap_rv_mvcc_redo_delete_internal(THREAD_ENTRY *thread_p, PAGE_PTR page, PGSLOTID slotid, MVCCID mvccid)
#define OR_OFFSET_SIZE_2BYTE
#define OID_AS_ARGS(oidp)
#define HEAP_SCANCACHE_SET_NODE(scan_cache, class_oid_p, hfid_p)
struct func_pred_unpack_info FUNC_PRED_UNPACK_INFO
static const cubmem::block_allocator HEAP_SCANCACHE_BLOCK_ALLOCATOR
MVCCID heap_page_get_max_mvccid(THREAD_ENTRY *thread_p, PAGE_PTR heap_page)
void or_class_hfid(RECDES *record, HFID *hfid)
bool LSA_LT(const log_lsa *plsa1, const log_lsa *plsa2)
enum tp_domain_status TP_DOMAIN_STATUS
static PAGE_PTR heap_stats_find_best_page(THREAD_ENTRY *thread_p, const HFID *hfid, int needed_space, bool isnew_rec, int newrec_size, HEAP_SCANCACHE *space_cache, PGBUF_WATCHER *pg_watcher)
#define er_log_debug(...)
void spage_set_need_update_best_hint(THREAD_ENTRY *thread_p, PAGE_PTR page_p, bool need_update)
PGSLOTID spage_delete_for_recovery(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
#define HEAP_CLASSREPR_MAXCACHE
int pgbuf_ordered_fix_debug(THREAD_ENTRY *thread_p, const VPID *req_vpid, PAGE_FETCH_MODE fetch_mode, const PGBUF_LATCH_MODE request_mode, PGBUF_WATCHER *req_watcher, const char *caller_file, int caller_line)
#define VPID_AS_ARGS(vpidp)
static void heap_log_insert_physical(THREAD_ENTRY *thread_p, PAGE_PTR page_p, VFID *vfid_p, OID *oid_p, RECDES *recdes_p, bool is_mvcc_op, bool is_redistribute_op)
bool heap_does_exist(THREAD_ENTRY *thread_p, OID *class_oid, const OID *oid)
void * mht_get2(const MHT_TABLE *ht, const void *key, void **last)
int heap_scancache_end(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
HEAP_CLASSREPR_LOCK * lock_next
#define ER_HEAP_FOUND_NOT_VACUUMED
#define OR_VAR_OFFSET(obj, index)
HEAP_CHNGUESS_ENTRY * entries
int file_dump(THREAD_ENTRY *thread_p, const VFID *vfid, FILE *fp)
static int heap_get_class_info_from_record(THREAD_ENTRY *thread_p, const OID *class_oid, HFID *hfid, char **classname_out)
int db_make_elo(DB_VALUE *value, DB_TYPE type, const DB_ELO *elo)
static HEAP_CLASSREPR_CACHE * heap_Classrepr
bool spage_is_slot_exist(PAGE_PTR page_p, PGSLOTID slot_id)
#define ER_ALTER_CHANGE_CAST_FAILED_SET_DEFAULT
int heap_attrinfo_start_with_index(THREAD_ENTRY *thread_p, OID *class_oid, RECDES *class_recdes, HEAP_CACHE_ATTRINFO *attr_info, HEAP_IDX_ELEMENTS_INFO *idx_info)
#define COPY_OID(dest_oid_ptr, src_oid_ptr)
#define heap_scan_pb_lock_and_fetch(...)
#define pthread_mutex_trylock(a)
#define OR_MVCC_MAX_HEADER_SIZE
SCAN_CODE spage_get_record(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, RECDES *record_descriptor_p, int is_peeking)
HEAP_SCANCACHE_NODE_LIST * partition_list
#define PGBUF_CLEAR_WATCHER(w)
int heap_objects_capacity
char * or_pack_mvccid(char *ptr, const MVCCID mvccid)
int mvcc_header_size_lookup[8]
static HEAP_STATS_BESTSPACE_CACHE * heap_Bestspace
bool spage_is_updatable(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, int record_descriptor_length)
DB_ELO * db_get_elo(const DB_VALUE *value)
PGBUF_WATCHER fwd_page_watcher
int xlogtb_reset_wait_msecs(THREAD_ENTRY *thread_p, int wait_msecs)
#define vacuum_er_log_warning(er_log_level, msg,...)
static int heap_is_valid_oid(THREAD_ENTRY *thread_p, OID *oid)
static int heap_insert_adjust_recdes_header(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context, bool is_mvcc_class)
int db_elo_delete(DB_ELO *elo)
SCAN_CODE heap_get_mvcc_header(THREAD_ENTRY *thread_p, HEAP_GET_CONTEXT *context, MVCC_REC_HEADER *mvcc_header)
#define ER_HEAP_MISMATCH_NPAGES
int file_create_with_npages(THREAD_ENTRY *thread_p, FILE_TYPE file_type, int npages, FILE_DESCRIPTORS *des, VFID *vfid)
#define LF_HASH_TABLE_INITIALIZER
VPID second_best[HEAP_NUM_BEST_SPACESTATS]
#define VFID_ISNULL(vfid_ptr)
SCAN_CODE heap_next_record_info(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, OID *next_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking, DB_VALUE **cache_recordinfo)
int overflow_update(THREAD_ENTRY *thread_p, const VFID *ovf_vfid, const VPID *ovf_vpid, RECDES *recdes, FILE_TYPE file_type)
#define MVCCID_ALL_VISIBLE
#define pgbuf_unfix_and_init(thread_p, pgptr)
#define OR_VAR_IS_NULL(obj, index)
#define MVCC_GET_PREV_VERSION_LSA(header)
#define MVCC_SET_INSID(header, mvcc_id)
#define ER_HEAP_UNABLE_TO_CREATE_HEAP
or_auto_increment auto_increment
int spage_get_record_length(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
static int heap_vpid_init_new(THREAD_ENTRY *thread_p, PAGE_PTR page, void *args)
char * vpid_to_string(char *buf, int buf_size, VPID *vpid)
int heap_chnguess_put(THREAD_ENTRY *thread_p, const OID *oid, int tran_index, int chn)
void vacuum_log_add_dropped_file(THREAD_ENTRY *thread_p, const VFID *vfid, const OID *class_oid, bool pospone_or_undo)
static void heap_unfix_watchers(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context)
#define HEAP_NUM_BEST_SPACESTATS
int pr_free_ext_value(DB_VALUE *value)
int spage_update(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, const RECDES *record_descriptor_p)
static int heap_stats_bestspace_initialize(void)
void heap_log_postpone_heap_append_pages(THREAD_ENTRY *thread_p, const HFID *hfid, const OID *class_oid, const std::vector< VPID > &heap_pages_array)
int heap_attrinfo_set_uninitialized_global(THREAD_ENTRY *thread_p, OID *inst_oid, RECDES *recdes, HEAP_CACHE_ATTRINFO *attr_info)
unsigned int of_del_tran_id
PGBUF_WATCHER home_page_watcher
BTREE_SEARCH xbtree_find_unique(THREAD_ENTRY *thread_p, BTID *btid, SCAN_OPERATION_TYPE scan_op_type, DB_VALUE *key, OID *class_oid, OID *oid, bool is_all_class_srch)
#define OID_PSEUDO_KEY(oidp)
int heap_cache_class_info(THREAD_ENTRY *thread_p, const OID *class_oid, HFID *hfid, FILE_TYPE ftype, const char *classname_in)
int heap_scancache_start(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, const HFID *hfid, const OID *class_oid, int cache_last_fix_page, int is_indexscan, MVCC_SNAPSHOT *mvcc_snapshot)
struct heap_hdr_stats::@162 estimates
#define HEAP_NBYTES_CLEARED(byte_ptr, byte_cnt)
DB_MONETARY * db_get_monetary(const DB_VALUE *value)
HEAP_CLASSREPR_ENTRY * hash_next
void copy_to(mvcc_snapshot &other) const
void heap_classrepr_logging_template(const char *filename, const int line, ErF &&er_f, const char *msg, Args &&...args)
void mht_destroy(MHT_TABLE *ht)
bool pr_is_set_type(DB_TYPE type)
int file_tracker_interruptable_iterate(THREAD_ENTRY *thread_p, FILE_TYPE desired_ftype, VFID *vfid, OID *class_oid)
int file_descriptor_get(THREAD_ENTRY *thread_p, const VFID *vfid, FILE_DESCRIPTORS *desc_out)
static int heap_vpid_alloc(THREAD_ENTRY *thread_p, const HFID *hfid, PAGE_PTR hdr_pgptr, HEAP_HDR_STATS *heap_hdr, HEAP_SCANCACHE *scan_cache, PGBUF_WATCHER *new_pg_watcher)
static void heap_page_update_chain_after_mvcc_op(THREAD_ENTRY *thread_p, PAGE_PTR heap_page, MVCCID mvccid)
static int heap_chnguess_initialize(void)
#define HEAP_CHK_ADD_UNFOUND_RELOCOIDS
int boot_find_root_heap(HFID *root_hfid_p)
PAGE_TYPE pgbuf_get_page_ptype(THREAD_ENTRY *thread_p, PAGE_PTR pgptr)
static int heap_Slotted_overhead
#define HEAP_GUESS_NUM_INDEXED_ATTRS
int heap_get_class_tde_algorithm(THREAD_ENTRY *thread_p, const OID *class_oid, TDE_ALGORITHM *tde_algo)
int file_alloc_sticky_first_page(THREAD_ENTRY *thread_p, const VFID *vfid, FILE_INIT_PAGE_FUNC f_init, void *f_init_args, VPID *vpid_out, PAGE_PTR *page_out)
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)
int spage_max_record_size(void)
static int heap_scan_cache_allocate_recdes_data(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache_p, RECDES *recdes_p, int size)
int heap_scancache_quick_start_modify(HEAP_SCANCACHE *scan_cache)
PR_TYPE * pr_type_from_id(DB_TYPE id)
int spage_check(THREAD_ENTRY *thread_p, PAGE_PTR page_p)
void spage_dump(THREAD_ENTRY *thread_p, FILE *fp, PAGE_PTR page_p, int is_record_printed)
#define RECDES_INITIALIZER
int lf_hash_init(LF_HASH_TABLE *table, LF_FREELIST *freelist, unsigned int hash_size, LF_ENTRY_DESCRIPTOR *edesc)
#define MVCCID_IS_NORMAL(id)
#define HEAP_BESTSPACE_SYNC_THRESHOLD
TP_DOMAIN * tp_domain_resolve_default(DB_TYPE type)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
int spage_max_space_for_new_record(THREAD_ENTRY *thread_p, PAGE_PTR page_p)
static int heap_scancache_quick_end(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
int or_mvcc_set_log_lsa_to_record(RECDES *record, LOG_LSA *lsa)
#define HEAP_STATS_ENTRY_FREELIST_SIZE
int db_set_get(DB_SET *set, int index, DB_VALUE *value)
PGBUF_WATCHER * forward_page_watcher_p
#define OR_MVCC_FLAG_VALID_PREV_VERSION
char * fileio_get_volume_label(VOLID vol_id, bool is_peek)
#define ER_QPROC_INVALID_PARAMETER
#define HEAP_HEADER_AND_CHAIN_SLOTID
int heap_attrinfo_read_dbvalues_without_oid(THREAD_ENTRY *thread_p, RECDES *recdes, HEAP_CACHE_ATTRINFO *attr_info)
static DISK_ISVALID heap_chkreloc_next(THREAD_ENTRY *thread_p, HEAP_CHKALL_RELOCOIDS *chk, PAGE_PTR pgptr)
bool pgbuf_has_prevent_dealloc(PAGE_PTR pgptr)
static void heap_clear_operation_context(HEAP_OPERATION_CONTEXT *context, HFID *hfid_p)
static int heap_insert_physical(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context)
void log_skip_logging(THREAD_ENTRY *thread_p, LOG_DATA_ADDR *addr)
struct or_partition OR_PARTITION
int heap_rv_redo_insert(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
HEAP_PAGE_VACUUM_STATUS heap_page_get_vacuum_status(THREAD_ENTRY *thread_p, PAGE_PTR heap_page)
SCAN_CODE heap_page_prev(THREAD_ENTRY *thread_p, const OID *class_oid, const HFID *hfid, VPID *prev_vpid, DB_VALUE **cache_pageinfo)
REGU_VARIABLE * func_regu
int heap_rv_mvcc_redo_delete_home(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define ER_LK_PAGE_TIMEOUT
LF_ENTRY_KEY_COPY_FUNC f_key_copy
int heap_get_mvcc_rec_header_from_overflow(PAGE_PTR ovf_page, MVCC_REC_HEADER *mvcc_header, RECDES *peek_recdes)
#define pthread_mutex_destroy(a)
static int heap_stats_del_bestspace_by_hfid(THREAD_ENTRY *thread_p, const HFID *hfid)
static HEAP_HFID_TABLE heap_Hfid_table_area
#define ER_LC_UNKNOWN_CLASSNAME
#define OR_MVCC_FLAG_MASK
int spage_check_slot_owner(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
#define HEAP_STATS_ENTRY_MHT_EST_SIZE
bool pgbuf_check_page_ptype(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, PAGE_TYPE ptype)
#define OR_ENABLE_BOUND_BIT(bitptr, element)
#define ER_SP_NOSPACE_IN_PAGE
#define OR_MVCC_INSERT_ID_OFFSET
int file_get_num_user_pages(THREAD_ENTRY *thread_p, const VFID *vfid, int *n_user_pages_out)
void heap_clean_get_context(THREAD_ENTRY *thread_p, HEAP_GET_CONTEXT *context)
static int heap_create_internal(THREAD_ENTRY *thread_p, HFID *hfid, const OID *class_oid, const bool reuse_oid)
#define PGBUF_WATCHER_RESET_RANK(w, rank)
DISK_ISVALID vacuum_check_not_vacuumed_recdes(THREAD_ENTRY *thread_p, OID *oid, OID *class_oid, RECDES *recdes, int btree_node_type)
SCAN_CODE heap_scan_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 prm_get_integer_value(PARAM_ID prm_id)
int heap_rv_mvcc_redo_redistribute(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
unsigned is_autoincrement
int heap_scanrange_start(THREAD_ENTRY *thread_p, HEAP_SCANRANGE *scan_range, const HFID *hfid, const OID *class_oid, MVCC_SNAPSHOT *mvcc_snapshot)
DISK_ISVALID heap_check_all_heaps(THREAD_ENTRY *thread_p)
OR_DEFAULT_VALUE default_value
#define OID_IS_ROOTOID(oidp)
#define heap_bestspace_log(...)
static int heap_update_physical(THREAD_ENTRY *thread_p, PAGE_PTR page_p, short slot_id, RECDES *recdes_p)
static int heap_attrinfo_get_disksize(HEAP_CACHE_ATTRINFO *attr_info, bool is_mvcc_class, int *offset_size_ptr)
static int heap_estimate_avg_length(THREAD_ENTRY *thread_p, const HFID *hfid, int &avg_reclen)
unsigned int record_length
int tp_domain_status_er_set(TP_DOMAIN_STATUS status, const char *file_name, const int line_no, const DB_VALUE *src, const TP_DOMAIN *domain)
static int heap_hfid_table_entry_init(void *unique_stat)
std::atomic< or_aligned_oid > serial_obj
static unsigned int heap_hfid_table_entry_key_hash(void *key, int hash_table_size)
LF_ENTRY_KEY_COMPARE_FUNC f_key_cmp
void heap_classrepr_dump_all(THREAD_ENTRY *thread_p, FILE *fp, OID *class_oid)
static void heap_link_watchers(HEAP_OPERATION_CONTEXT *child, HEAP_OPERATION_CONTEXT *parent)
BTID * heap_indexinfo_get_btid(int btid_index, HEAP_CACHE_ATTRINFO *attrinfo)
LC_FIND_CLASSNAME xlocator_find_class_oid(THREAD_ENTRY *thread_p, const char *classname, OID *class_oid, LOCK lock)
OR_ATTRIBUTE * heap_locate_last_attrepr(ATTR_ID attrid, HEAP_CACHE_ATTRINFO *attr_info)
void heap_rv_dump_reuse_page(FILE *fp, int ignore_length, void *ignore_data)
static int heap_fix_header_page(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context)
int file_apply_tde_algorithm(THREAD_ENTRY *thread_p, const VFID *vfid, const TDE_ALGORITHM tde_algo)
#define ER_IT_DATA_OVERFLOW
#define ER_OUT_OF_VIRTUAL_MEMORY
void LOG_CS_EXIT(THREAD_ENTRY *thread_p)
void log_append_undo_data(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int length, const void *data)
static int heap_reinitialize_page(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, const bool is_header_page)
int or_chn(RECDES *record)
DB_TYPE db_value_type(const DB_VALUE *value)
int orc_superclasses_from_record(RECDES *record, int *array_size, OID **array_ptr)
#define LF_ENTRY_DESCRIPTOR_INITIALIZER
int heap_get_class_name_alloc_if_diff(THREAD_ENTRY *thread_p, const OID *class_oid, char *guess_classname, char **classname_out)
#define OR_VALUE_ALIGNED_SIZE(value)
#define SINGLE_ROW_UPDATE
int heap_get_hfid_from_vfid(THREAD_ENTRY *thread_p, const VFID *vfid, HFID *hfid)
lf_tran_entry * thread_get_tran_entry(cubthread::entry *thread_p, int entry_idx)
#define ER_HF_MAX_BESTSPACE_ENTRIES
#define OR_GET_OID(ptr, oid)
SCAN_CODE heap_attrinfo_transform_to_disk(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, RECDES *old_recdes, record_descriptor *new_recdes)
#define OR_FIXED_ATTRIBUTES_OFFSET_BY_OBJ(obj, nvars)
#define pgbuf_replace_watcher(thread_p, old_watcher, new_watcher)
int fetch_peek_dbval(THREAD_ENTRY *thread_p, REGU_VARIABLE *regu_var, val_descr *vd, OID *class_oid, OID *obj_oid, QFILE_TUPLE tpl, DB_VALUE **peek_dbval)
#define ER_HEAP_WRONG_ATTRINFO
int or_put_int(OR_BUF *buf, int num)
int heap_update_logical(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context)
pthread_mutex_t bestspace_mutex
int intl_identifier_casecmp(const char *str1, const char *str2)
int numeric_db_value_coerce_from_num(DB_VALUE *src, DB_VALUE *dest, DB_DATA_STATUS *data_status)
#define DB_VALUE_DOMAIN_TYPE(value)
void spage_collect_statistics(PAGE_PTR page_p, int *npages, int *nrecords, int *rec_length)
bool oid_is_root(const OID *oid)
#define VACUUM_ER_LOG_HEAP
#define DB_MAX_IDENTIFIER_LENGTH
int or_mvcc_set_header(RECDES *record, MVCC_REC_HEADER *mvcc_rec_header)
void heap_create_update_context(HEAP_OPERATION_CONTEXT *context, HFID *hfid_p, OID *oid_p, OID *class_oid_p, RECDES *recdes_p, HEAP_SCANCACHE *scancache_p, UPDATE_INPLACE_STYLE in_place)
static OR_ATTRIBUTE * heap_locate_attribute(ATTR_ID attrid, HEAP_CACHE_ATTRINFO *attr_info)
int heap_manager_initialize(void)
THREAD_ENTRY * next_wait_thrd
LOG_PAGEID logical_pageid
static FILE_TYPE heap_get_file_type(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context)
void heap_create_insert_context(HEAP_OPERATION_CONTEXT *context, HFID *hfid_p, OID *class_oid_p, RECDES *recdes_p, HEAP_SCANCACHE *scancache_p)
bool heap_remove_page_on_vacuum(THREAD_ENTRY *thread_p, PAGE_PTR *page_ptr, HFID *hfid)
int spage_compact(THREAD_ENTRY *thread_p, PAGE_PTR page_p)
static int heap_chnguess_realloc(void)
#define TP_DOMAIN_COLLATION(dom)
int heap_rv_redo_update_and_update_chain(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define OR_HEADER_SIZE(ptr)
int or_put_bigint(OR_BUF *buf, DB_BIGINT num)
static int heap_chnguess_finalize(void)
void lock_unlock_object(THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock, bool force)
static enum scanner_mode mode
xasl_unpack_info * unpack_info
int heap_rv_redo_newpage(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define VPID_EQ(vpid_ptr1, vpid_ptr2)
HEAP_ATTRVALUE * heap_attrvalue_locate(ATTR_ID attrid, HEAP_CACHE_ATTRINFO *attr_info)
int heap_get_num_objects(THREAD_ENTRY *thread_p, const HFID *hfid, int *npages, int *nobjs, int *avg_length)
int spage_mark_deleted_slot_as_reusable(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
void reserve_area(size_t size=0)
#define HFID_SET_NULL(hfid)
HEAP_CLASSREPR_ENTRY * LRU_bottom
#define ER_ALTER_CHANGE_CAST_FAILED_SET_MAX
int stx_map_stream_to_func_pred(THREAD_ENTRY *thread_p, func_pred **xasl, char *xasl_stream, int xasl_stream_size, XASL_UNPACK_INFO **xasl_unpack_info_ptr)
#define ER_QPROC_SIZE_STRING_TRUNCATED
static int heap_ovf_flush(THREAD_ENTRY *thread_p, const OID *ovf_oid)
#define OID_EQ(oidp1, oidp2)
static const int heap_Find_best_page_limit
#define OR_MVCC_PREV_VERSION_LSA_SIZE
static int heap_get_partitions_from_subclasses(THREAD_ENTRY *thread_p, const OID *subclasses, int *parts_count, OR_PARTITION *partitions)
DB_VALUE * db_value_copy(DB_VALUE *value)
#define heap_classrepr_free_and_init(class_repr, idxp)
SCAN_CODE spage_get_page_header_info(PAGE_PTR page_p, DB_VALUE **page_header_info)
TP_DOMAIN_STATUS tp_value_cast(const DB_VALUE *src, DB_VALUE *dest, const TP_DOMAIN *desired_domain, bool implicit_coercion)
int heap_attrinfo_read_dbvalues(THREAD_ENTRY *thread_p, const OID *inst_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, HEAP_CACHE_ATTRINFO *attr_info)
int locator_attribute_info_force(THREAD_ENTRY *thread_p, const HFID *hfid, OID *oid, HEAP_CACHE_ATTRINFO *attr_info, ATTR_ID *att_id, int n_att_id, LC_COPYAREA_OPERATION operation, int op_type, HEAP_SCANCACHE *scan_cache, int *force_count, bool not_check_fk, REPL_INFO_TYPE repl_info, int pruning_type, PRUNING_CONTEXT *pcontext, FUNC_PRED_UNPACK_INFO *func_preds, MVCC_REEV_DATA *mvcc_reev_data, UPDATE_INPLACE_STYLE force_update_inplace, RECDES *rec_descriptor, bool need_locking)
int heap_alloc_new_page(THREAD_ENTRY *thread_p, HFID *hfid, OID class_oid, PGBUF_WATCHER *home_hint_p, VPID *new_page_vpid)
#define TP_DOMAIN_TYPE(dom)
int heap_insert_logical(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context, PGBUF_WATCHER *home_hint_p)
static void heap_mvcc_log_home_no_change(THREAD_ENTRY *thread_p, LOG_DATA_ADDR *p_addr)
int overflow_get_capacity(THREAD_ENTRY *thread_p, const VPID *ovf_vpid, int *ovf_size, int *ovf_num_pages, int *ovf_overhead, int *ovf_free_space)
MVCC_SATISFIES_SNAPSHOT_RESULT mvcc_is_not_deleted_for_snapshot(THREAD_ENTRY *thread_p, MVCC_REC_HEADER *rec_header, MVCC_SNAPSHOT *snapshot)
#define OR_MVCC_INSERT_HEADER_SIZE
static void cleanup(int signo)
int heap_estimate(THREAD_ENTRY *thread_p, const HFID *hfid, int *npages, int *nobjs, int *avg_length)
#define ER_HEAP_UNKNOWN_HEAP
void * mht_get(MHT_TABLE *ht, const void *key)
#define HEAP_HFID_HASH_SIZE
int or_put_offset_internal(OR_BUF *buf, int num, int offset_size)
#define heap_classrepr_log_stack(msg,...)
int heap_rv_postpone_append_pages_to_heap(THREAD_ENTRY *thread_p, LOG_RCV *recv)
int file_alloc(THREAD_ENTRY *thread_p, const VFID *vfid, FILE_INIT_PAGE_FUNC f_init, void *f_init_args, VPID *vpid_out, PAGE_PTR *page_out)
int db_string_truncate(DB_VALUE *value, const int precision)
static int heap_delete_relocation(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context, bool is_mvcc_op)
static int heap_midxkey_get_value(RECDES *recdes, OR_ATTRIBUTE *att, DB_VALUE *value, HEAP_CACHE_ATTRINFO *attr_info)
void log_append_undo_crumbs(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int num_crumbs, const LOG_CRUMB *crumbs)
int heap_attrinfo_clear_dbvalues(HEAP_CACHE_ATTRINFO *attr_info)
int lf_hash_find_or_insert(LF_TRAN_ENTRY *tran, LF_HASH_TABLE *table, void *key, void **entry, int *inserted)
PGNSLOTS spage_number_of_records(PAGE_PTR page_p)
#define MVCC_IS_FLAG_SET(rec_header_p, flags)
#define HEAP_LOG_MVCC_INSERT_MAX_REDO_CRUMBS
HEAP_CLASSREPR_LOCK * lock_table
#define OR_GET_VPID(ptr, vpid)
static int heap_attrinfo_recache(THREAD_ENTRY *thread_p, REPR_ID reprid, HEAP_CACHE_ATTRINFO *attr_info)
int heap_indexinfo_get_attrs_prefix_length(int btid_index, HEAP_CACHE_ATTRINFO *attrinfo, int *attrs_prefix_length, int len_attrs_prefix_length)
static int heap_classrepr_entry_free(HEAP_CLASSREPR_ENTRY *cache_entry)
const char * pr_type_name(DB_TYPE id)
#define HEAP_GUESS_NUM_ATTRS_REFOIDS
static int heap_delete_physical(THREAD_ENTRY *thread_p, HFID *hfid_p, PAGE_PTR page_p, OID *oid_p)
OR_CLASSREP ** or_get_all_representation(RECDES *record, bool do_indexes, int *count)
HEAP_SCANCACHE scan_cache
bool log_is_in_crash_recovery(void)
int heap_scancache_quick_start_with_class_oid(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, OID *class_oid)
DB_VALUE * heap_attrinfo_generate_key(THREAD_ENTRY *thread_p, int n_atts, int *att_ids, int *atts_prefix_length, HEAP_CACHE_ATTRINFO *attr_info, RECDES *recdes, DB_VALUE *db_valuep, char *buf, FUNCTION_INDEX_INFO *func_index_info, TP_DOMAIN *midxkey_domain)
int or_class_get_partition_info(RECDES *record, OR_PARTITION *partition_info, REPR_ID *repr_id, int *has_partition_info)
#define vacuum_er_log(er_log_level, msg,...)
#define HEAP_DEBUG_ISVALID_SCANRANGE(scan_range)
#define HEAP_STATS_PREV_BEST_INDEX(i)
bool LSA_ISNULL(const log_lsa *lsa_ptr)
LF_TRAN_SYSTEM hfid_table_Ts
#define LC_NEXT_ONEOBJ_PTR_IN_COPYAREA(oneobj_ptr)
#define OR_MVCC_DELETE_ID_OFFSET(mvcc_flags)
static int heap_stats_update_internal(THREAD_ENTRY *thread_p, const HFID *hfid, VPID *lotspace_vpid, int free_space)
void log_append_undoredo_recdes(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, const RECDES *undo_recdes, const RECDES *redo_recdes)
#define BEST_PAGE_SEARCH_MAX_COUNT
int heap_vpid_next(THREAD_ENTRY *thread_p, const HFID *hfid, PAGE_PTR pgptr, VPID *next_vpid)
#define BTID_SET_NULL(btid)
#define OR_OFFSET_SIZE_1BYTE
int file_create_heap(THREAD_ENTRY *thread_p, bool reuse_oid, const OID *class_oid, VFID *vfid)
int db_value_domain_max(DB_VALUE *value, const DB_TYPE type, const int precision, const int scale, const int codeset, const int collation_id, const DB_ENUMERATION *enumeration)
TP_DOMAIN * tp_domain_cache(TP_DOMAIN *transient)
LF_ENTRY_DUPLICATE_KEY_HANDLER f_duplicate
int db_seq_free(DB_SEQ *seq)
int heap_estimate_num_objects(THREAD_ENTRY *thread_p, const HFID *hfid)
#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)
static void heap_log_update_physical(THREAD_ENTRY *thread_p, PAGE_PTR page_p, VFID *vfid_p, OID *oid_p, RECDES *old_recdes_p, RECDES *new_recdes_p, LOG_RCVINDEX rcvindex)
void log_append_undoredo_data(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int undo_length, int redo_length, const void *undo_data, const void *redo_data)
int lf_freelist_init(LF_FREELIST *freelist, int initial_blocks, int block_size, LF_ENTRY_DESCRIPTOR *edesc, LF_TRAN_SYSTEM *tran_system)
#define pgbuf_fix(thread_p, vpid, fetch_mode, requestmode, condition)
void thread_lock_entry(cubthread::entry *thread_p)
#define HEAP_UPDATE_IS_MVCC_OP(is_mvcc_class, update_style)
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))
#define MVCC_ID_PRECEDES(id1, id2)
#define HEAP_PAGE_GET_VACUUM_STATUS(chain)
const char * get_buffer() const
void log_append_undo_recdes(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, const RECDES *recdes)
#define HEAP_LOG_MVCC_REDISTRIBUTE_MAX_REDO_CRUMBS
DISK_ISVALID disk_is_page_sector_reserved(THREAD_ENTRY *thread_p, VOLID volid, PAGEID pageid)
static int heap_get_partition_attributes(THREAD_ENTRY *thread_p, const OID *cls_oid, ATTR_ID *type_id, ATTR_ID *values_id)
#define db_private_free(thrd, ptr)
void or_init(OR_BUF *buf, char *data, int length)
static int heap_compare_vpid(const void *key_vpid1, const void *key_vpid2)
int heap_rv_update_chain_after_mvcc_op(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
unsigned int oid_hash(const void *key_oid, unsigned int htsize)
#define MVCC_REC_HEADER_INITIALIZER
STATIC_INLINE int heap_copy_chain(THREAD_ENTRY *thread_p, PAGE_PTR page_heap, HEAP_CHAIN *chain) __attribute__((ALWAYS_INLINE))
static int heap_attrinfo_set_uninitialized(THREAD_ENTRY *thread_p, OID *inst_oid, RECDES *recdes, HEAP_CACHE_ATTRINFO *attr_info)
#define db_private_alloc(thrd, size)
SCAN_CODE spage_next_record_dont_skip_empty(PAGE_PTR page_p, PGSLOTID *out_slot_id_p, RECDES *record_descriptor_p, int is_peeking)
PGBUF_WATCHER page_watcher
static OID * heap_ovf_insert(THREAD_ENTRY *thread_p, const HFID *hfid, OID *ovf_oid, RECDES *recdes)
PGSLOTID spage_find_free_slot(PAGE_PTR page_p, SPAGE_SLOT **out_slot_p, PGSLOTID start_slot)
const OID * heap_ovf_delete(THREAD_ENTRY *thread_p, const HFID *hfid, const OID *ovf_oid, VFID *ovf_vfid_p)
#define BIG_VAR_OFFSET_SIZE
need_clear_type need_clear
bool logtb_set_check_interrupt(THREAD_ENTRY *thread_p, bool flag)
#define CEIL_PTVDIV(dividend, divisor)
static int heap_scancache_reset_modify(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, const HFID *hfid, const OID *class_oid)
HEAP_CLASSREPR_ENTRY * hash_next
int heap_rv_redo_delete(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int db_set_size(DB_SET *set)
OR_CLASSREP * heap_classrepr_get(THREAD_ENTRY *thread_p, const OID *class_oid, RECDES *class_recdes, REPR_ID reprid, int *idx_incache)
void er_set_with_oserror(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
void heap_attrinfo_dump(THREAD_ENTRY *thread_p, FILE *fp, HEAP_CACHE_ATTRINFO *attr_info, bool dump_schema)
LC_COPYAREA_ONEOBJ ** obj
VFID * heap_ovf_find_vfid(THREAD_ENTRY *thread_p, const HFID *hfid, VFID *ovf_vfid, bool docreate, PGBUF_LATCH_CONDITION latch_cond)
int count(int &result, const cub_regex_object ®, const std::string &src, const int position, const INTL_CODESET codeset)
#define IO_DEFAULT_PAGE_SIZE
int pr_clear_value(DB_VALUE *value)
static HEAP_CHNGUESS * heap_Guesschn
void heap_scanrange_end(THREAD_ENTRY *thread_p, HEAP_SCANRANGE *scan_range)
SCAN_CODE heap_scanrange_to_following(THREAD_ENTRY *thread_p, HEAP_SCANRANGE *scan_range, OID *start_oid)
DB_BIGINT db_get_bigint(const DB_VALUE *value)
int heap_scan_cache_allocate_area(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache_p, int size)
char home_recdes_buffer[IO_MAX_PAGE_SIZE+MAX_ALIGNMENT]
#define HFID_AS_ARGS(hfid)
void pgbuf_get_vpid(PAGE_PTR pgptr, VPID *vpid)
#define HEAP_NBYTES_TO_NBITS(byte_cnt)
int db_value_domain_default(DB_VALUE *value, const DB_TYPE type, const int precision, const int scale, const int codeset, const int collation_id, DB_ENUMERATION *enumeration)
static unsigned int heap_hash_vpid(const void *key_vpid, unsigned int htsize)
#define VFID_COPY(vfid_ptr1, vfid_ptr2)
pthread_mutex_t free_mutex
int heap_rv_redo_mark_reusable_slot(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
const char * file_type_to_string(FILE_TYPE fstruct_type)
#define LF_FREELIST_INITIALIZER
void log_sysop_abort(THREAD_ENTRY *thread_p)
#define MVCC_SET_FLAG_BITS(rec_header_p, flag)
int heap_vacuum_all_objects(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *upd_scancache, MVCCID threshold_mvccid)
void heap_chnguess_clear(THREAD_ENTRY *thread_p, int tran_index)
SCAN_CODE heap_first(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, OID *oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking)
#define ER_ALTER_CHANGE_CAST_FAILED_SET_MIN
struct db_domain_info::general_info general_info
static bool heap_delete_all_page_records(THREAD_ENTRY *thread_p, const VPID *vpid, PAGE_PTR pgptr)
HEAP_CLASSREPR_ENTRY * next
void heap_create_delete_context(HEAP_OPERATION_CONTEXT *context, HFID *hfid_p, OID *oid_p, OID *class_oid_p, HEAP_SCANCACHE *scancache_p)
int oid_compare_equals(const void *key_oid1, const void *key_oid2)
#define HEAP_NBITS_TO_NBYTES(bit_cnt)
#define OR_CLEAR_BOUND_BIT(bitptr, element)
static const HFID * heap_reuse(THREAD_ENTRY *thread_p, const HFID *hfid, const OID *class_oid, const bool reuse_oid)
OR_CLASSREP * or_get_classrep(RECDES *record, int repid)
MVCCID logtb_get_current_mvccid(THREAD_ENTRY *thread_p)
static int heap_eval_function_index(THREAD_ENTRY *thread_p, FUNCTION_INDEX_INFO *func_index_info, int n_atts, int *att_ids, HEAP_CACHE_ATTRINFO *attr_info, RECDES *recdes, int btid_index, DB_VALUE *result, FUNC_PRED_UNPACK_INFO *func_pred, TP_DOMAIN **fi_domain)
#define OR_VAR_LENGTH(length, obj, index, n_variables)
DB_ENUMERATION enumeration
#define TP_IS_CHAR_TYPE(typeid)
PGNSLOTS spage_number_of_slots(PAGE_PTR page_p)
TP_DOMAIN_COLL_ACTION collation_flag
void free_xasl_unpack_info(THREAD_ENTRY *thread_p, REFPTR(XASL_UNPACK_INFO, xasl_unpack_info))
int heap_get_index_with_name(THREAD_ENTRY *thread_p, OID *class_oid, const char *index_name, BTID *btid)
static DB_MIDXKEY * heap_midxkey_key_generate(THREAD_ENTRY *thread_p, RECDES *recdes, DB_MIDXKEY *midxkey, int *att_ids, HEAP_CACHE_ATTRINFO *attrinfo, DB_VALUE *func_res, int func_col_id, int func_attr_index_start, TP_DOMAIN *midxkey_domain)
int heap_rv_redo_reuse_page_reuse_oid(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int file_descriptor_dump(THREAD_ENTRY *thread_p, const VFID *vfid, FILE *fp)
int heap_classrepr_decache(THREAD_ENTRY *thread_p, const OID *class_oid)
static void error(const char *msg)
LF_ENTRY_HASH_FUNC f_hash
int file_init_page_type(THREAD_ENTRY *thread_p, PAGE_PTR page, void *args)
void log_append_postpone(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int length, const void *data)
#define VPID_ISNULL(vpid_ptr)
#define HEAP_MVCC_SET_HEADER_MAXIMUM_SIZE(mvcc_rec_header_p)
#define ER_SP_INVALID_HEADER
int heap_chnguess_get(THREAD_ENTRY *thread_p, const OID *oid, int tran_index)
int heap_classrepr_find_index_id(OR_CLASSREP *classrepr, const BTID *btid)
void log_append_undo_recdes2(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, const VFID *vfid, PAGE_PTR pgptr, PGLENGTH offset, const RECDES *recdes)
int heap_prefetch(THREAD_ENTRY *thread_p, OID *class_oid, const OID *oid, LC_COPYAREA_DESC *prefetch)
int xheap_destroy(THREAD_ENTRY *thread_p, const HFID *hfid, const OID *class_oid)
STATIC_INLINE void perfmon_inc_stat(THREAD_ENTRY *thread_p, PERF_STAT_ID psid) __attribute__((ALWAYS_INLINE))
int heap_get_btid_from_index_name(THREAD_ENTRY *thread_p, const OID *p_class_oid, const char *index_name, BTID *p_found_btid)
void file_postpone_destroy(THREAD_ENTRY *thread_p, const VFID *vfid)
#define pthread_mutex_unlock(a)
TP_DOMAIN * tp_domain_construct(DB_TYPE domain_type, DB_OBJECT *class_obj, int precision, int scale, TP_DOMAIN *setdomain)
int heap_set_mvcc_rec_header_on_overflow(PAGE_PTR ovf_page, MVCC_REC_HEADER *mvcc_header)
PGBUF_WATCHER forward_page_watcher
LOG_TDES * LOG_FIND_CURRENT_TDES(THREAD_ENTRY *thread_p=NULL)
PGSLOTID spage_delete(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
SCAN_CODE heap_get_class_oid(THREAD_ENTRY *thread_p, const OID *oid, OID *class_oid)
int db_make_midxkey(DB_VALUE *value, DB_MIDXKEY *midxkey)
static int heap_add_chain_links(THREAD_ENTRY *thread_p, const HFID *hfid, const VPID *vpid, const VPID *next_link, const VPID *prev_link, PGBUF_WATCHER *page_watcher, bool keep_page_fixed, bool is_page_watcher_inited)
struct func_pred * func_pred
#define LOG_FIND_THREAD_TRAN_INDEX(thrd)
int heap_classrepr_free(OR_CLASSREP *classrep, int *idx_incache)
void overflow_flush(THREAD_ENTRY *thread_p, const VPID *ovf_vpid)
#define MVCC_GET_FLAG(header)
#define HFID_IS_NULL(hfid)
#define ER_PB_UNEXPECTED_PAGE_REFIX
bool db_value_is_null(const DB_VALUE *value)
char * or_class_name(RECDES *record)
static DISK_ISVALID heap_chkreloc_start(HEAP_CHKALL_RELOCOIDS *chk)
static int heap_compare_hfid(const void *key_hfid1, const void *key_hfid2)
static int heap_hfid_table_entry_key_copy(void *src, void *dest)
#define OR_FIXED_ATT_IS_UNBOUND(obj, nvars, fsize, position)
STATIC_INLINE HEAP_HDR_STATS * heap_get_header_stats_ptr(THREAD_ENTRY *thread_p, PAGE_PTR page_header) __attribute__((ALWAYS_INLINE))
bool is_recdes_assigned_to_area(const RECDES &recdes) const
static int heap_attrvalue_read(RECDES *recdes, HEAP_ATTRVALUE *value, HEAP_CACHE_ATTRINFO *attr_info)
std::atomic< char * > classname
VOLID pgbuf_get_volume_id(PAGE_PTR pgptr)
#define HEAP_PERF_START(thread_p, context)
LF_ENTRY_ALLOC_FUNC f_alloc
#define HEAP_DROP_FREE_SPACE
int pr_clone_value(const DB_VALUE *src, DB_VALUE *dest)
static bool heap_is_reusable_oid(const FILE_TYPE file_type)
int heap_rv_mvcc_undo_delete(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int heap_rv_redo_update(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int heap_rv_mvcc_redo_delete_overflow(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
OID * db_get_oid(const DB_VALUE *value)
int log_add_to_modified_class_list(THREAD_ENTRY *thread_p, const char *classname, const OID *class_oid)
#define ER_HEAP_UNKNOWN_ATTRS
void heap_init_get_context(THREAD_ENTRY *thread_p, HEAP_GET_CONTEXT *context, const OID *oid, OID *class_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking, int old_chn)
#define ER_ALTER_CHANGE_TRUNC_OVERFLOW_NOT_ALLOWED
int logpb_prior_lsa_append_all_list(THREAD_ENTRY *thread_p)
float prm_get_float_value(PARAM_ID prm_id)
static int heap_chnguess_remove_entry(const void *oid_key, void *ent, void *xignore)
const void * mht_put_new(MHT_TABLE *ht, const void *key, void *data)
int heap_delete_logical(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context)
static int heap_stats_del_bestspace_by_vpid(THREAD_ENTRY *thread_p, VPID *vpid)
#define OR_PUT_HFID(ptr, hfid)
#define VACUUM_LOG_ADD_DROPPED_FILE_POSTPONE
unsigned int offset_to_record
#define BTREE_IS_MULTI_ROW_OP(op)
static int heap_mark_class_as_modified(THREAD_ENTRY *thread_p, OID *oid_p, int chn, bool decache)
MVCC_SNAPSHOT * mvcc_snapshot
unsigned int mht_count(const MHT_TABLE *ht)
int er_errid_if_has_error(void)
#define pthread_mutex_init(a, b)
static int heap_stats_entry_free(THREAD_ENTRY *thread_p, void *data, void *args)
PGBUF_WATCHER * home_page_watcher_p
static int heap_stats_get_min_freespace(HEAP_HDR_STATS *heap_hdr)
#define MVCC_SET_REPID(header, rep_id)
int xheap_create(THREAD_ENTRY *thread_p, HFID *hfid, const OID *class_oid, bool reuse_oid)
static int heap_update_relocation(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context, bool is_mvcc_op)
bool vacuum_is_mvccid_vacuumed(MVCCID id)
void db_fprint_value(FILE *fp, const db_value *value)
static int heap_get_last_page(THREAD_ENTRY *thread_p, const HFID *hfid, HEAP_HDR_STATS *heap_hdr, HEAP_SCANCACHE *scan_cache, VPID *last_vpid, PGBUF_WATCHER *pg_watcher)
#define free_and_init(ptr)
int heap_scancache_quick_start_with_class_hfid(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, const HFID *hfid)
bool heap_attrinfo_check_unique_index(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, ATTR_ID *att_id, int n_att_id)
#define DB_ALIGN(offset, align)
static int heap_Maxslotted_reclength
#define BTID_COPY(btid_ptr1, btid_ptr2)
SCAN_CODE spage_previous_record(PAGE_PTR page_p, PGSLOTID *out_slot_id_p, RECDES *record_descriptor_p, int is_peeking)
#define HEAP_BIT_CLEAR(byte_ptr, bit_num)
int or_get_attrname(RECDES *record, int attrid, char **string, int *alloced_string)
int heap_initialize_hfid_table(void)
#define OR_GET_MVCC_FLAG(ptr)
static DB_MIDXKEY * heap_midxkey_key_get(RECDES *recdes, DB_MIDXKEY *midxkey, OR_INDEX *index, HEAP_CACHE_ATTRINFO *attrinfo, DB_VALUE *func_res, TP_DOMAIN *func_domain, TP_DOMAIN **key_domain)
#define HEAP_CHKRELOC_UNFOUND_SHORT
void heap_dump(THREAD_ENTRY *thread_p, FILE *fp, HFID *hfid, bool dump_records)
#define MVCC_SET_CHN(header, chn_)
static int heap_class_get_partition_info(THREAD_ENTRY *thread_p, const OID *class_oid, OR_PARTITION *partition_info, HFID *class_hfid, REPR_ID *repr_id, int *has_partition_info)
void LSA_SET_NULL(log_lsa *lsa_ptr)
static int heap_classrepr_entry_reset(HEAP_CLASSREPR_ENTRY *cache_entry)
#define OR_VAR_TABLE_SIZE_INTERNAL(vars, offset_size)
bool pgbuf_is_page_fixed_by_thread(THREAD_ENTRY *thread_p, const VPID *vpid_p)
int heap_get_class_partitions(THREAD_ENTRY *thread_p, const OID *class_oid, OR_PARTITION **parts, int *parts_count)
DISK_ISVALID heap_check_heap_file(THREAD_ENTRY *thread_p, HFID *hfid)
int heap_attrinfo_start_with_btid(THREAD_ENTRY *thread_p, OID *class_oid, BTID *btid, HEAP_CACHE_ATTRINFO *attr_info)
static int heap_scancache_quick_start_internal(HEAP_SCANCACHE *scan_cache, const HFID *hfid)
#define ER_FILE_NOT_ENOUGH_PAGES_IN_DATABASE
static int heap_update_adjust_recdes_header(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *update_context, bool is_mvcc_class)
#define OR_GET_MVCC_CHN(ptr)
PGBUF_WATCHER * header_page_watcher_p
static int heap_update_bigone(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context, bool is_mvcc_op)
int db_make_string_copy(DB_VALUE *value, DB_CONST_C_CHAR str)
static int heap_find_location_and_insert_rec_newhome(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context)
#define ER_HEAP_UNKNOWN_OBJECT
#define MVCC_GET_DELID(header)
void lf_freelist_destroy(LF_FREELIST *freelist)
static int heap_stats_get_second_best(HEAP_HDR_STATS *heap_hdr, VPID *vpid)
PGBUF_WATCHER header_page_watcher
int mht_rem2(MHT_TABLE *ht, const void *key, const void *data, int(*rem_func)(const void *key, void *data, void *args), void *func_args)
void pgbuf_set_page_ptype(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, PAGE_TYPE ptype)
bool heap_is_page_header(THREAD_ENTRY *thread_p, PAGE_PTR page)
bool prm_get_bool_value(PARAM_ID prm_id)
#define QSTR_IS_ANY_CHAR_OR_BIT(s)
#define HFID_EQ(hfid_ptr1, hfid_ptr2)
int orc_subclasses_from_record(RECDES *record, int *array_size, OID **array_ptr)
int heap_rv_mvcc_undo_delete_overflow(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define HEAP_BIT_GET(byte_ptr, bit_num)
int spage_get_free_space_without_saving(THREAD_ENTRY *thread_p, PAGE_PTR page_p, bool *need_update)
#define OR_PUT_INT(ptr, val)
static void * heap_hfid_table_entry_alloc(void)
DISK_ISVALID vacuum_check_not_vacuumed_rec_header(THREAD_ENTRY *thread_p, OID *oid, OID *class_oid, MVCC_REC_HEADER *rec_header, int btree_node_type)
#define OR_NON_MVCC_HEADER_SIZE
int db_get_string_size(const DB_VALUE *value)
SCAN_CODE heap_prev(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, OID *next_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking)
DB_C_SHORT db_get_short(const DB_VALUE *value)
HEAP_CACHE_ATTRINFO * cache_attrinfo
int file_rv_tracker_mark_heap_deleted(THREAD_ENTRY *thread_p, LOG_RCV *rcv, bool is_undo)
#define HEAP_PERF_TRACK_LOGGING(thread_p, context)
SCAN_CODE heap_attrinfo_transform_to_disk_except_lob(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, RECDES *old_recdes, record_descriptor *new_recdes)
unsigned page_was_unfixed
static int heap_hfid_table_entry_free(void *unique_stat)
void log_sysop_attach_to_outer(THREAD_ENTRY *thread_p)
static VPID * heap_vpid_remove(THREAD_ENTRY *thread_p, const HFID *hfid, HEAP_HDR_STATS *heap_hdr, VPID *rm_vpid)
#define REPR_HASH(class_oid)
std::size_t thread_num_total_threads(void)
void log_sysop_commit(THREAD_ENTRY *thread_p)
static int heap_delete_home(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context, bool is_mvcc_op)
int or_put_data(OR_BUF *buf, const char *data, int length)
SCAN_CODE spage_next_record(PAGE_PTR page_p, PGSLOTID *out_slot_id_p, RECDES *record_descriptor_p, int is_peeking)
#define DISK_VPID_ALIGNED_SIZE
#define OR_GET_MVCC_REPID_AND_FLAG(ptr)
STATIC_INLINE int heap_get_last_vpid(THREAD_ENTRY *thread_p, const HFID *hfid, VPID *last_vpid) __attribute__((ALWAYS_INLINE))
static int heap_get_class_subclasses(THREAD_ENTRY *thread_p, const OID *class_oid, int *count, OID **subclasses)
const cubmem::block_allocator & get_area_block_allocator()
#define DB_VALUE_TYPE(value)
static unsigned int heap_hash_hfid(const void *key_hfid, unsigned int htsize)
static int heap_delete_bigone(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context, bool is_mvcc_op)
void heap_flush(THREAD_ENTRY *thread_p, const OID *oid)
#define PGBUF_ORDERED_NULL_HFID
STATIC_INLINE int heap_copy_header_stats(THREAD_ENTRY *thread_p, PAGE_PTR page_header, HEAP_HDR_STATS *header_stats) __attribute__((ALWAYS_INLINE))
int mht_map(const MHT_TABLE *ht, int(*map_func)(const void *key, void *data, void *args), void *func_args)
void heap_rv_dump_append_pages_to_heap(FILE *fp, int length, void *data)
int db_make_null(DB_VALUE *value)
int spage_get_free_space(THREAD_ENTRY *thread_p, PAGE_PTR page_p)
static PAGE_PTR heap_scan_pb_lock_and_fetch_debug(THREAD_ENTRY *thread_p, const VPID *vpid_ptr, PAGE_FETCH_MODE fetch_mode, LOCK lock, HEAP_SCANCACHE *scan_cache, PGBUF_WATCHER *pg_watcher, const char *caller_file, const int caller_line)
#define OR_OFFSET_SIZE_FLAG
#define DB_IS_NULL(value)
int heap_assign_address(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, OID *oid, int expected_length)
void resize_buffer(std::size_t size)
#define OR_GET_OFFSET_SIZE(ptr)
static SCAN_CODE heap_get_record_info(THREAD_ENTRY *thread_p, const OID oid, RECDES *recdes, RECDES forward_recdes, PGBUF_WATCHER *page_watcher, HEAP_SCANCACHE *scan_cache, bool ispeeking, DB_VALUE **record_info)
static void heap_mvcc_log_redistribute(THREAD_ENTRY *thread_p, RECDES *p_recdes, LOG_DATA_ADDR *p_addr)
static HEAP_FINDSPACE heap_stats_find_page_in_bestspace(THREAD_ENTRY *thread_p, const HFID *hfid, HEAP_BESTSPACE *bestspace, int *idx_badspace, int record_length, int needed_space, HEAP_SCANCACHE *scan_cache, PGBUF_WATCHER *pg_watcher)
int spage_slot_size(void)
static SCAN_CODE heap_get_if_diff_chn(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, INT16 slotid, RECDES *recdes, bool ispeeking, int chn, MVCC_SNAPSHOT *mvcc_snapshot)
bool heap_should_try_update_stat(const int current_freespace, const int prev_freespace)
int vacuum_rv_check_at_undo(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, INT16 slotid, INT16 rec_type)
#define HEAP_SET_RECORD(recdes, record_area_size, record_length, record_type, record_data)
char * strdup(const char *str)
int heap_delete_hfid_from_cache(THREAD_ENTRY *thread_p, OID *class_oid)
HEAP_CLASSREPR_ENTRY * LRU_top
MVCC_SNAPSHOT_FUNC snapshot_fnc
int lf_hash_delete(LF_TRAN_ENTRY *tran, LF_HASH_TABLE *table, void *key, int *success)
int lock_has_lock_on_object(const OID *oid, const OID *class_oid, LOCK lock)
bool heap_is_big_length(int length)
static int heap_scancache_add_partition_node(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, OID *partition_oid)
int heap_rv_undoredo_pagehdr(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
HEAP_SCANCACHE_NODE_LIST * next
int heap_indexinfo_get_attrids(int btid_index, HEAP_CACHE_ATTRINFO *attrinfo, ATTR_ID *attrids)
SCAN_CODE heap_header_next_scan(THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
static SCAN_CODE heap_ovf_get(THREAD_ENTRY *thread_p, const OID *ovf_oid, RECDES *recdes, int chn, MVCC_SNAPSHOT *mvcc_snapshot)
static int heap_hfid_cache_get(THREAD_ENTRY *thread_p, const OID *class_oid, HFID *hfid, FILE_TYPE *ftype_out, char **classname_out)
int setval(DB_VALUE *dest, const DB_VALUE *src, bool copy) const
int db_make_int(DB_VALUE *value, const int num)
int db_get_string_length(const DB_VALUE *value)
void heap_attrinfo_end(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info)
bool pgbuf_has_any_waiters(PAGE_PTR pgptr)
static SCAN_CODE heap_attrinfo_transform_to_disk_internal(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, RECDES *old_recdes, record_descriptor *new_recdes, int lob_create_flag)
int heap_init_func_pred_unpack_info(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, const OID *class_oid, FUNC_PRED_UNPACK_INFO **func_indx_preds)
int heap_rv_nop(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
void log_sysop_end_logical_run_postpone(THREAD_ENTRY *thread_p, LOG_LSA *posp_lsa)
HEAP_SCANCACHE * scan_cache
void thread_wakeup(cubthread::entry *thread_p, thread_resume_suspend_status resume_reason)
int heap_scancache_quick_start(HEAP_SCANCACHE *scan_cache)
int db_make_oid(DB_VALUE *value, const OID *oid)
#define VPID_GET_FROM_OID(vpid_ptr, oid_ptr)
#define OR_BOUND_BIT_FLAG
int heap_get_class_supers(THREAD_ENTRY *thread_p, const OID *class_oid, OID **super_oids, int *count)
struct heap_hdr_stats HEAP_HDR_STATS
static void heap_mvcc_log_home_change_on_delete(THREAD_ENTRY *thread_p, RECDES *old_recdes, RECDES *new_recdes, LOG_DATA_ADDR *p_addr)
#define MVCC_SET_FLAG(header, flag)
LC_COPYAREA_MANYOBJS * mobjs
static HEAP_CLASSREPR_ENTRY * heap_classrepr_entry_alloc(void)
enum mvcc_satisfies_snapshot_result MVCC_SATISFIES_SNAPSHOT_RESULT
#define OR_PUT_BIGINT(ptr, val)
static void heap_build_forwarding_recdes(RECDES *recdes_p, INT16 rec_type, OID *forward_oid)
static int heap_scancache_force_modify(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
#define HEAP_DEBUG_SCANCACHE_INITPATTERN
FILE_OVF_HEAP_DES heap_overflow
SCAN_CODE heap_next(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, OID *next_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking)
int heap_indexinfo_get_num_attrs(int btid_index, HEAP_CACHE_ATTRINFO *attrinfo)
#define TP_DOMAIN_CODESET(dom)
pthread_mutex_t LRU_mutex
static int heap_hfid_table_entry_key_compare(void *k1, void *k2)
INT16 spage_get_record_type(PAGE_PTR page_p, PGSLOTID slot_id)
int heap_header_capacity_end_scan(THREAD_ENTRY *thread_p, void **ptr)
static char * heap_bestspace_to_string(char *buf, int buf_size, const HEAP_BESTSPACE *hb)
static HEAP_STATS_ENTRY * heap_stats_add_bestspace(THREAD_ENTRY *thread_p, const HFID *hfid, VPID *vpid, int freespace)
int qexec_clear_func_pred(THREAD_ENTRY *thread_p, func_pred *fpr)
int heap_get_indexinfo_of_btid(THREAD_ENTRY *thread_p, const OID *class_oid, const BTID *btid, BTREE_TYPE *type, int *num_attrs, ATTR_ID **attr_ids, int **attrs_prefix_length, char **btnamepp, int *func_index_col_id)
#define pthread_mutex_lock(a)
enum update_inplace_style UPDATE_INPLACE_STYLE
char * oid_to_string(char *buf, int buf_size, OID *oid)
int heap_attrinfo_set(const OID *inst_oid, ATTR_ID attrid, DB_VALUE *attr_val, HEAP_CACHE_ATTRINFO *attr_info)
int heap_rv_undo_delete(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int heap_get_class_info(THREAD_ENTRY *thread_p, const OID *class_oid, HFID *hfid_out, FILE_TYPE *ftype_out, char **classname_out)
OR_ATTRIBUTE * attributes
THREAD_ENTRY * next_wait_thrd
void heap_clear_partition_info(THREAD_ENTRY *thread_p, OR_PARTITION *parts, int parts_count)
int or_pad(OR_BUF *buf, int length)
#define pgbuf_ordered_unfix(thread_p, watcher_object)
char * vfid_to_string(char *buf, int buf_size, VFID *vfid)
#define MVCC_CLEAR_ALL_FLAG_BITS(rec_header_p)
static int heap_classrepr_decache_guessed_last(const OID *class_oid)
PGBUF_LATCH_MODE latch_mode
#define HEAP_PERF_TRACK_EXECUTE(thread_p, context)
int heap_nonheader_page_capacity()
static int heap_get_spage_type(void)
int heap_rv_mvcc_redo_insert(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int heap_rv_undoredo_update(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int overflow_get_length(THREAD_ENTRY *thread_p, const VPID *ovf_vpid)
bool heap_is_object_not_null(THREAD_ENTRY *thread_p, OID *class_oid, const OID *oid)
int heap_rv_undo_insert(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int heap_get_class_name(THREAD_ENTRY *thread_p, const OID *class_oid, char **class_name)
#define db_private_realloc(thrd, ptr, size)
static int heap_fix_forward_page(THREAD_ENTRY *thread_p, HEAP_OPERATION_CONTEXT *context, OID *forward_oid_hint)
int overflow_insert(THREAD_ENTRY *thread_p, const VFID *ovf_vfid, VPID *ovf_vpid, RECDES *recdes, FILE_TYPE file_type)
#define pgbuf_ordered_unfix_and_init(thread_p, page, pg_watcher)
#define VPID_SET_NULL(vpid_ptr)
static void heap_scancache_block_deallocate(cubmem::block &b)
int qdata_increment_dbval(DB_VALUE *dbval_p, DB_VALUE *result_p, int inc_val)
int xheap_reclaim_addresses(THREAD_ENTRY *thread_p, const HFID *hfid)
int heap_rv_undo_ovf_update(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define HEAP_CHNGUESS_FUDGE_MININDICES
SCAN_CODE heap_get_visible_version_internal(THREAD_ENTRY *thread_p, HEAP_GET_CONTEXT *context, bool is_heap_scan)
static int heap_classrepr_entry_remove_from_LRU(HEAP_CLASSREPR_ENTRY *cache_entry)
struct heap_classrepr_lock HEAP_CLASSREPR_LOCK
static int heap_scancache_end_internal(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache, bool scan_state)
bool btree_is_unique_type(BTREE_TYPE type)
HEAP_CLASSREPR_FREE_LIST free_list
#define PGBUF_PAGE_STATE_ARGS(pg)
HEAP_CLASSREPR_ENTRY * prev
int heap_get_referenced_by(THREAD_ENTRY *thread_p, OID *class_oid, const OID *obj_oid, RECDES *recdes, int *max_oid_cnt, OID **oid_list)
int heap_compact_pages(THREAD_ENTRY *thread_p, OID *class_oid)
#define PGBUF_INIT_WATCHER(w, rank, hfid)
#define HFID_COPY(hfid_ptr1, hfid_ptr2)
#define ER_HEAP_BAD_OBJECT_TYPE
SCAN_CODE log_get_undo_record(THREAD_ENTRY *thread_p, LOG_PAGE *log_page_p, LOG_LSA process_lsa, RECDES *recdes)
#define VACUUM_LOG_ADD_DROPPED_FILE_UNDO
#define VFID_SET_NULL(vfid_ptr)
void tp_domain_free(TP_DOMAIN *dom)
DB_CONST_C_CHAR db_get_string(const DB_VALUE *value)
VPID * pgbuf_get_vpid_ptr(PAGE_PTR pgptr)
PERF_UTIME_TRACKER * time_track
UPDATE_INPLACE_STYLE update_in_place
int or_advance(OR_BUF *buf, int offset)
static SCAN_CODE heap_get_page_info(THREAD_ENTRY *thread_p, const OID *cls_oid, const HFID *hfid, const VPID *vpid, const PAGE_PTR pgptr, DB_VALUE **page_info)
#define OR_BUF_INIT2(buf, data, size)
void heap_stats_update(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, const HFID *hfid, int prev_freespace)
#define HEAP_IS_UPDATE_INPLACE(update_inplace_style)
int spage_insert_at(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, RECDES *record_descriptor_p)
int heap_set_autoincrement_value(THREAD_ENTRY *thread_p, HEAP_CACHE_ATTRINFO *attr_info, HEAP_SCANCACHE *scan_cache, int *is_set)
void heap_free_func_pred_unpack_info(THREAD_ENTRY *thread_p, int n_indexes, FUNC_PRED_UNPACK_INFO *func_indx_preds, int *attr_info_started)
int heap_rv_mvcc_redo_delete_newhome(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define HEAP_STATS_NEXT_BEST_INDEX(i)
#define HEAP_ISVALID_OID(thread_p, oid)
static int fill_string_to_buffer(char **start, char *end, const char *str)
#define ER_MVCC_NOT_SATISFIED_REEVALUATION
HEAP_CLASSREPR_LRU_LIST LRU_list
const VPID * overflow_delete(THREAD_ENTRY *thread_p, const VFID *ovf_vfid, const VPID *ovf_vpid)
SCAN_CODE overflow_get_nbytes(THREAD_ENTRY *thread_p, const VPID *ovf_vpid, RECDES *recdes, int start_offset, int max_nbytes, int *remaining_length, MVCC_SNAPSHOT *mvcc_snapshot)
int spage_insert_for_recovery(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, RECDES *record_descriptor_p)
static DISK_ISVALID heap_check_all_pages_by_heapchain(THREAD_ENTRY *thread_p, HFID *hfid, HEAP_CHKALL_RELOCOIDS *chk_objs, INT32 *num_checked)
int db_value_domain_init(DB_VALUE *value, const DB_TYPE type, const int precision, const int scale)
SCAN_CODE heap_prev_record_info(THREAD_ENTRY *thread_p, const HFID *hfid, OID *class_oid, OID *next_oid, RECDES *recdes, HEAP_SCANCACHE *scan_cache, int ispeeking, DB_VALUE **cache_recordinfo)
#define TP_DOMAIN_COLLATION_FLAG(dom)
SCAN_CODE heap_page_next(THREAD_ENTRY *thread_p, const OID *class_oid, const HFID *hfid, VPID *next_vpid, DB_VALUE **cache_pageinfo)
int file_map_pages(THREAD_ENTRY *thread_p, const VFID *vfid, PGBUF_LATCH_MODE latch_mode, PGBUF_LATCH_CONDITION latch_cond, FILE_MAP_PAGE_FUNC func, void *args)
static HEAP_HFID_TABLE * heap_Hfid_table
static void heap_mvcc_log_insert(THREAD_ENTRY *thread_p, RECDES *p_recdes, LOG_DATA_ADDR *p_addr)
LF_ENTRY_DESCRIPTOR hfid_hash_descriptor
SCAN_CODE heap_get_class_record(THREAD_ENTRY *thread_p, const OID *class_oid, RECDES *recdes_p, HEAP_SCANCACHE *scan_cache, int ispeeking)
static int heap_get_header_page(THREAD_ENTRY *thread_p, const HFID *hfid, VPID *header_vpid)