48 #if !defined(SERVER_MODE) 49 #define pthread_mutex_init(a, b) 50 #define pthread_mutex_destroy(a) 51 #define pthread_mutex_lock(a) 0 52 #define pthread_mutex_trylock(a) 0 53 #define pthread_mutex_unlock(a) 57 #define CATALOG_HEADER_SLOT 0 58 #define CATALOG_MAX_SLOT_ID_SIZE 12 59 #define CATALOG_HASH_SIZE 1000 60 #define CATALOG_KEY_VALUE_ARRAY_SIZE 1000 62 #define CATALOG_PGHEADER_OVFL_PGID_PAGEID_OFF 0 63 #define CATALOG_PGHEADER_OVFL_PGID_VOLID_OFF 4 64 #define CATALOG_PGHEADER_DIR_CNT_OFF 8 65 #define CATALOG_PGHEADER_PG_OVFL_OFF 12 67 #define CATALOG_PAGE_HEADER_SIZE 16 70 #define CATALOG_GET_PGHEADER_OVFL_PGID_PAGEID(ptr) \ 71 (PAGEID) OR_GET_INT ((ptr) + CATALOG_PGHEADER_OVFL_PGID_PAGEID_OFF) 73 #define CATALOG_GET_PGHEADER_OVFL_PGID_VOLID(ptr) \ 74 (VOLID) OR_GET_SHORT ((ptr) + CATALOG_PGHEADER_OVFL_PGID_VOLID_OFF) 76 #define CATALOG_GET_PGHEADER_DIR_COUNT(ptr) \ 77 (int) OR_GET_INT ((ptr) + CATALOG_PGHEADER_DIR_CNT_OFF) 79 #define CATALOG_GET_PGHEADER_PG_OVFL(ptr) \ 80 (bool) OR_GET_INT ((ptr) + CATALOG_PGHEADER_PG_OVFL_OFF) 83 #define CATALOG_PUT_PGHEADER_OVFL_PGID_PAGEID(ptr,val) \ 84 OR_PUT_INT ((ptr) + CATALOG_PGHEADER_OVFL_PGID_PAGEID_OFF, (val)) 86 #define CATALOG_PUT_PGHEADER_OVFL_PGID_VOLID(ptr,val) \ 87 OR_PUT_SHORT ((ptr) + CATALOG_PGHEADER_OVFL_PGID_VOLID_OFF, (val)) 89 #define CATALOG_PUT_PGHEADER_DIR_COUNT(ptr,val) \ 90 OR_PUT_INT ((ptr) + CATALOG_PGHEADER_DIR_CNT_OFF, (val)) 92 #define CATALOG_PUT_PGHEADER_PG_OVFL(ptr,val) \ 93 OR_PUT_INT ((ptr) + CATALOG_PGHEADER_PG_OVFL_OFF, (int) (val)) 96 #define CATALOG_DISK_REPR_ID_OFF 0 97 #define CATALOG_DISK_REPR_N_FIXED_OFF 4 98 #define CATALOG_DISK_REPR_FIXED_LENGTH_OFF 8 99 #define CATALOG_DISK_REPR_N_VARIABLE_OFF 12 100 #define CATALOG_DISK_REPR_RESERVED_1_OFF 16 101 #define CATALOG_DISK_REPR_SIZE 56 107 #define CATALOG_DISK_ATTR_ID_OFF 0 108 #define CATALOG_DISK_ATTR_LOCATION_OFF 4 109 #define CATALOG_DISK_ATTR_TYPE_OFF 8 110 #define CATALOG_DISK_ATTR_VAL_LENGTH_OFF 12 111 #define CATALOG_DISK_ATTR_POSITION_OFF 16 112 #define CATALOG_DISK_ATTR_CLASSOID_OFF 20 113 #define CATALOG_DISK_ATTR_N_BTSTATS_OFF 28 114 #define CATALOG_DISK_ATTR_SIZE 80 116 #define CATALOG_BT_STATS_BTID_OFF 0 117 #define CATALOG_BT_STATS_LEAFS_OFF OR_BTID_ALIGNED_SIZE 118 #define CATALOG_BT_STATS_PAGES_OFF 16 119 #define CATALOG_BT_STATS_HEIGHT_OFF 20 120 #define CATALOG_BT_STATS_KEYS_OFF 24 121 #define CATALOG_BT_STATS_FUNC_INDEX_OFF 28 122 #define CATALOG_BT_STATS_PKEYS_OFF 32 123 #define CATALOG_BT_STATS_RESERVED_OFF (CATALOG_BT_STATS_PKEYS_OFF + (OR_INT_SIZE * BTREE_STATS_PKEYS_NUM)) 124 #define CATALOG_BT_STATS_SIZE (CATALOG_BT_STATS_RESERVED_OFF + (OR_INT_SIZE * BTREE_STATS_RESERVED_NUM)) 126 #define CATALOG_GET_BT_STATS_BTID(var, ptr) \ 127 OR_GET_BTID((ptr) + CATALOG_BT_STATS_BTID_OFF, (var)) 129 #define CATALOG_CLS_INFO_HFID_OFF 0 130 #define CATALOG_CLS_INFO_TOT_PAGES_OFF 12 131 #define CATALOG_CLS_INFO_TOT_OBJS_OFF 16 132 #define CATALOG_CLS_INFO_TIME_STAMP_OFF 20 133 #define CATALOG_CLS_INFO_REP_DIR_OFF 24 134 #define CATALOG_CLS_INFO_SIZE 56 135 #define CATALOG_CLS_INFO_RESERVED 24 137 #define CATALOG_REPR_ITEM_PAGEID_PAGEID_OFF 0 138 #define CATALOG_REPR_ITEM_PAGEID_VOLID_OFF 4 139 #define CATALOG_REPR_ITEM_REPRID_OFF 8 140 #define CATALOG_REPR_ITEM_SLOTID_OFF 10 141 #define CATALOG_REPR_ITEM_COUNT_OFF 12 143 #define CATALOG_REPR_ITEM_SIZE 16 145 #define CATALOG_GET_REPR_ITEM_PAGEID_PAGEID(ptr) \ 146 (PAGEID) OR_GET_INT ((ptr) + CATALOG_REPR_ITEM_PAGEID_PAGEID_OFF) 148 #define CATALOG_GET_REPR_ITEM_PAGEID_VOLID(ptr) \ 149 (VOLID) OR_GET_SHORT ((ptr) + CATALOG_REPR_ITEM_PAGEID_VOLID_OFF) 151 #define CATALOG_GET_REPR_ITEM_REPRID(ptr) \ 152 (REPR_ID) OR_GET_SHORT ((ptr) + CATALOG_REPR_ITEM_REPRID_OFF) 154 #define CATALOG_GET_REPR_ITEM_SLOTID(ptr) \ 155 (PGSLOTID) OR_GET_SHORT ((ptr) + CATALOG_REPR_ITEM_SLOTID_OFF) 157 #define CATALOG_GET_REPR_ITEM_COUNT(ptr) \ 158 (PGSLOTID) OR_GET_BYTE ((ptr) + CATALOG_REPR_ITEM_COUNT_OFF) 257 #define CATALOG_REPR_ITEM_INITIALIZER \ 258 { { NULL_PAGEID, NULL_VOLID }, NULL_REPRID, NULL_SLOTID } 286 #if defined (SA_MODE) 287 typedef struct catalog_page_collector CATALOG_PAGE_COLLECTOR;
288 struct catalog_page_collector
336 OID * rep_dir_p,
int *out_repr_count_p,
345 BTREE_STATS * pre_btree_stats_p,
int pre_btree_stats_count);
357 #if defined (ENABLE_UNUSED_FUNCTION) 358 static int catalog_fixup_missing_disk_representation (
THREAD_ENTRY * thread_p,
OID * class_oid,
REPR_ID reprid);
359 static int catalog_fixup_missing_class_info (
THREAD_ENTRY * thread_p,
OID * class_oid);
379 #if defined (SA_MODE) 380 static int catalog_file_map_is_empty (
THREAD_ENTRY * thread_p,
PAGE_PTR * page,
bool * stop,
void *args);
567 else if (space > catalog_Max_space.
max_space)
603 bool is_overflow_page = *(
bool *) args;
617 success =
spage_insert (thread_p, page, &record, &slot_id);
743 bool can_use =
false;
838 for (k = 0; k < attr_cnt; k++)
840 attr_p = ((k < repr_p->
n_fixed)
906 if (class_id_p ==
NULL)
914 class_id_p->
next = *
p;
931 if (class_id_list ==
NULL)
936 for (p = class_id_list;
p; p = next)
942 class_id_list =
NULL;
1003 if (src_k ==
NULL || dest_k ==
NULL)
1060 unsigned int hash_res;
1063 ((((k1)->slot_id | ((k1)->page_id << 8)) ^ (((k1)->page_id >> 8) | (((
PAGEID) (k1)->volid) << 24))) + k1->
repr_id);
1065 return (hash_res % hash_table_size);
1099 *remembered_slot_id_p = catalog_record_p->
slotid;
1109 catalog_record_p->
slotid = *remembered_slot_id_p;
1115 if (new_page_p ==
NULL)
1129 &catalog_record_p->
recdes);
1141 &catalog_record_p->
recdes);
1147 catalog_record_p->
page_p = new_page_p;
1150 catalog_record_p->
offset = 0;
1157 PGSLOTID * remembered_slot_id_p,
int format_size)
1251 while (offset < length)
1257 bufsize = length - offset;
1258 (void) memcpy (catalog_record_p->
recdes.
data + catalog_record_p->
offset, (
char *) value + offset, bufsize);
1259 catalog_record_p->
offset += bufsize;
1269 (void) memcpy (catalog_record_p->
recdes.
data, (
char *) value + offset, bufsize);
1325 if (catalog_record_p->
page_p)
1335 catalog_record_p->
slotid = 1;
1345 catalog_record_p->
page_p =
1361 catalog_record_p->
offset = 0;
1447 while (offset < length)
1453 bufsize = length - offset;
1454 (void) memcpy ((
char *) value + offset, catalog_record_p->
recdes.
data + catalog_record_p->
offset, bufsize);
1455 catalog_record_p->
offset += bufsize;
1466 (void) memcpy ((
char *) value + offset, catalog_record_p->
recdes.
data, bufsize);
1504 btree_stats_p->
leafs = 0;
1505 btree_stats_p->
pages = 0;
1506 btree_stats_p->
height = 0;
1507 btree_stats_p->
keys = 0;
1524 if (root_page_p ==
NULL)
1532 if (root_header ==
NULL)
1565 for (i = 0; i < btree_stats_p->
pkeys_size; i++)
1567 btree_stats_p->
pkeys[
i] = 0;
1582 VPID overflow_vpid, new_overflow_vpid;
1606 if (
spage_delete (thread_p, page_p, slot_id) != slot_id)
1642 if (overflow_page_p == NULL)
1661 overflow_vpid = new_overflow_vpid;
1722 same_page =
VPID_EQ (page_id_p, dir_page_id_p) ?
true :
false;
1726 page_p = *dir_page_p;
1730 int again_count = 0;
1748 if ((*dir_page_p) ==
NULL)
1753 if ((*dir_page_p) ==
NULL)
1758 if (again_count++ >= again_max)
1810 assert (class_oid_p != NULL);
1812 assert (rep_dir_p != NULL);
1880 int is_peek,
int *out_repr_count_p)
1913 assert (*out_repr_count_p == 1 || *out_repr_count_p == 2);
1921 int *out_repr_count_p,
bool lookup_hash)
1967 catalog_key.
repr_id = repr_id;
1969 (void) catalog_Hashmap.
erase (thread_p, catalog_key);
1983 *out_position_p = position;
1984 assert (*out_position_p <= 2);
2030 rep_dir_p->
slotid = slot_id;
2068 char *aligned_page_header_data;
2072 int repr_pos, repr_count;
2076 assert (rep_dir_p != NULL);
2120 if (repr_pos < repr_count)
2154 assert (repr_count == 1);
2255 int repr_pos, repr_count;
2266 catalog_value_p = catalog_Hashmap.
find (thread_p, catalog_key);
2267 if (catalog_value_p !=
NULL)
2275 catalog_Hashmap.
unlock (thread_p, catalog_value_p);
2286 &repr_count,
false );
2294 if (repr_pos == repr_count)
2312 catalog_Hashmap.
find_or_insert (thread_p, catalog_key, catalog_value_p);
2313 if (catalog_value_p !=
NULL)
2315 catalog_Hashmap.
unlock (thread_p, catalog_value_p);
2321 #if defined(CT_DEBUG) 2323 "catalog_get_representation_item: Insertion to hash table failed.\n " 2324 "Key: Class_Id: { %d , %d , %d } Repr: %d", class_id_p->
pageid, class_id_p->
volid,
2367 char *repr_p, *next_p;
2368 int repr_pos, repr_count;
2383 &repr_count,
true );
2392 if (repr_pos >= repr_count)
2408 assert (repr_count == 2);
2460 BTREE_STATS * pre_btree_stats_p,
int pre_btree_stats_count)
2465 for (i = 0, new_stats_p = new_btree_stats_p; i < new_btree_stats_count; i++, new_stats_p++)
2467 for (j = 0, pre_stats_p = pre_btree_stats_p; j < pre_btree_stats_count; j++, pre_stats_p++)
2474 new_stats_p->
btid = pre_stats_p->
btid;
2478 new_stats_p->
keys = pre_stats_p->
keys;
2483 for (k = 0; k < new_stats_p->
pkeys_size; k++)
2485 new_stats_p->
pkeys[k] = pre_stats_p->
pkeys[k];
2490 new_stats_p->reserved[k] = pre_stats_p->reserved[k];
2505 for (i = 0, new_attr_p = new_attrs_p; i < new_attr_count; i++, new_attr_p++)
2507 for (j = 0, pre_attr_p = pre_attrs_p; j < pre_attr_count; j++, pre_attr_p++)
2509 if (new_attr_p->
id != pre_attr_p->
id)
2589 VPID first_page_vpid;
2591 bool is_overflow_page =
false;
2608 &first_page_vpid, &page_p) !=
NO_ERROR)
2640 return catalog_id_p;
2648 #if defined (SA_MODE) 2662 CATALOG_PAGE_COLLECTOR *collector = (CATALOG_PAGE_COLLECTOR *) args;
2683 #if defined (SA_MODE) 2684 CATALOG_PAGE_COLLECTOR collector;
2706 collector.vpids = (
VPID *) malloc (n_pages *
sizeof (
VPID));
2707 if (collector.vpids ==
NULL)
2712 collector.n_vpids = 0;
2720 free (collector.vpids);
2724 for (iter_vpid = 0; iter_vpid < collector.n_vpids; iter_vpid++)
2730 free (collector.vpids);
2734 free (collector.vpids);
2745 for (i = 0, disk_attrp = attrs_p; i <
count; i++, disk_attrp++)
2749 for (j = 0; j < disk_attrp->
n_btstats; j++)
2787 bool do_end_access =
false;
2808 if (catalog_access_info_p ==
NULL)
2810 do_end_access =
true;
2817 catalog_access_info.
class_oid = class_id_p;
2818 catalog_access_info.
dir_oid = &dir_oid;
2824 catalog_access_info_p = &catalog_access_info;
2856 catalog_record.
page_p = page_p;
2861 catalog_record.
offset = 0;
2879 if (i < disk_repr_p->n_fixed)
2881 disk_attr_p = &disk_repr_p->
fixed[
i];
2913 for (j = 0; j < disk_attr_p->
n_btstats; j++)
2915 btree_stats_p = &disk_attr_p->
bt_stats[j];
2997 bool do_end_access =
false;
2999 assert (class_info_p != NULL);
3013 if (catalog_access_info_p == NULL)
3015 do_end_access =
true;
3022 catalog_access_info.
class_oid = class_id_p;
3023 catalog_access_info.
dir_oid = &dir_oid;
3029 catalog_access_info_p = &catalog_access_info;
3138 bool do_end_access =
false;
3140 assert (class_info_p != NULL);
3143 if (catalog_access_info_p == NULL)
3145 do_end_access =
true;
3151 catalog_access_info.
class_oid = class_id_p;
3152 catalog_access_info.
dir_oid = &dir_oid;
3157 catalog_access_info_p = &catalog_access_info;
3188 #if defined(CT_DEBUG) 3191 "no class information record found in catalog.\n" 3192 "possibly catalog index points to a non_existent disk repr.\n");
3202 if (skip_logging !=
true)
3220 if (skip_logging !=
true)
3225 if (skip_logging ==
true)
3228 addr.
pgptr = page_p;
3239 return class_info_p;
3268 catalog_access_info.
class_oid = class_id_p;
3269 catalog_access_info.
dir_oid = &dir_oid;
3332 &rep_dir, &repr_count,
true );
3341 repr_p = record.
data;
3419 catalog_access_info.
class_oid = class_id_p;
3420 catalog_access_info.
dir_oid = &dir_oid;
3429 &rep_dir, &repr_count,
true );
3437 repr_p = record.
data;
3501 char *repr_p, *last_repr_p;
3532 catalog_access_info.
class_oid = class_id_p;
3533 catalog_access_info.
dir_oid = &dir_oid;
3542 &rep_dir, &repr_count,
true );
3550 repr_p = record.
data;
3571 is_any_dropped =
false;
3595 is_any_dropped =
true;
3685 rep_dir_p, &repr_count,
true );
3696 assert (repr_count == 1 || repr_count == 2);
3707 #if defined (ENABLE_UNUSED_FUNCTION) 3727 if (disk_repr_p ==
NULL)
3794 for (i = 0; i < n_btstats; i++)
3796 btree_stats_p = &disk_attr_p->
bt_stats[
i];
3801 for (i = 0; i < n_btstats; i++)
3803 btree_stats_p = &disk_attr_p->
bt_stats[
i];
3858 bool do_end_access =
false;
3862 if (catalog_access_info_p ==
NULL)
3869 catalog_access_info.
class_oid = class_id_p;
3870 catalog_access_info.
dir_oid = &dir_oid;
3875 do_end_access =
true;
3876 catalog_access_info_p = &catalog_access_info;
3909 catalog_record.
offset = 0;
3920 memset (disk_repr_p, 0,
sizeof (
DISK_REPR));
3929 if (catalog_record.
page_p)
3948 if (!disk_repr_p->
fixed)
3955 for (i = 0; i < disk_repr_p->
n_fixed; i++)
3957 disk_attr_p = &disk_repr_p->
fixed[
i];
3978 for (i = 0; i < disk_repr_p->
n_variable; i++)
3980 disk_attr_p = &disk_repr_p->
variable[
i];
3991 for (i = 0; i < disk_repr_p->
n_fixed; i++)
3999 for (i = 0; i < disk_repr_p->
n_variable; i++)
4009 if (catalog_record.
page_p)
4032 #if defined (ENABLE_UNUSED_FUNCTION) 4034 catalog_fixup_missing_class_info (
THREAD_ENTRY * thread_p,
OID * class_oid_p)
4101 bool do_end_access =
false;
4109 if (catalog_access_info_p == NULL)
4116 catalog_access_info.
class_oid = class_id_p;
4117 catalog_access_info.
dir_oid = &dir_oid;
4122 do_end_access =
true;
4123 catalog_access_info_p = &catalog_access_info;
4152 #if defined(CT_DEBUG) 4159 "no class information record found in catalog.\n" 4160 "possibly catalog index points to a non_existent disk repr.\n");
4170 if ((catalog_fixup_missing_class_info (thread_p, class_id_p) ==
NO_ERROR) && retry++ == 0)
4191 if (class_info_p == NULL)
4212 return class_info_p;
4247 &rep_dir, &item_count,
true );
4254 *repr_count_p = item_count;
4255 buf_size = *repr_count_p *
sizeof (
REPR_ID);
4256 *repr_id_set_p = (
REPR_ID *) malloc (buf_size);
4257 if (*repr_id_set_p ==
NULL)
4265 repr_set_p = *repr_id_set_p;
4308 &rep_dir, &item_count,
true );
4360 if (disk_repr_p ==
NULL)
4381 if (class_info_p ==
NULL)
4420 REPR_ID current_repr_id, new_repr_id;
4438 if (disk_repr_p ==
NULL)
4453 if (old_repr_p ==
NULL)
4473 err =
catalog_drop (thread_p, class_oid_p, current_repr_id);
4494 if (class_info_p ==
NULL)
4625 if (repr_page_p ==
NULL)
4677 #if !defined(NDEBUG) 4678 char *classname =
NULL;
4684 if (mvcc_snapshot ==
NULL)
4710 #if !defined(NDEBUG) 4721 "Skipping checking catalog for class %d|%d|%d because conditional lock failed. \n",
4758 const char *prefix =
"";
4760 fprintf (stdout,
"\n");
4761 fprintf (stdout,
"Attribute Information: \n\n ");
4762 fprintf (stdout,
"Id: %d \n", attr_p->
id);
4763 fprintf (stdout,
" Type: ");
4765 switch (attr_p->
type)
4768 fprintf (stdout,
"DB_TYPE_INTEGER \n");
4771 fprintf (stdout,
"DB_TYPE_BIGINT \n");
4774 fprintf (stdout,
"DB_TYPE_FLOAT \n");
4777 fprintf (stdout,
"DB_TYPE_DOUBLE \n");
4780 fprintf (stdout,
"DB_TYPE_STRING \n");
4783 fprintf (stdout,
"DB_TYPE_OBJECT \n");
4786 fprintf (stdout,
"DB_TYPE_SET \n");
4789 fprintf (stdout,
"DB_TYPE_MULTISET \n");
4792 fprintf (stdout,
"DB_TYPE_SEQUENCE \n");
4795 fprintf (stdout,
"DB_TYPE_TIME \n");
4798 fprintf (stdout,
"DB_TYPE_MONETARY \n");
4801 fprintf (stdout,
"DB_TYPE_DATE \n");
4804 fprintf (stdout,
"DB_TYPE_BLOB \n");
4807 fprintf (stdout,
"DB_TYPE_CLOB \n");
4810 fprintf (stdout,
"DB_TYPE_VARIABLE \n");
4813 fprintf (stdout,
"DB_TYPE_SUB \n");
4816 fprintf (stdout,
"DB_TYPE_POINTER \n");
4819 fprintf (stdout,
"DB_TYPE_NULL \n");
4822 fprintf (stdout,
"DB_TYPE_JSON \n");
4828 fprintf (stdout,
" Location: %d \n", attr_p->
location);
4831 fprintf (stdout,
" Source Position: %d \n", attr_p->
position);
4832 fprintf (stdout,
" Def. Value Length: %d \n", attr_p->
val_length);
4836 value_p = (
char *) attr_p->
value;
4837 fprintf (stdout,
" Value: ");
4839 for (k = 0; k < attr_p->
val_length; k++, value_p++)
4841 fprintf (stdout,
"%02X ", (
unsigned char) (*value_p));
4843 fprintf (stdout,
" \n");
4846 fprintf (stdout,
" BTree statistics:\n");
4852 fprintf (stdout,
" Cardinality: %d (", bt_statsp->
keys);
4858 fprintf (stdout,
"%s%d", prefix, bt_statsp->
pkeys[i]);
4862 fprintf (stdout,
") ,");
4863 fprintf (stdout,
" Total Pages: %d , Leaf Pages: %d , Height: %d\n", bt_statsp->
pages, bt_statsp->
leafs,
4867 fprintf (stdout,
"\n");
4881 if (disk_repr_p !=
NULL)
4883 fprintf (stdout,
" DISK REPRESENTATION: \n\n");
4884 fprintf (stdout,
" Repr_Id : %d N_Fixed : %d Fixed_Length : %d N_Variable : %d\n\n", disk_repr_p->
id,
4887 fprintf (stdout,
" Fixed Attribute Representations : \n\n");
4888 attr_p = disk_repr_p->
fixed;
4889 for (i = 0; i < disk_repr_p->
n_fixed; i++, attr_p++)
4894 fprintf (stdout,
" Variable Attribute Representations : \n\n");
4896 for (i = 0; i < disk_repr_p->
n_variable; i++, attr_p++)
4924 fprintf (context->
fp,
"\n-----------------------------------------------\n");
4925 fprintf (context->
fp,
"\n Page %d \n", context->
page_index);
4949 int *overflow_count = (
int *) args;
4959 (*overflow_count)++;
4977 #if !defined(NDEBUG) 4978 char *classname =
NULL;
4983 REPR_ID *repr_id_set, *repr_id_p;
4987 int n, overflow_count;
4991 fprintf (fp,
"\n <<<<< C A T A L O G D U M P >>>>> \n\n");
4993 fprintf (fp,
"\n Catalog Dump: \n\n");
4996 if (mvcc_snapshot ==
NULL)
5020 #if !defined(NDEBUG) 5026 fprintf (fp,
" -------------------------------------------------\n");
5027 fprintf (fp,
" CLASS_ID: { %d , %d , %d } \n", class_oid.
volid, class_oid.
pageid, class_oid.
slotid);
5031 fprintf (fp,
" Repr_cnt: %d \n", repr_count);
5034 repr_id_p = repr_id_set;
5035 for (repr_id_p += repr_count - 1; repr_count; repr_id_p--, repr_count--)
5042 fprintf (fp,
" Repr_id: %d\n", *repr_id_p);
5049 if (class_info_p !=
NULL)
5051 fprintf (fp,
" Class Specific Information: \n\n");
5052 fprintf (fp,
" HFID: { vfid = { %d , %d }, hpgid = %d }\n", class_info_p->
ci_hfid.
vfid.
fileid,
5055 fprintf (fp,
" Total Pages in Heap: %d\n", class_info_p->
ci_tot_pages);
5056 fprintf (fp,
" Total Objects: %d\n", class_info_p->
ci_tot_objects);
5058 fprintf (fp,
" Representation directory OID: { %d , %d , %d } \n", class_info_p->
ci_rep_dir.
volid,
5067 repr_id_p = repr_id_set;
5068 for (repr_id_p += repr_count - 1; repr_count; repr_id_p--, repr_count--)
5076 if (disk_repr_p ==
NULL)
5085 if (repr_id_set !=
NULL)
5102 fprintf (fp,
"\n Catalog Directory Dump: \n\n");
5109 fprintf (fp,
"Total Pages Count: %d\n\n", n);
5119 fprintf (fp,
"Regular Pages Count: %d\n\n", n - overflow_count);
5120 fprintf (fp,
"Overflow Pages Count: %d\n\n", overflow_count);
5122 page_dump_context.
fp = fp;
5136 catalog_Hashmap.
clear (thread_p);
5193 slot_id = recv_p->
offset;
5197 record.
type = *(INT16 *) (recv_p->
data);
5226 slot_id = recv_p->
offset;
5245 slot_id = recv_p->
offset;
5277 bool is_btree_found;
5279 bool free_disk_rep =
false;
5290 int subcls_idx_cache;
5293 bool is_subcls_attr_found =
false;
5294 bool free_cls_rep =
false;
5315 catalog_access_info.
class_oid = class_oid;
5316 catalog_access_info.
dir_oid = &dir_oid;
5333 if (disk_repr_p ==
NULL)
5340 free_disk_rep =
true;
5344 if (cls_rep ==
NULL)
5350 free_cls_rep =
true;
5355 is_btree_found =
false;
5357 for (att_cnt = 0, disk_attr_p = disk_repr_p->
fixed; att_cnt < disk_repr_p->n_fixed; att_cnt++, disk_attr_p++)
5360 for (idx_cnt = 0, curr_stat_info = disk_attr_p->
bt_stats; idx_cnt < disk_attr_p->n_btstats;
5361 idx_cnt++, curr_stat_info++)
5363 curr_bitd = curr_stat_info->
btid;
5366 p_stat_info = curr_stat_info;
5367 is_btree_found =
true;
5377 if (!is_btree_found)
5381 for (att_cnt = 0, disk_attr_p = disk_repr_p->
variable; att_cnt < disk_repr_p->n_variable;
5382 att_cnt++, disk_attr_p++)
5385 for (idx_cnt = 0, curr_stat_info = disk_attr_p->
bt_stats; idx_cnt < disk_attr_p->n_btstats;
5386 idx_cnt++, curr_stat_info++)
5388 curr_bitd = curr_stat_info->
btid;
5391 p_stat_info = curr_stat_info;
5392 is_btree_found =
true;
5403 if (!is_btree_found)
5427 if (key_pos >= key_size || key_pos < 0)
5441 *cardinality = p_stat_info->
keys;
5446 for (i = 0; i <
count; i++)
5449 if (subcls_info !=
NULL)
5453 if (subcls_disk_rep !=
NULL)
5457 if (subcls_rep !=
NULL)
5467 catalog_access_info.
class_oid = &partitions[
i];
5468 catalog_access_info.
dir_oid = &dir_oid;
5477 if (subcls_info ==
NULL)
5492 if (subcls_disk_rep ==
NULL)
5501 if (subcls_rep ==
NULL)
5507 is_subcls_attr_found =
false;
5508 for (att_cnt = 0, subcls_attr = subcls_disk_rep->
fixed; att_cnt < subcls_disk_rep->n_fixed;
5509 att_cnt++, subcls_attr++)
5511 if (disk_attr_p->
id == subcls_attr->
id)
5513 is_subcls_attr_found =
true;
5517 if (!is_subcls_attr_found)
5519 for (att_cnt = 0, subcls_attr = subcls_disk_rep->
variable; att_cnt < subcls_disk_rep->n_variable;
5520 att_cnt++, subcls_attr++)
5522 if (disk_attr_p->
id == subcls_attr->
id)
5524 is_subcls_attr_found =
true;
5530 if (!is_subcls_attr_found)
5537 if (subcls_stats ==
NULL)
5543 *cardinality = *cardinality + subcls_stats->
keys;
5556 if (subcls_info !=
NULL)
5560 if (subcls_disk_rep !=
NULL)
5564 if (subcls_rep !=
NULL)
5568 if (partitions !=
NULL)
5590 const int key_pos,
int *cardinality)
5675 slot_id = recv_p->
offset;
5679 record.
type = *(INT16 *) (recv_p->
data);
5723 assert (dir_oid_p != NULL);
5731 catalog_value_p = catalog_Hashmap.
find (thread_p, catalog_key);
5732 if (catalog_value_p != NULL)
5740 catalog_Hashmap.
unlock (thread_p, catalog_value_p);
5777 (void) catalog_Hashmap.
find_or_insert (thread_p, catalog_key, catalog_value_p);
5778 if (catalog_value_p != NULL)
5780 catalog_Hashmap.
unlock (thread_p, catalog_value_p);
5801 #if defined (SERVER_MODE) 5806 OID virtual_class_dir_oid;
5823 catalog_access_info->
is_update = (lock_mode ==
X_LOCK) ?
true :
false;
5828 #if !defined (NDEBUG) 5834 #if defined (SERVER_MODE) 5851 lk_grant_code =
lock_object (thread_p, catalog_access_info->
dir_oid, &virtual_class_dir_oid, lock_mode,
5878 #if !defined (NDEBUG) 5907 OID virtual_class_dir_oid;
5915 #if !defined (NDEBUG) 5923 if (catalog_access_info->
is_update ==
true)
5931 #if defined (SERVER_MODE) 5948 #if !defined (NDEBUG) 5952 #if !defined (NDEBUG)
#define ER_PAGE_LATCH_ABORTED
#define PGBUF_PAGE_VPID_AS_ARGS(pg)
#define OR_GET_HFID(ptr, hfid)
#define OR_PUT_OID(ptr, oid)
#define CATALOG_DISK_ATTR_N_BTSTATS_OFF
#define CATALOG_DISK_REPR_RESERVED_1_OFF
#define CATALOG_CLS_INFO_REP_DIR_OFF
CLS_INFO * catalog_get_class_info(THREAD_ENTRY *thread_p, OID *class_id_p, CATALOG_ACCESS_INFO *catalog_access_info_p)
#define ER_CT_MISSING_REPR_INFO
int or_rep_id(RECDES *record)
static int catalog_fetch_attribute_value(THREAD_ENTRY *thread_p, void *value, int length, CATALOG_RECORD *ct_recordp)
MVCC_SNAPSHOT * logtb_get_mvcc_snapshot(THREAD_ENTRY *thread_p)
#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)
#define BTREE_STATS_RESERVED_NUM
static int catalog_sum_disk_attribute_size(DISK_ATTR *attrs_p, int count)
int catalog_reclaim_space(THREAD_ENTRY *thread_p)
#define BO_IS_SERVER_RESTARTED()
int catalog_delete(THREAD_ENTRY *thread_p, OID *class_oid_p)
static void catalog_update_max_space(VPID *page_id, PGLENGTH space)
static int catalog_put_record_into_page(THREAD_ENTRY *thread_p, CATALOG_RECORD *ct_recordp, int next, PGSLOTID *remembered_slotid)
int file_dealloc(THREAD_ENTRY *thread_p, const VFID *vfid, const VPID *vpid, FILE_TYPE file_type_hint)
#define CATALOG_DISK_REPR_N_FIXED_OFF
int spage_insert(THREAD_ENTRY *thread_p, PAGE_PTR page_p, RECDES *record_descriptor_p, PGSLOTID *out_slot_id_p)
#define CATALOG_CLS_INFO_RESERVED
#define CATALOG_BT_STATS_RESERVED_OFF
void unlock(cubthread::entry *thread_p, T *&t)
void recdes_set_data_area(RECDES *rec, char *data, int size)
#define CATALOG_BT_STATS_FUNC_INDEX_OFF
#define VPID_COPY(dest_ptr, src_ptr)
#define CATALOG_GET_REPR_ITEM_COUNT(ptr)
CLS_INFO * catalog_update_class_info(THREAD_ENTRY *thread_p, OID *class_id_p, CLS_INFO *class_info_p, CATALOG_ACCESS_INFO *catalog_access_info_p, bool skip_logging)
#define ER_HEAP_NODATA_NEWADDRESS
static int catalog_assign_attribute(THREAD_ENTRY *thread_p, DISK_ATTR *disk_attr_p, CATALOG_RECORD *catalog_record_p)
#define pthread_mutex_unlock(a)
static int catalog_drop_disk_representation_from_page(THREAD_ENTRY *thread_p, VPID *page_id, PGSLOTID slot_id)
BTREE_ROOT_HEADER * btree_get_root_header(THREAD_ENTRY *thread_p, PAGE_PTR page_ptr)
void spage_initialize(THREAD_ENTRY *thread_p, PAGE_PTR page_p, INT16 slot_type, unsigned short alignment, bool is_saving)
int partition_get_partition_oids(THREAD_ENTRY *thread_p, const OID *class_oid, OID **partition_oids, int *count)
static void * catalog_entry_alloc(void)
DISK_ISVALID file_check_vpid(THREAD_ENTRY *thread_p, const VFID *vfid, const VPID *vpid_lookup)
int catalog_add_class_info(THREAD_ENTRY *thread_p, OID *class_id_p, CLS_INFO *class_info_p, CATALOG_ACCESS_INFO *catalog_access_info_p)
struct tp_domain * setdomain
#define CATALOG_GET_PGHEADER_DIR_COUNT(ptr)
static void catalog_free_key_list(CATALOG_CLASS_ID_LIST *clsid_list)
#define SAFEGUARD_RVSPACE
#define ER_CT_UNKNOWN_REPRID
void orc_free_diskrep(DISK_REPR *rep)
static int catalog_drop_all_representation_and_class(THREAD_ENTRY *thread_p, OID *class_id)
static PAGE_PTR catalog_find_optimal_page(THREAD_ENTRY *thread_p, int size, VPID *page_id)
#define ASSERT_ERROR_AND_SET(error_code)
#define ER_UPDATE_STAT_CANNOT_GET_LOCK
static void catalog_put_btree_statistics(char *rec_p, BTREE_STATS *stat_p)
#define CATALOG_REPR_ITEM_SLOTID_OFF
#define assert_release(e)
#define CATALOG_PUT_PGHEADER_DIR_COUNT(ptr, val)
void pgbuf_set_dirty(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, bool free_page)
unsigned int ci_time_stamp
int catalog_rv_insert_redo(THREAD_ENTRY *thread_p, LOG_RCV *recv_p)
void log_append_undo_data2(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, const VFID *vfid, PAGE_PTR pgptr, PGLENGTH offset, int length, const void *data)
static int catalog_drop(THREAD_ENTRY *thread_p, OID *class_id, REPR_ID repr_id)
int lock_object(THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock, int cond_flag)
void log_sysop_start(THREAD_ENTRY *thread_p)
static int catalog_store_disk_attribute(THREAD_ENTRY *thread_p, DISK_ATTR *disk_attrp, CATALOG_RECORD *ct_recordp, PGSLOTID *remembered_slotid)
int heap_scancache_quick_start_root_hfid(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
void catalog_initialize(CTID *catalog_id_p)
int xcatalog_check_rep_dir(THREAD_ENTRY *thread_p, OID *class_id_p, OID *rep_dir_p)
static int catalog_fetch_disk_representation(THREAD_ENTRY *thread_p, DISK_REPR *disk_reprp, CATALOG_RECORD *ct_recordp)
#define OID_SET_NULL(oidp)
#define CATALOG_DISK_REPR_ID_OFF
#define BTID_IS_EQUAL(b1, b2)
int catalog_rv_ovf_page_logical_insert_undo(THREAD_ENTRY *thread_p, LOG_RCV *recv_p)
static void catalog_delete_key(THREAD_ENTRY *thread_p, OID *class_id_p, REPR_ID repr_id)
#define PTR_ALIGN(addr, boundary)
void lock_unlock_object_donot_move_to_non2pl(THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock)
int catalog_update(THREAD_ENTRY *thread_p, RECDES *record_p, OID *class_oid_p)
#define CATALOG_BT_STATS_PKEYS_OFF
bool erase(cubthread::entry *thread_p, Key &key)
#define OID_AS_ARGS(oidp)
#define CATALOG_GET_PGHEADER_OVFL_PGID_PAGEID(ptr)
void or_class_hfid(RECDES *record, HFID *hfid)
#define er_log_debug(...)
PGSLOTID spage_delete_for_recovery(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
#define CATALOG_PUT_PGHEADER_OVFL_PGID_VOLID(ptr, val)
static int catalog_put_representation_item(THREAD_ENTRY *thread_p, OID *class_id, CATALOG_REPR_ITEM *repr_item, OID *rep_dir_p)
int heap_scancache_end(THREAD_ENTRY *thread_p, HEAP_SCANCACHE *scan_cache)
static void catalog_copy_btree_statistic(BTREE_STATS *new_btree_stats_p, int new_btree_stats_count, BTREE_STATS *pre_btree_stats_p, int pre_btree_stats_count)
static CATALOG_MAX_SPACE catalog_Max_space
#define CATALOG_ACCESS_INFO_INITIALIZER
#define ER_CT_INVALID_REPRID
#define COPY_OID(dest_oid_ptr, src_oid_ptr)
static void catalog_put_page_header(char *rec_p, CATALOG_PAGE_HEADER *header_p)
LOCK lock_get_object_lock(const OID *oid, const OID *class_oid)
SCAN_CODE spage_get_record(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, RECDES *record_descriptor_p, int is_peeking)
#define OID_GET_VIRTUAL_CLASS_OF_DIR_OID(class_oidp, virtual_oidp)
static void catalog_put_repr_item_to_record(char *rec_p, CATALOG_REPR_ITEM *item_p)
bool find_or_insert(cubthread::entry *thread_p, Key &key, T *&t)
int catalog_start_access_with_dir_oid(THREAD_ENTRY *thread_p, CATALOG_ACCESS_INFO *catalog_access_info, LOCK lock_mode)
#define CATALOG_DISK_ATTR_POSITION_OFF
int file_create_with_npages(THREAD_ENTRY *thread_p, FILE_TYPE file_type, int npages, FILE_DESCRIPTORS *des, VFID *vfid)
int catalog_insert(THREAD_ENTRY *thread_p, RECDES *record_p, OID *class_oid_p, OID *rep_dir_p)
#define pgbuf_unfix_and_init(thread_p, pgptr)
#define CATALOG_REPR_ITEM_REPRID_OFF
#define CATALOG_CLS_INFO_TOT_OBJS_OFF
static int catalog_drop_all(THREAD_ENTRY *thread_p, OID *class_id)
static void catalog_put_class_info_to_record(char *rec_p, CLS_INFO *class_info_p)
int intl_identifier_lower(const char *src, char *dst)
int spage_update(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, const RECDES *record_descriptor_p)
void or_class_rep_dir(RECDES *record, OID *rep_dir_p)
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)
int boot_find_root_heap(HFID *root_hfid_p)
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 spage_max_record_size(void)
void spage_dump(THREAD_ENTRY *thread_p, FILE *fp, PAGE_PTR page_p, int is_record_printed)
EHID * xehash_create(THREAD_ENTRY *thread_p, EHID *ehid, DB_TYPE key_type, int exp_num_entries, OID *class_oid, int attr_id, bool is_tmp)
#define RECDES_INITIALIZER
void catalog_dump(THREAD_ENTRY *thread_p, FILE *fp, int dump_flag)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
int catalog_end_access_with_dir_oid(THREAD_ENTRY *thread_p, CATALOG_ACCESS_INFO *catalog_access_info, int error)
int spage_max_space_for_new_record(THREAD_ENTRY *thread_p, PAGE_PTR page_p)
CATALOG_CLASS_ID_LIST * next
static int catalog_file_map_page_dump(THREAD_ENTRY *thread_p, PAGE_PTR *page, bool *stop, void *args)
static int catalog_file_map_overflow_count(THREAD_ENTRY *thread_p, PAGE_PTR *page, bool *stop, void *args)
static void catalog_get_disk_attribute(DISK_ATTR *attr_p, char *rec_p)
#define CATALOG_DISK_REPR_FIXED_LENGTH_OFF
void log_skip_logging(THREAD_ENTRY *thread_p, LOG_DATA_ADDR *addr)
static void catalog_dump_disk_attribute(DISK_ATTR *atr)
#define CATALOG_HEADER_SLOT
#define ER_LC_UNKNOWN_CLASSNAME
static int catalog_get_representation_item(THREAD_ENTRY *thread_p, OID *class_id, CATALOG_REPR_ITEM *repr_item)
bool pgbuf_check_page_ptype(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, PAGE_TYPE ptype)
int file_get_num_user_pages(THREAD_ENTRY *thread_p, const VFID *vfid, int *n_user_pages_out)
T * find(cubthread::entry *thread_p, Key &key)
#define CATALOG_CLS_INFO_HFID_OFF
static void catalog_put_disk_representation(char *rec_p, DISK_REPR *disk_repr_p)
int catalog_rv_update(THREAD_ENTRY *thread_p, LOG_RCV *recv_p)
void heap_classrepr_dump_all(THREAD_ENTRY *thread_p, FILE *fp, OID *class_oid)
#define CATALOG_REPR_ITEM_PAGEID_VOLID_OFF
bool need_free_class_name
LC_FIND_CLASSNAME xlocator_find_class_oid(THREAD_ENTRY *thread_p, const char *classname, OID *class_oid, LOCK lock)
#define ER_OUT_OF_VIRTUAL_MEMORY
#define CATALOG_BT_STATS_KEYS_OFF
static void catalog_get_btree_statistics(BTREE_STATS *stat_p, char *rec_p)
#define CATALOG_PAGE_HEADER_SIZE
int tp_domain_size(const TP_DOMAIN *domain)
#define CATALOG_GET_REPR_ITEM_SLOTID(ptr)
#define OR_GET_OID(ptr, oid)
void log_append_redo_recdes2(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, const VFID *vfid, PAGE_PTR pgptr, PGLENGTH offset, const RECDES *recdes)
#define BTREE_STATS_PKEYS_NUM
#define DB_MAX_IDENTIFIER_LENGTH
#define CATALOG_DISK_REPR_SIZE
void lock_unlock_object(THREAD_ENTRY *thread_p, const OID *oid, const OID *class_oid, LOCK lock, bool force)
#define CATALOG_DISK_ATTR_VAL_LENGTH_OFF
static void catalog_get_class_info_from_record(CLS_INFO *class_info_p, char *rec_p)
int catalog_rv_delete_redo(THREAD_ENTRY *thread_p, LOG_RCV *recv_p)
#define VPID_EQ(vpid_ptr1, vpid_ptr2)
#define CATALOG_HASH_SIZE
#define CATALOG_REPR_ITEM_PAGEID_PAGEID_OFF
#define CATALOG_DISK_REPR_N_VARIABLE_OFF
int catalog_rv_delete_undo(THREAD_ENTRY *thread_p, LOG_RCV *recv_p)
void catalog_free_representation(DISK_REPR *repr_p)
void orc_free_class_info(CLS_INFO *info)
#define OID_EQ(oidp1, oidp2)
#define CATALOG_BT_STATS_HEIGHT_OFF
static int catalog_drop_representation_class_from_page(THREAD_ENTRY *thread_p, VPID *dir_pgid, PAGE_PTR *dir_pgptr, VPID *page_id, PGSLOTID slot_id)
#define CATALOG_BT_STATS_PAGES_OFF
#define heap_classrepr_free_and_init(class_repr, idxp)
DISK_REPR * orc_diskrep_from_record(THREAD_ENTRY *thread_p, RECDES *record)
int catalog_add_representation(THREAD_ENTRY *thread_p, OID *class_id_p, REPR_ID repr_id, DISK_REPR *disk_repr_p, OID *rep_dir_p, CATALOG_ACCESS_INFO *catalog_access_info_p)
#define TP_DOMAIN_TYPE(dom)
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 catalog_get_representation_directory(THREAD_ENTRY *thread_p, OID *class_id_p, REPR_ID **repr_id_set_p, int *repr_count_p)
static int catalog_entry_free(void *ent)
PGNSLOTS spage_number_of_records(PAGE_PTR page_p)
struct disk_attribute * variable
#define CATALOG_DISK_ATTR_CLASSOID_OFF
static void catalog_get_disk_representation(DISK_REPR *disk_repr_p, char *rec_p)
int catalog_rv_insert_undo(THREAD_ENTRY *thread_p, LOG_RCV *recv_p)
static int catalog_write_unwritten_portion(THREAD_ENTRY *thread_p, CATALOG_RECORD *catalog_record_p, PGSLOTID *remembered_slot_id_p, int format_size)
#define ER_OBJ_INDEX_NOT_FOUND
void init(lf_tran_system &transys, int entry_idx, int hash_size, int freelist_block_size, int freelist_block_count, lf_entry_descriptor &edesc)
#define CATALOG_GET_REPR_ITEM_PAGEID_PAGEID(ptr)
void log_append_undoredo_recdes2(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, const VFID *vfid, PAGE_PTR pgptr, PGLENGTH offset, const RECDES *undo_recdes, const RECDES *redo_recdes)
#define BTID_SET_NULL(btid)
static int catalog_read_unread_portion(THREAD_ENTRY *thread_p, CATALOG_RECORD *catalog_record_p, int format_size)
#define db_private_free_and_init(thrd, ptr)
#define OR_PUT_BTID(ptr, btid)
int catalog_drop_old_representations(THREAD_ENTRY *thread_p, OID *class_id_p)
void catalog_finalize(void)
#define pgbuf_fix(thread_p, vpid, fetch_mode, requestmode, condition)
int catalog_get_dir_oid_from_cache(THREAD_ENTRY *thread_p, const OID *class_id_p, OID *dir_oid_p)
#define db_private_free(thrd, ptr)
void or_init(OR_BUF *buf, char *data, int length)
LF_TRAN_SYSTEM catalog_Ts
#define db_private_alloc(thrd, size)
struct disk_attribute * fixed
static DISK_ISVALID catalog_check_class_consistency(THREAD_ENTRY *thread_p, OID *class_oid)
#define CATALOG_CLS_INFO_SIZE
#define OR_PUT_SHORT(ptr, val)
#define CATALOG_GET_REPR_ITEM_REPRID(ptr)
#define CATALOG_CLS_INFO_TOT_PAGES_OFF
#define CATALOG_GET_BT_STATS_BTID(var, ptr)
static PAGE_PTR catalog_get_representation_record_after_search(THREAD_ENTRY *thread_p, OID *class_id_p, RECDES *record_p, PGBUF_LATCH_MODE latch, int is_peek, OID *rep_dir_p, int *out_repr_count_p, bool lookup_hash)
OR_CLASSREP * heap_classrepr_get(THREAD_ENTRY *thread_p, const OID *class_oid, RECDES *class_recdes, REPR_ID reprid, int *idx_incache)
int count(int &result, const cub_regex_object ®, const std::string &src, const int position, const INTL_CODESET codeset)
#define ER_QPROC_FUNCTION_ARG_ERROR
void pgbuf_get_vpid(PAGE_PTR pgptr, VPID *vpid)
#define pthread_mutex_lock(a)
void * ehash_delete(THREAD_ENTRY *thread_p, EHID *ehid_p, void *key_p)
#define VFID_COPY(vfid_ptr1, vfid_ptr2)
static void catalog_get_repr_item_from_record(CATALOG_REPR_ITEM *item_p, char *rec_p)
void log_sysop_abort(THREAD_ENTRY *thread_p)
#define CATALOG_CLS_INFO_TIME_STAMP_OFF
static char * catalog_find_representation_item_position(INT16 repr_id, int repr_cnt, char *repr_p, int *out_position_p)
static void error(const char *msg)
#define VPID_ISNULL(vpid_ptr)
void log_append_undo_recdes2(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, const VFID *vfid, PAGE_PTR pgptr, PGLENGTH offset, const RECDES *recdes)
#define CATALOG_DIR_REPR_KEY
int heap_get_btid_from_index_name(THREAD_ENTRY *thread_p, const OID *p_class_oid, const char *index_name, BTID *p_found_btid)
PGSLOTID spage_delete(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id)
static pthread_mutex_t catalog_Max_space_lock
#define HFID_IS_NULL(hfid)
int catalog_get_last_representation_id(THREAD_ENTRY *thread_p, OID *class_oid_p, REPR_ID *repr_id_p)
char * or_class_name(RECDES *record)
static int catalog_entry_uninit(void *ent)
int catalog_rv_new_page_redo(THREAD_ENTRY *thread_p, LOG_RCV *recv_p)
#define ER_SP_UNKNOWN_SLOTID
#define CLS_INFO_INITIALIZER
static void catalog_clear_hash_table(THREAD_ENTRY *thread_p)
static int catalog_get_key_list(THREAD_ENTRY *thread_p, void *key, void *val, void *args)
static int catalog_store_attribute_value(THREAD_ENTRY *thread_p, void *value, int length, CATALOG_RECORD *ct_recordp, PGSLOTID *remembered_slotid)
#define OR_PUT_HFID(ptr, hfid)
CTID * catalog_create(THREAD_ENTRY *thread_p, CTID *catalog_id_p)
#define free_and_init(ptr)
static unsigned int catalog_key_hash(void *key, int htsize)
void catalog_free_class_info(CLS_INFO *class_info_p)
#define ER_HEAP_UNKNOWN_OBJECT
void recdes_free_data_area(RECDES *rec)
void pgbuf_set_page_ptype(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, PAGE_TYPE ptype)
static void catalog_put_disk_attribute(char *rec_p, DISK_ATTR *attr_p)
static bool catalog_is_header_initialized
#define OR_PUT_INT(ptr, val)
#define CATALOG_REPR_ITEM_COUNT_OFF
int catalog_get_cardinality(THREAD_ENTRY *thread_p, OID *class_oid, DISK_REPR *rep, BTID *btid, const int key_pos, int *cardinality)
#define CATALOG_REPR_ITEM_INITIALIZER
#define CATALOG_PUT_PGHEADER_OVFL_PGID_PAGEID(ptr, val)
void log_sysop_attach_to_outer(THREAD_ENTRY *thread_p)
void log_sysop_commit(THREAD_ENTRY *thread_p)
static int catalog_initialize_new_page(THREAD_ENTRY *thread_p, PAGE_PTR page, void *args)
#define CATALOG_BT_STATS_LEAFS_OFF
#define CATALOG_BT_STATS_BTID_OFF
static int catalog_adjust_directory_count(THREAD_ENTRY *thread_p, PAGE_PTR page_p, RECDES *record_p, int delta)
static LF_ENTRY_DESCRIPTOR catalog_entry_Descriptor
static int catalog_key_copy(void *src, void *dest)
static int catalog_insert_representation_item(THREAD_ENTRY *thread_p, RECDES *record_p, OID *rep_dir_p)
#define CATALOG_GET_REPR_ITEM_PAGEID_VOLID(ptr)
static int catalog_drop_representation_helper(THREAD_ENTRY *thread_p, PAGE_PTR page_p, VPID *page_id_p, PGSLOTID slot_id)
int catalog_get_cardinality_by_name(THREAD_ENTRY *thread_p, const char *class_name, const char *index_name, const int key_pos, int *cardinality)
#define CATALOG_DISK_ATTR_ID_OFF
#define BTID_IS_NULL(btid)
CLS_INFO * orc_class_info_from_record(RECDES *record)
#define catalog_free_class_info_and_init(class_info_p)
static int catalog_entry_init(void *ent)
static PGLENGTH catalog_Max_record_size
static void catalog_copy_disk_attributes(DISK_ATTR *new_attrs_p, int new_attr_count, DISK_ATTR *pre_attrs_p, int pre_attr_count)
#define CATALOG_DISK_ATTR_LOCATION_OFF
#define CATALOG_DISK_ATTR_TYPE_OFF
static int catalog_store_btree_statistics(THREAD_ENTRY *thread_p, BTREE_STATS *bt_statsp, CATALOG_RECORD *ct_recordp, PGSLOTID *remembered_slotid)
void clear(cubthread::entry *thread_p)
static catalog_hashmap_type catalog_Hashmap
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 recdes_allocate_data_area(RECDES *rec, int size)
static int catalog_store_disk_representation(THREAD_ENTRY *thread_p, DISK_REPR *disk_reprp, CATALOG_RECORD *ct_recordp, PGSLOTID *remembered_slotid)
static void catalog_dump_representation(DISK_REPR *dr)
static int catalog_fetch_disk_attribute(THREAD_ENTRY *thread_p, DISK_ATTR *disk_attrp, CATALOG_RECORD *ct_recordp)
static void catalog_initialize_max_space(CATALOG_MAX_SPACE *header_p)
static int catalog_drop_representation_item(THREAD_ENTRY *thread_p, OID *class_id, CATALOG_REPR_ITEM *repr_item)
#define CATALOG_BT_STATS_SIZE
static int catalog_key_compare(void *key1, void *key2)
int heap_get_class_name(THREAD_ENTRY *thread_p, const OID *class_oid, char **class_name)
#define ER_CT_INVALID_CLASSID
#define ER_CT_MISSING_REPR_DIR
#define VPID_SET_NULL(vpid_ptr)
#define CATALOG_GET_PGHEADER_OVFL_PGID_VOLID(ptr)
static int catalog_file_map_find_optimal_page(THREAD_ENTRY *thread_p, PAGE_PTR *page, bool *stop, void *args)
static int catalog_get_record_from_page(THREAD_ENTRY *thread_p, CATALOG_RECORD *ct_recordp)
#define catalog_free_representation_and_init(repr_p)
static PAGE_PTR catalog_get_new_page(THREAD_ENTRY *thread_p, VPID *page_id, bool is_overflow_page)
struct tp_domain * or_get_domain(OR_BUF *buf, struct tp_domain *dom, int *is_null)
#define CATALOG_MAX_SLOT_ID_SIZE
static int catalog_fetch_btree_statistics(THREAD_ENTRY *thread_p, BTREE_STATS *bt_statsp, CATALOG_RECORD *ct_recordp)
DISK_ISVALID catalog_check_consistency(THREAD_ENTRY *thread_p)
#define OR_GET_SHORT(ptr)
#define CATALOG_PUT_PGHEADER_PG_OVFL(ptr, val)
#define CATALOG_GET_PGHEADER_PG_OVFL(ptr)
#define CATALOG_DISK_ATTR_SIZE
#define CATALOG_REPR_ITEM_SIZE
#define OR_PUT_BYTE(ptr, val)
int spage_insert_for_recovery(THREAD_ENTRY *thread_p, PAGE_PTR page_p, PGSLOTID slot_id, RECDES *record_descriptor_p)
const BTREE_STATS * stats_find_inherited_index_stats(OR_CLASSREP *cls_rep, OR_CLASSREP *subcls_rep, DISK_ATTR *subcls_attr, BTID *cls_btid)
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 int catalog_drop_directory(THREAD_ENTRY *thread_p, PAGE_PTR page_p, RECDES *record_p, OID *oid_p, OID *class_id_p)
SCAN_CODE heap_get_class_record(THREAD_ENTRY *thread_p, const OID *class_oid, RECDES *recdes_p, HEAP_SCANCACHE *scan_cache, int ispeeking)
static PAGE_PTR catalog_get_representation_record(THREAD_ENTRY *thread_p, OID *rep_dir_p, RECDES *record_p, PGBUF_LATCH_MODE latch, int is_peek, int *out_repr_count_p)
DISK_REPR * catalog_get_representation(THREAD_ENTRY *thread_p, OID *class_id_p, REPR_ID repr_id, CATALOG_ACCESS_INFO *catalog_access_info_p)
static int catalog_get_rep_dir(THREAD_ENTRY *thread_p, OID *class_oid_p, OID *rep_dir_p, bool lookup_hash)