CUBRID Engine  latest
system_catalog.c File Reference
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "system_catalog.h"
#include "error_manager.h"
#include "file_manager.h"
#include "log_append.hpp"
#include "slotted_page.h"
#include "extendible_hash.h"
#include "boot_sr.h"
#include "btree_load.h"
#include "heap_file.h"
#include "xserver_interface.h"
#include "statistics_sr.h"
#include "partition_sr.h"
#include "object_primitive.h"
#include "object_representation.h"
#include "thread_lockfree_hash_map.hpp"
#include "thread_manager.hpp"
Include dependency graph for system_catalog.c:

Go to the source code of this file.

Classes

struct  catalog_max_space
 
struct  catalog_key
 
struct  catalog_entry
 
struct  catalog_class_id_list
 
struct  catalog_record
 
struct  catalog_page_header
 
struct  catalog_repr_item
 
struct  catalog_find_optimal_page_context
 
struct  catalog_page_dump_context
 

Macros

#define pthread_mutex_init(a, b)
 
#define pthread_mutex_destroy(a)
 
#define pthread_mutex_lock(a)   0
 
#define pthread_mutex_trylock(a)   0
 
#define pthread_mutex_unlock(a)
 
#define CATALOG_HEADER_SLOT   0
 
#define CATALOG_MAX_SLOT_ID_SIZE   12
 
#define CATALOG_HASH_SIZE   1000
 
#define CATALOG_KEY_VALUE_ARRAY_SIZE   1000
 
#define CATALOG_PGHEADER_OVFL_PGID_PAGEID_OFF   0
 
#define CATALOG_PGHEADER_OVFL_PGID_VOLID_OFF   4
 
#define CATALOG_PGHEADER_DIR_CNT_OFF   8
 
#define CATALOG_PGHEADER_PG_OVFL_OFF   12
 
#define CATALOG_PAGE_HEADER_SIZE   16
 
#define CATALOG_GET_PGHEADER_OVFL_PGID_PAGEID(ptr)   (PAGEID) OR_GET_INT ((ptr) + CATALOG_PGHEADER_OVFL_PGID_PAGEID_OFF)
 
#define CATALOG_GET_PGHEADER_OVFL_PGID_VOLID(ptr)   (VOLID) OR_GET_SHORT ((ptr) + CATALOG_PGHEADER_OVFL_PGID_VOLID_OFF)
 
#define CATALOG_GET_PGHEADER_DIR_COUNT(ptr)   (int) OR_GET_INT ((ptr) + CATALOG_PGHEADER_DIR_CNT_OFF)
 
#define CATALOG_GET_PGHEADER_PG_OVFL(ptr)   (bool) OR_GET_INT ((ptr) + CATALOG_PGHEADER_PG_OVFL_OFF)
 
#define CATALOG_PUT_PGHEADER_OVFL_PGID_PAGEID(ptr, val)   OR_PUT_INT ((ptr) + CATALOG_PGHEADER_OVFL_PGID_PAGEID_OFF, (val))
 
#define CATALOG_PUT_PGHEADER_OVFL_PGID_VOLID(ptr, val)   OR_PUT_SHORT ((ptr) + CATALOG_PGHEADER_OVFL_PGID_VOLID_OFF, (val))
 
#define CATALOG_PUT_PGHEADER_DIR_COUNT(ptr, val)   OR_PUT_INT ((ptr) + CATALOG_PGHEADER_DIR_CNT_OFF, (val))
 
#define CATALOG_PUT_PGHEADER_PG_OVFL(ptr, val)   OR_PUT_INT ((ptr) + CATALOG_PGHEADER_PG_OVFL_OFF, (int) (val))
 
#define CATALOG_DISK_REPR_ID_OFF   0
 
#define CATALOG_DISK_REPR_N_FIXED_OFF   4
 
#define CATALOG_DISK_REPR_FIXED_LENGTH_OFF   8
 
#define CATALOG_DISK_REPR_N_VARIABLE_OFF   12
 
#define CATALOG_DISK_REPR_RESERVED_1_OFF   16 /* reserved for future use */
 
#define CATALOG_DISK_REPR_SIZE   56
 
#define CATALOG_DISK_ATTR_ID_OFF   0
 
#define CATALOG_DISK_ATTR_LOCATION_OFF   4
 
#define CATALOG_DISK_ATTR_TYPE_OFF   8
 
#define CATALOG_DISK_ATTR_VAL_LENGTH_OFF   12
 
#define CATALOG_DISK_ATTR_POSITION_OFF   16
 
#define CATALOG_DISK_ATTR_CLASSOID_OFF   20
 
#define CATALOG_DISK_ATTR_N_BTSTATS_OFF   28
 
#define CATALOG_DISK_ATTR_SIZE   80
 
#define CATALOG_BT_STATS_BTID_OFF   0
 
#define CATALOG_BT_STATS_LEAFS_OFF   OR_BTID_ALIGNED_SIZE
 
#define CATALOG_BT_STATS_PAGES_OFF   16
 
#define CATALOG_BT_STATS_HEIGHT_OFF   20
 
#define CATALOG_BT_STATS_KEYS_OFF   24
 
#define CATALOG_BT_STATS_FUNC_INDEX_OFF   28
 
#define CATALOG_BT_STATS_PKEYS_OFF   32
 
#define CATALOG_BT_STATS_RESERVED_OFF   (CATALOG_BT_STATS_PKEYS_OFF + (OR_INT_SIZE * BTREE_STATS_PKEYS_NUM)) /* 64 */
 
#define CATALOG_BT_STATS_SIZE   (CATALOG_BT_STATS_RESERVED_OFF + (OR_INT_SIZE * BTREE_STATS_RESERVED_NUM)) /* 64 + (4 * R_NUM) = 80 */
 
#define CATALOG_GET_BT_STATS_BTID(var, ptr)   OR_GET_BTID((ptr) + CATALOG_BT_STATS_BTID_OFF, (var))
 
#define CATALOG_CLS_INFO_HFID_OFF   0
 
#define CATALOG_CLS_INFO_TOT_PAGES_OFF   12
 
#define CATALOG_CLS_INFO_TOT_OBJS_OFF   16
 
#define CATALOG_CLS_INFO_TIME_STAMP_OFF   20
 
#define CATALOG_CLS_INFO_REP_DIR_OFF   24
 
#define CATALOG_CLS_INFO_SIZE   56
 
#define CATALOG_CLS_INFO_RESERVED   24
 
#define CATALOG_REPR_ITEM_PAGEID_PAGEID_OFF   0
 
#define CATALOG_REPR_ITEM_PAGEID_VOLID_OFF   4
 
#define CATALOG_REPR_ITEM_REPRID_OFF   8
 
#define CATALOG_REPR_ITEM_SLOTID_OFF   10
 
#define CATALOG_REPR_ITEM_COUNT_OFF   12
 
#define CATALOG_REPR_ITEM_SIZE   16
 
#define CATALOG_GET_REPR_ITEM_PAGEID_PAGEID(ptr)   (PAGEID) OR_GET_INT ((ptr) + CATALOG_REPR_ITEM_PAGEID_PAGEID_OFF)
 
#define CATALOG_GET_REPR_ITEM_PAGEID_VOLID(ptr)   (VOLID) OR_GET_SHORT ((ptr) + CATALOG_REPR_ITEM_PAGEID_VOLID_OFF)
 
#define CATALOG_GET_REPR_ITEM_REPRID(ptr)   (REPR_ID) OR_GET_SHORT ((ptr) + CATALOG_REPR_ITEM_REPRID_OFF)
 
#define CATALOG_GET_REPR_ITEM_SLOTID(ptr)   (PGSLOTID) OR_GET_SHORT ((ptr) + CATALOG_REPR_ITEM_SLOTID_OFF)
 
#define CATALOG_GET_REPR_ITEM_COUNT(ptr)   (PGSLOTID) OR_GET_BYTE ((ptr) + CATALOG_REPR_ITEM_COUNT_OFF)
 
#define CATALOG_REPR_ITEM_INITIALIZER   { { NULL_PAGEID, NULL_VOLID }, NULL_REPRID, NULL_SLOTID }
 

Typedefs

typedef struct catalog_max_space CATALOG_MAX_SPACE
 
typedef struct catalog_key CATALOG_KEY
 
typedef struct catalog_entry CATALOG_ENTRY
 
typedef struct catalog_class_id_list CATALOG_CLASS_ID_LIST
 
typedef struct catalog_record CATALOG_RECORD
 
typedef struct catalog_page_header CATALOG_PAGE_HEADER
 
typedef struct catalog_repr_item CATALOG_REPR_ITEM
 
using catalog_hashmap_type = cubthread::lockfree_hashmap< catalog_key, catalog_entry >
 
typedef struct catalog_find_optimal_page_context CATALOG_FIND_OPTIMAL_PAGE_CONTEXT
 
typedef struct catalog_page_dump_context CATALOG_PAGE_DUMP_CONTEXT
 

Functions

static void * catalog_entry_alloc (void)
 
static int catalog_entry_free (void *ent)
 
static int catalog_entry_init (void *ent)
 
static int catalog_entry_uninit (void *ent)
 
static int catalog_key_copy (void *src, void *dest)
 
static int catalog_key_compare (void *key1, void *key2)
 
static unsigned int catalog_key_hash (void *key, int htsize)
 
static void catalog_initialize_max_space (CATALOG_MAX_SPACE *header_p)
 
static void catalog_update_max_space (VPID *page_id, PGLENGTH space)
 
static int catalog_initialize_new_page (THREAD_ENTRY *thread_p, PAGE_PTR page, void *args)
 
static PAGE_PTR catalog_get_new_page (THREAD_ENTRY *thread_p, VPID *page_id, bool is_overflow_page)
 
static PAGE_PTR catalog_find_optimal_page (THREAD_ENTRY *thread_p, int size, VPID *page_id)
 
static int catalog_get_key_list (THREAD_ENTRY *thread_p, void *key, void *val, void *args)
 
static void catalog_free_key_list (CATALOG_CLASS_ID_LIST *clsid_list)
 
static int catalog_put_record_into_page (THREAD_ENTRY *thread_p, CATALOG_RECORD *ct_recordp, int next, PGSLOTID *remembered_slotid)
 
static int catalog_store_disk_representation (THREAD_ENTRY *thread_p, DISK_REPR *disk_reprp, CATALOG_RECORD *ct_recordp, PGSLOTID *remembered_slotid)
 
static int catalog_store_disk_attribute (THREAD_ENTRY *thread_p, DISK_ATTR *disk_attrp, CATALOG_RECORD *ct_recordp, PGSLOTID *remembered_slotid)
 
static int catalog_store_attribute_value (THREAD_ENTRY *thread_p, void *value, int length, CATALOG_RECORD *ct_recordp, PGSLOTID *remembered_slotid)
 
static int catalog_store_btree_statistics (THREAD_ENTRY *thread_p, BTREE_STATS *bt_statsp, CATALOG_RECORD *ct_recordp, PGSLOTID *remembered_slotid)
 
static int catalog_get_record_from_page (THREAD_ENTRY *thread_p, CATALOG_RECORD *ct_recordp)
 
static int catalog_fetch_disk_representation (THREAD_ENTRY *thread_p, DISK_REPR *disk_reprp, CATALOG_RECORD *ct_recordp)
 
static int catalog_fetch_disk_attribute (THREAD_ENTRY *thread_p, DISK_ATTR *disk_attrp, CATALOG_RECORD *ct_recordp)
 
static int catalog_fetch_attribute_value (THREAD_ENTRY *thread_p, void *value, int length, CATALOG_RECORD *ct_recordp)
 
static int catalog_fetch_btree_statistics (THREAD_ENTRY *thread_p, BTREE_STATS *bt_statsp, CATALOG_RECORD *ct_recordp)
 
static int catalog_drop_disk_representation_from_page (THREAD_ENTRY *thread_p, VPID *page_id, PGSLOTID slot_id)
 
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)
 
static int catalog_get_rep_dir (THREAD_ENTRY *thread_p, OID *class_oid_p, OID *rep_dir_p, bool lookup_hash)
 
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)
 
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)
 
static int catalog_adjust_directory_count (THREAD_ENTRY *thread_p, PAGE_PTR page_p, RECDES *record_p, int delta)
 
static void catalog_delete_key (THREAD_ENTRY *thread_p, OID *class_id_p, REPR_ID repr_id)
 
static char * catalog_find_representation_item_position (INT16 repr_id, int repr_cnt, char *repr_p, int *out_position_p)
 
static int catalog_insert_representation_item (THREAD_ENTRY *thread_p, RECDES *record_p, OID *rep_dir_p)
 
static int catalog_drop_directory (THREAD_ENTRY *thread_p, PAGE_PTR page_p, RECDES *record_p, OID *oid_p, OID *class_id_p)
 
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 void catalog_copy_disk_attributes (DISK_ATTR *new_attrs_p, int new_attr_count, DISK_ATTR *pre_attrs_p, int pre_attr_count)
 
static int catalog_sum_disk_attribute_size (DISK_ATTR *attrs_p, int count)
 
static int catalog_put_representation_item (THREAD_ENTRY *thread_p, OID *class_id, CATALOG_REPR_ITEM *repr_item, OID *rep_dir_p)
 
static int catalog_get_representation_item (THREAD_ENTRY *thread_p, OID *class_id, CATALOG_REPR_ITEM *repr_item)
 
static int catalog_drop_representation_item (THREAD_ENTRY *thread_p, OID *class_id, CATALOG_REPR_ITEM *repr_item)
 
static int catalog_drop (THREAD_ENTRY *thread_p, OID *class_id, REPR_ID repr_id)
 
static int catalog_drop_all (THREAD_ENTRY *thread_p, OID *class_id)
 
static int catalog_drop_all_representation_and_class (THREAD_ENTRY *thread_p, OID *class_id)
 
static DISK_ISVALID catalog_check_class_consistency (THREAD_ENTRY *thread_p, OID *class_oid)
 
static void catalog_dump_disk_attribute (DISK_ATTR *atr)
 
static void catalog_dump_representation (DISK_REPR *dr)
 
static void catalog_clear_hash_table (THREAD_ENTRY *thread_p)
 
static void catalog_put_page_header (char *rec_p, CATALOG_PAGE_HEADER *header_p)
 
static void catalog_get_disk_representation (DISK_REPR *disk_repr_p, char *rec_p)
 
static void catalog_put_disk_representation (char *rec_p, DISK_REPR *disk_repr_p)
 
static void catalog_get_disk_attribute (DISK_ATTR *attr_p, char *rec_p)
 
static void catalog_put_disk_attribute (char *rec_p, DISK_ATTR *attr_p)
 
static void catalog_put_btree_statistics (char *rec_p, BTREE_STATS *stat_p)
 
static void catalog_get_class_info_from_record (CLS_INFO *class_info_p, char *rec_p)
 
static void catalog_put_class_info_to_record (char *rec_p, CLS_INFO *class_info_p)
 
static void catalog_get_repr_item_from_record (CATALOG_REPR_ITEM *item_p, char *rec_p)
 
static void catalog_put_repr_item_to_record (char *rec_p, CATALOG_REPR_ITEM *item_p)
 
static int catalog_assign_attribute (THREAD_ENTRY *thread_p, DISK_ATTR *disk_attr_p, CATALOG_RECORD *catalog_record_p)
 
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_btree_statistics (BTREE_STATS *stat_p, char *rec_p)
 
static int catalog_file_map_find_optimal_page (THREAD_ENTRY *thread_p, PAGE_PTR *page, bool *stop, void *args)
 
void catalog_free_representation (DISK_REPR *repr_p)
 
void catalog_free_class_info (CLS_INFO *class_info_p)
 
static int catalog_write_unwritten_portion (THREAD_ENTRY *thread_p, CATALOG_RECORD *catalog_record_p, PGSLOTID *remembered_slot_id_p, int format_size)
 
static int catalog_read_unread_portion (THREAD_ENTRY *thread_p, CATALOG_RECORD *catalog_record_p, int format_size)
 
static int catalog_drop_representation_helper (THREAD_ENTRY *thread_p, PAGE_PTR page_p, VPID *page_id_p, PGSLOTID slot_id)
 
void catalog_initialize (CTID *catalog_id_p)
 
void catalog_finalize (void)
 
CTIDcatalog_create (THREAD_ENTRY *thread_p, CTID *catalog_id_p)
 
int catalog_reclaim_space (THREAD_ENTRY *thread_p)
 
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)
 
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)
 
CLS_INFOcatalog_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)
 
int catalog_drop_old_representations (THREAD_ENTRY *thread_p, OID *class_id_p)
 
int xcatalog_check_rep_dir (THREAD_ENTRY *thread_p, OID *class_id_p, OID *rep_dir_p)
 
DISK_REPRcatalog_get_representation (THREAD_ENTRY *thread_p, OID *class_id_p, REPR_ID repr_id, CATALOG_ACCESS_INFO *catalog_access_info_p)
 
CLS_INFOcatalog_get_class_info (THREAD_ENTRY *thread_p, OID *class_id_p, CATALOG_ACCESS_INFO *catalog_access_info_p)
 
int catalog_get_representation_directory (THREAD_ENTRY *thread_p, OID *class_id_p, REPR_ID **repr_id_set_p, int *repr_count_p)
 
int catalog_get_last_representation_id (THREAD_ENTRY *thread_p, OID *class_oid_p, REPR_ID *repr_id_p)
 
int catalog_insert (THREAD_ENTRY *thread_p, RECDES *record_p, OID *class_oid_p, OID *rep_dir_p)
 
int catalog_update (THREAD_ENTRY *thread_p, RECDES *record_p, OID *class_oid_p)
 
int catalog_delete (THREAD_ENTRY *thread_p, OID *class_oid_p)
 
DISK_ISVALID catalog_check_consistency (THREAD_ENTRY *thread_p)
 
void catalog_dump (THREAD_ENTRY *thread_p, FILE *fp, int dump_flag)
 
int catalog_rv_new_page_redo (THREAD_ENTRY *thread_p, LOG_RCV *recv_p)
 
int catalog_rv_insert_redo (THREAD_ENTRY *thread_p, LOG_RCV *recv_p)
 
int catalog_rv_insert_undo (THREAD_ENTRY *thread_p, LOG_RCV *recv_p)
 
int catalog_rv_delete_redo (THREAD_ENTRY *thread_p, LOG_RCV *recv_p)
 
int catalog_get_cardinality (THREAD_ENTRY *thread_p, OID *class_oid, DISK_REPR *rep, BTID *btid, const int key_pos, int *cardinality)
 
int catalog_get_cardinality_by_name (THREAD_ENTRY *thread_p, const char *class_name, const char *index_name, const int key_pos, int *cardinality)
 
int catalog_rv_delete_undo (THREAD_ENTRY *thread_p, LOG_RCV *recv_p)
 
int catalog_rv_update (THREAD_ENTRY *thread_p, LOG_RCV *recv_p)
 
int catalog_rv_ovf_page_logical_insert_undo (THREAD_ENTRY *thread_p, LOG_RCV *recv_p)
 
int catalog_get_dir_oid_from_cache (THREAD_ENTRY *thread_p, const OID *class_id_p, OID *dir_oid_p)
 
int catalog_start_access_with_dir_oid (THREAD_ENTRY *thread_p, CATALOG_ACCESS_INFO *catalog_access_info, LOCK lock_mode)
 
int catalog_end_access_with_dir_oid (THREAD_ENTRY *thread_p, CATALOG_ACCESS_INFO *catalog_access_info, int error)
 

Variables

static int rv
 
static LF_ENTRY_DESCRIPTOR catalog_entry_Descriptor
 
CTID catalog_Id
 
static PGLENGTH catalog_Max_record_size
 
static catalog_hashmap_type catalog_Hashmap
 
static CATALOG_MAX_SPACE catalog_Max_space
 
static pthread_mutex_t catalog_Max_space_lock = PTHREAD_MUTEX_INITIALIZER
 
static bool catalog_is_header_initialized = false
 

Macro Definition Documentation

#define CATALOG_BT_STATS_BTID_OFF   0

Definition at line 116 of file system_catalog.c.

Referenced by catalog_put_btree_statistics().

#define CATALOG_BT_STATS_FUNC_INDEX_OFF   28

Definition at line 121 of file system_catalog.c.

Referenced by catalog_get_btree_statistics(), and catalog_put_btree_statistics().

#define CATALOG_BT_STATS_HEIGHT_OFF   20

Definition at line 119 of file system_catalog.c.

Referenced by catalog_get_btree_statistics(), and catalog_put_btree_statistics().

#define CATALOG_BT_STATS_KEYS_OFF   24

Definition at line 120 of file system_catalog.c.

Referenced by catalog_get_btree_statistics(), and catalog_put_btree_statistics().

#define CATALOG_BT_STATS_LEAFS_OFF   OR_BTID_ALIGNED_SIZE

Definition at line 117 of file system_catalog.c.

Referenced by catalog_get_btree_statistics(), and catalog_put_btree_statistics().

#define CATALOG_BT_STATS_PAGES_OFF   16

Definition at line 118 of file system_catalog.c.

Referenced by catalog_get_btree_statistics(), and catalog_put_btree_statistics().

#define CATALOG_BT_STATS_PKEYS_OFF   32

Definition at line 122 of file system_catalog.c.

Referenced by catalog_get_btree_statistics(), and catalog_put_btree_statistics().

#define CATALOG_BT_STATS_RESERVED_OFF   (CATALOG_BT_STATS_PKEYS_OFF + (OR_INT_SIZE * BTREE_STATS_PKEYS_NUM)) /* 64 */

Definition at line 123 of file system_catalog.c.

Referenced by catalog_get_btree_statistics(), and catalog_put_btree_statistics().

#define CATALOG_BT_STATS_SIZE   (CATALOG_BT_STATS_RESERVED_OFF + (OR_INT_SIZE * BTREE_STATS_RESERVED_NUM)) /* 64 + (4 * R_NUM) = 80 */
#define CATALOG_CLS_INFO_HFID_OFF   0
#define CATALOG_CLS_INFO_REP_DIR_OFF   24
#define CATALOG_CLS_INFO_RESERVED   24

Definition at line 135 of file system_catalog.c.

Referenced by catalog_add_class_info(), and catalog_update_class_info().

#define CATALOG_CLS_INFO_SIZE   56
#define CATALOG_CLS_INFO_TIME_STAMP_OFF   20
#define CATALOG_CLS_INFO_TOT_OBJS_OFF   16
#define CATALOG_CLS_INFO_TOT_PAGES_OFF   12
#define CATALOG_DISK_ATTR_CLASSOID_OFF   20

Definition at line 112 of file system_catalog.c.

Referenced by catalog_get_disk_attribute(), and catalog_put_disk_attribute().

#define CATALOG_DISK_ATTR_ID_OFF   0

Definition at line 107 of file system_catalog.c.

Referenced by catalog_get_disk_attribute(), and catalog_put_disk_attribute().

#define CATALOG_DISK_ATTR_LOCATION_OFF   4

Definition at line 108 of file system_catalog.c.

Referenced by catalog_get_disk_attribute(), and catalog_put_disk_attribute().

#define CATALOG_DISK_ATTR_N_BTSTATS_OFF   28

Definition at line 113 of file system_catalog.c.

Referenced by catalog_get_disk_attribute(), and catalog_put_disk_attribute().

#define CATALOG_DISK_ATTR_POSITION_OFF   16

Definition at line 111 of file system_catalog.c.

Referenced by catalog_get_disk_attribute(), and catalog_put_disk_attribute().

#define CATALOG_DISK_ATTR_SIZE   80
#define CATALOG_DISK_ATTR_TYPE_OFF   8

Definition at line 109 of file system_catalog.c.

Referenced by catalog_get_disk_attribute(), and catalog_put_disk_attribute().

#define CATALOG_DISK_ATTR_VAL_LENGTH_OFF   12

Definition at line 110 of file system_catalog.c.

Referenced by catalog_get_disk_attribute(), and catalog_put_disk_attribute().

#define CATALOG_DISK_REPR_FIXED_LENGTH_OFF   8
#define CATALOG_DISK_REPR_ID_OFF   0
#define CATALOG_DISK_REPR_N_FIXED_OFF   4
#define CATALOG_DISK_REPR_N_VARIABLE_OFF   12
#define CATALOG_DISK_REPR_RESERVED_1_OFF   16 /* reserved for future use */
#define CATALOG_DISK_REPR_SIZE   56
#define CATALOG_GET_BT_STATS_BTID (   var,
  ptr 
)    OR_GET_BTID((ptr) + CATALOG_BT_STATS_BTID_OFF, (var))

Definition at line 126 of file system_catalog.c.

Referenced by catalog_fetch_btree_statistics().

#define CATALOG_GET_PGHEADER_DIR_COUNT (   ptr)    (int) OR_GET_INT ((ptr) + CATALOG_PGHEADER_DIR_CNT_OFF)
#define CATALOG_GET_PGHEADER_OVFL_PGID_VOLID (   ptr)    (VOLID) OR_GET_SHORT ((ptr) + CATALOG_PGHEADER_OVFL_PGID_VOLID_OFF)
#define CATALOG_GET_PGHEADER_PG_OVFL (   ptr)    (bool) OR_GET_INT ((ptr) + CATALOG_PGHEADER_PG_OVFL_OFF)

Definition at line 79 of file system_catalog.c.

Referenced by catalog_file_map_find_optimal_page().

#define CATALOG_GET_REPR_ITEM_COUNT (   ptr)    (PGSLOTID) OR_GET_BYTE ((ptr) + CATALOG_REPR_ITEM_COUNT_OFF)

Definition at line 157 of file system_catalog.c.

Referenced by catalog_get_representation_record().

#define CATALOG_HASH_SIZE   1000

Definition at line 59 of file system_catalog.c.

Referenced by catalog_initialize().

#define CATALOG_KEY_VALUE_ARRAY_SIZE   1000

Definition at line 60 of file system_catalog.c.

#define CATALOG_PAGE_HEADER_SIZE   16
#define CATALOG_PGHEADER_DIR_CNT_OFF   8

Definition at line 64 of file system_catalog.c.

#define CATALOG_PGHEADER_OVFL_PGID_PAGEID_OFF   0

Definition at line 62 of file system_catalog.c.

#define CATALOG_PGHEADER_OVFL_PGID_VOLID_OFF   4

Definition at line 63 of file system_catalog.c.

#define CATALOG_PGHEADER_PG_OVFL_OFF   12

Definition at line 65 of file system_catalog.c.

#define CATALOG_PUT_PGHEADER_DIR_COUNT (   ptr,
  val 
)    OR_PUT_INT ((ptr) + CATALOG_PGHEADER_DIR_CNT_OFF, (val))

Definition at line 89 of file system_catalog.c.

Referenced by catalog_adjust_directory_count(), and catalog_put_page_header().

#define CATALOG_PUT_PGHEADER_OVFL_PGID_PAGEID (   ptr,
  val 
)    OR_PUT_INT ((ptr) + CATALOG_PGHEADER_OVFL_PGID_PAGEID_OFF, (val))
#define CATALOG_PUT_PGHEADER_OVFL_PGID_VOLID (   ptr,
  val 
)    OR_PUT_SHORT ((ptr) + CATALOG_PGHEADER_OVFL_PGID_VOLID_OFF, (val))
#define CATALOG_PUT_PGHEADER_PG_OVFL (   ptr,
  val 
)    OR_PUT_INT ((ptr) + CATALOG_PGHEADER_PG_OVFL_OFF, (int) (val))

Definition at line 92 of file system_catalog.c.

Referenced by catalog_put_page_header().

#define CATALOG_REPR_ITEM_PAGEID_PAGEID_OFF   0
#define CATALOG_REPR_ITEM_PAGEID_VOLID_OFF   4
#define CATALOG_REPR_ITEM_REPRID_OFF   8
#define CATALOG_REPR_ITEM_SLOTID_OFF   10
#define pthread_mutex_destroy (   a)

Definition at line 50 of file system_catalog.c.

#define pthread_mutex_init (   a,
 
)

Definition at line 49 of file system_catalog.c.

#define pthread_mutex_lock (   a)    0
#define pthread_mutex_trylock (   a)    0

Definition at line 52 of file system_catalog.c.

#define pthread_mutex_unlock (   a)

Typedef Documentation

Definition at line 224 of file system_catalog.c.

typedef struct catalog_entry CATALOG_ENTRY

Definition at line 184 of file system_catalog.c.

typedef struct catalog_key CATALOG_KEY

Definition at line 169 of file system_catalog.c.

Definition at line 161 of file system_catalog.c.

Definition at line 295 of file system_catalog.c.

Definition at line 241 of file system_catalog.c.

Definition at line 231 of file system_catalog.c.

Definition at line 249 of file system_catalog.c.

Function Documentation

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 
)

Definition at line 2771 of file system_catalog.c.

References recdes::area_size, ARG_FILE_LINE, assert, ASSERT_ERROR_AND_SET, disk_attribute::bt_stats, BTREE_STATS_PKEYS_NUM, CATALOG_ACCESS_INFO_INITIALIZER, CATALOG_DISK_REPR_SIZE, catalog_end_access_with_dir_oid(), catalog_find_optimal_page(), catalog_get_dir_oid_from_cache(), CATALOG_MAX_SLOT_ID_SIZE, catalog_put_record_into_page(), catalog_put_representation_item(), CATALOG_REPR_ITEM_INITIALIZER, catalog_start_access_with_dir_oid(), catalog_store_attribute_value(), catalog_store_btree_statistics(), catalog_store_disk_attribute(), catalog_store_disk_representation(), catalog_sum_disk_attribute_size(), catalog_update_max_space(), catalog_access_info::class_oid, recdes::data, DB_PAGESIZE, db_private_alloc, db_private_free_and_init, catalog_access_info::dir_oid, ER_CT_INVALID_CLASSID, ER_CT_INVALID_REPRID, ER_ERROR_SEVERITY, ER_FAILED, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), disk_representation::fixed, i, recdes::length, disk_attribute::n_btstats, disk_representation::n_fixed, disk_representation::n_variable, NO_ERROR, NULL, NULL_REPRID, NULL_SLOTID, catalog_record::offset, OID_ISNULL, OID_ISTEMP, catalog_repr_item::page_id, catalog_record::page_p, vpid::pageid, db_identifier::pageid, pgbuf_unfix_and_init, btree_stats::pkeys_size, REC_HOME, catalog_record::recdes, catalog_repr_item::repr_id, catalog_repr_item::slot_id, catalog_record::slotid, db_identifier::slotid, spage_max_space_for_new_record(), recdes::type, disk_attribute::val_length, disk_attribute::value, disk_representation::variable, vpid::volid, db_identifier::volid, catalog_record::vpid, and X_LOCK.

Referenced by catalog_insert(), catalog_update(), stats_update_partitioned_statistics(), xcatalog_check_rep_dir(), and xstats_update_statistics().

Here is the caller graph for this function:

static int catalog_assign_attribute ( THREAD_ENTRY thread_p,
DISK_ATTR disk_attr_p,
CATALOG_RECORD catalog_record_p 
)
static
static void catalog_clear_hash_table ( THREAD_ENTRY thread_p)
static
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
static void catalog_copy_disk_attributes ( DISK_ATTR new_attrs_p,
int  new_attr_count,
DISK_ATTR pre_attrs_p,
int  pre_attr_count 
)
static

Definition at line 2500 of file system_catalog.c.

References disk_attribute::bt_stats, catalog_copy_btree_statistic(), i, disk_attribute::id, and disk_attribute::n_btstats.

Referenced by catalog_update().

Here is the caller graph for this function:

int catalog_delete ( THREAD_ENTRY thread_p,
OID class_oid_p 
)

Definition at line 4530 of file system_catalog.c.

References assert, catalog_drop_all_representation_and_class(), er_errid(), and NO_ERROR.

Referenced by locator_delete_force_internal().

Here is the caller graph for this function:

static int catalog_drop_directory ( THREAD_ENTRY thread_p,
PAGE_PTR  page_p,
RECDES record_p,
OID oid_p,
OID class_id_p 
)
static
static int catalog_drop_disk_representation_from_page ( THREAD_ENTRY thread_p,
VPID page_id,
PGSLOTID  slot_id 
)
static
int catalog_drop_old_representations ( THREAD_ENTRY thread_p,
OID class_id_p 
)
static void catalog_dump_representation ( DISK_REPR dr)
static
static void * catalog_entry_alloc ( void  )
static

Definition at line 950 of file system_catalog.c.

static int catalog_entry_free ( void *  ent)
static

Definition at line 961 of file system_catalog.c.

References NO_ERROR.

static int catalog_entry_init ( void *  ent)
static

Definition at line 973 of file system_catalog.c.

References NO_ERROR.

static int catalog_entry_uninit ( void *  ent)
static

Definition at line 985 of file system_catalog.c.

References NO_ERROR.

static int catalog_fetch_attribute_value ( THREAD_ENTRY thread_p,
void *  value,
int  length,
CATALOG_RECORD ct_recordp 
)
static
static int catalog_fetch_disk_attribute ( THREAD_ENTRY thread_p,
DISK_ATTR disk_attrp,
CATALOG_RECORD ct_recordp 
)
static
static int catalog_fetch_disk_representation ( THREAD_ENTRY thread_p,
DISK_REPR disk_reprp,
CATALOG_RECORD ct_recordp 
)
static
static int catalog_file_map_overflow_count ( THREAD_ENTRY thread_p,
PAGE_PTR page,
bool stop,
void *  args 
)
static

Definition at line 4947 of file system_catalog.c.

References assert_release, CATALOG_GET_PGHEADER_OVFL_PGID_PAGEID, CATALOG_HEADER_SLOT, recdes::data, ER_FAILED, NO_ERROR, NULL_PAGEID, PEEK, S_SUCCESS, and spage_get_record().

Referenced by catalog_dump().

Here is the caller graph for this function:

static int catalog_file_map_page_dump ( THREAD_ENTRY thread_p,
PAGE_PTR page,
bool stop,
void *  args 
)
static
void catalog_finalize ( void  )

Definition at line 2567 of file system_catalog.c.

References cubthread::lockfree_hashmap< Key, T >::destroy().

Referenced by boot_server_all_finalize().

Here is the caller graph for this function:

static char * catalog_find_representation_item_position ( INT16  repr_id,
int  repr_cnt,
char *  repr_p,
int *  out_position_p 
)
static

Definition at line 1973 of file system_catalog.c.

References assert, CATALOG_GET_REPR_ITEM_REPRID, and CATALOG_REPR_ITEM_SIZE.

Referenced by catalog_drop_representation_item(), catalog_get_representation_item(), and catalog_put_representation_item().

Here is the caller graph for this function:

void catalog_free_class_info ( CLS_INFO class_info_p)

Definition at line 882 of file system_catalog.c.

References db_private_free_and_init, and NULL.

Referenced by catalog_update().

Here is the caller graph for this function:

static void catalog_free_key_list ( CATALOG_CLASS_ID_LIST clsid_list)
static

Definition at line 927 of file system_catalog.c.

References db_private_free_and_init, catalog_class_id_list::next, NULL, and p.

static int catalog_get_key_list ( THREAD_ENTRY thread_p,
void *  key,
void *  val,
void *  args 
)
static
static PAGE_PTR catalog_get_new_page ( THREAD_ENTRY thread_p,
VPID page_id,
bool  is_overflow_page 
)
static
DISK_REPR* catalog_get_representation ( THREAD_ENTRY thread_p,
OID class_id_p,
REPR_ID  repr_id,
CATALOG_ACCESS_INFO catalog_access_info_p 
)

Definition at line 3847 of file system_catalog.c.

References ARG_FILE_LINE, assert, disk_attribute::bt_stats, CATALOG_ACCESS_INFO_INITIALIZER, catalog_add_class_info(), catalog_assign_attribute(), catalog_end_access_with_dir_oid(), catalog_fetch_disk_representation(), catalog_free_representation_and_init, catalog_get_dir_oid_from_cache(), catalog_get_representation_item(), catalog_start_access_with_dir_oid(), cls_info::ci_hfid, cls_info::ci_rep_dir, catalog_access_info::class_oid, CLS_INFO_INITIALIZER, db_private_alloc, catalog_access_info::dir_oid, ER_CT_INVALID_REPRID, er_errid(), ER_ERROR_SEVERITY, ER_FAILED, er_set(), ER_SP_UNKNOWN_SLOTID, error(), disk_representation::fixed, heap_scancache_end(), heap_scancache_quick_start_root_hfid(), i, recdes::length, disk_attribute::n_btstats, disk_representation::n_fixed, disk_representation::n_variable, NO_ERROR, NULL, NULL_CHN, NULL_PAGEID, NULL_REPRID, NULL_SLOTID, NULL_VOLID, catalog_record::offset, OID_ISNULL, or_class_hfid(), or_class_rep_dir(), catalog_repr_item::page_id, catalog_record::page_p, vpid::pageid, PEEK, pgbuf_unfix_and_init, catalog_record::recdes, catalog_repr_item::repr_id, S_LOCK, S_SUCCESS, catalog_repr_item::slot_id, catalog_record::slotid, disk_attribute::value, disk_representation::variable, vpid::volid, and catalog_record::vpid.

Referenced by catalog_dump(), catalog_get_cardinality(), catalog_update(), catcls_find_btid_of_class_name(), catcls_get_or_value_from_record(), catcls_put_or_value_into_record(), catcls_reorder_attributes_by_repr(), qexec_execute_build_indexes(), stats_update_partitioned_statistics(), xstats_get_statistics_from_server(), and xstats_update_statistics().

Here is the caller graph for this function:

int catalog_get_representation_directory ( THREAD_ENTRY thread_p,
OID class_id_p,
REPR_ID **  repr_id_set_p,
int *  repr_count_p 
)
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 
)
static
static void catalog_initialize_max_space ( CATALOG_MAX_SPACE header_p)
static
static int catalog_key_compare ( void *  key1,
void *  key2 
)
static
static int catalog_key_copy ( void *  src,
void *  dest 
)
static
static unsigned int catalog_key_hash ( void *  key,
int  htsize 
)
static

Definition at line 1057 of file system_catalog.c.

References catalog_key::repr_id.

static int catalog_read_unread_portion ( THREAD_ENTRY thread_p,
CATALOG_RECORD catalog_record_p,
int  format_size 
)
static
int catalog_rv_delete_redo ( THREAD_ENTRY thread_p,
LOG_RCV recv_p 
)
int catalog_rv_delete_undo ( THREAD_ENTRY thread_p,
LOG_RCV recv_p 
)

Definition at line 5654 of file system_catalog.c.

References catalog_clear_hash_table(), and catalog_rv_insert_redo().

int catalog_rv_insert_undo ( THREAD_ENTRY thread_p,
LOG_RCV recv_p 
)
int catalog_rv_ovf_page_logical_insert_undo ( THREAD_ENTRY thread_p,
LOG_RCV recv_p 
)
static int catalog_store_attribute_value ( THREAD_ENTRY thread_p,
void *  value,
int  length,
CATALOG_RECORD ct_recordp,
PGSLOTID remembered_slotid 
)
static
static int catalog_store_btree_statistics ( THREAD_ENTRY thread_p,
BTREE_STATS bt_statsp,
CATALOG_RECORD ct_recordp,
PGSLOTID remembered_slotid 
)
static
static int catalog_store_disk_attribute ( THREAD_ENTRY thread_p,
DISK_ATTR disk_attrp,
CATALOG_RECORD ct_recordp,
PGSLOTID remembered_slotid 
)
static
static int catalog_store_disk_representation ( THREAD_ENTRY thread_p,
DISK_REPR disk_reprp,
CATALOG_RECORD ct_recordp,
PGSLOTID remembered_slotid 
)
static
static int catalog_sum_disk_attribute_size ( DISK_ATTR attrs_p,
int  count 
)
static

Definition at line 2740 of file system_catalog.c.

References CATALOG_BT_STATS_SIZE, CATALOG_DISK_ATTR_SIZE, cubregex::count(), i, MAX_ALIGNMENT, disk_attribute::n_btstats, and disk_attribute::val_length.

Referenced by catalog_add_representation().

Here is the caller graph for this function:

static int catalog_write_unwritten_portion ( THREAD_ENTRY thread_p,
CATALOG_RECORD catalog_record_p,
PGSLOTID remembered_slot_id_p,
int  format_size 
)
static

Variable Documentation

LF_ENTRY_DESCRIPTOR catalog_entry_Descriptor
static
Initial value:
= {
offsetof (CATALOG_ENTRY, stack),
offsetof (CATALOG_ENTRY, next),
offsetof (CATALOG_ENTRY, del_id),
offsetof (CATALOG_ENTRY, key),
0,
}
#define LF_EM_NOT_USING_MUTEX
Definition: lock_free.h:59
static void * catalog_entry_alloc(void)
#define NULL
Definition: freelistheap.h:34
static int catalog_entry_free(void *ent)
static int catalog_entry_uninit(void *ent)
static unsigned int catalog_key_hash(void *key, int htsize)
static int catalog_key_copy(void *src, void *dest)
static int catalog_entry_init(void *ent)
static int catalog_key_compare(void *key1, void *key2)

Definition at line 203 of file system_catalog.c.

catalog_hashmap_type catalog_Hashmap
static

Definition at line 271 of file system_catalog.c.

CTID catalog_Id

Definition at line 260 of file system_catalog.c.

bool catalog_is_header_initialized = false
static

Definition at line 275 of file system_catalog.c.

Referenced by catalog_create(), and catalog_initialize().

PGLENGTH catalog_Max_record_size
static

Definition at line 261 of file system_catalog.c.

Referenced by catalog_initialize().

CATALOG_MAX_SPACE catalog_Max_space
static

Definition at line 273 of file system_catalog.c.

pthread_mutex_t catalog_Max_space_lock = PTHREAD_MUTEX_INITIALIZER
static
int rv
static

Definition at line 54 of file system_catalog.c.

Referenced by catalog_initialize_max_space(), and catalog_update_max_space().