CUBRID Engine  latest
unload_object.c File Reference
#include "config.h"
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <ctype.h>
#include <assert.h>
#include <sys/stat.h>
#include "authenticate.h"
#include "utility.h"
#include "load_object.h"
#include "log_lsa.hpp"
#include "file_hash.h"
#include "db.h"
#include "memory_hash.h"
#include "memory_alloc.h"
#include "locator_cl.h"
#include "schema_manager.h"
#include "locator.h"
#include "transform_cl.h"
#include "object_accessor.h"
#include "object_primitive.h"
#include "object_representation.h"
#include "set_object.h"
#include "message_catalog.h"
#include "server_interface.h"
#include "porting.h"
#include "unloaddb.h"
#include "system_parameter.h"
#include "transform.h"
#include "execute_schema.h"
#include "network_interface_cl.h"
#include "transaction_cl.h"
#include "dbtype.h"

Go to the source code of this file.

Macros

#define MARK_CLASS_REQUESTED(cl_no)   (class_requested[cl_no / 8] |= 1 << cl_no % 8)
 
#define MARK_CLASS_REFERENCED(cl_no)   (class_referenced[cl_no / 8] |= 1 << cl_no % 8)
 
#define MARK_CLASS_PROCESSED(cl_no)   (class_processed[cl_no / 8] |= 1 << cl_no % 8)
 
#define IS_CLASS_REQUESTED(cl_no)   (class_requested[cl_no / 8] & 1 << cl_no % 8)
 
#define IS_CLASS_REFERENCED(cl_no)   (class_referenced[cl_no / 8] & 1 << cl_no % 8)
 
#define IS_CLASS_PROCESSED(cl_no)   (class_processed[cl_no / 8] & 1 << cl_no % 8)
 
#define GAUGE_INTERVAL   1
 
#define OBJECT_SUFFIX   "_objects"
 
#define HEADER_FORMAT   "-------------------------------+--------------------------------\n"" %-25s | %23s \n""-------------------------------+--------------------------------\n"
 
#define MSG_FORMAT   " %-25s | %10ld (%3d%% / %5d%%)"
 

Functions

static int get_estimated_objs (HFID *hfid, int64_t *est_objects)
 
static int set_referenced_subclasses (DB_OBJECT *class_)
 
static bool check_referenced_domain (DB_DOMAIN *dom_list, bool set_cls_ref, int *num_cls_refp)
 
static void extractobjects_cleanup (void)
 
static void extractobjects_term_handler (int sig)
 
static bool mark_referenced_domain (SM_CLASS *class_ptr, int *num_set)
 
static void gauge_alarm_handler (int sig)
 
static int process_class (int cl_no)
 
static int process_object (DESC_OBJ *desc_obj, OID *obj_oid, int referenced_class)
 
static int process_set (DB_SET *set)
 
static int process_value (DB_VALUE *value)
 
static void update_hash (OID *object_oid, OID *class_oid, int *data)
 
static DB_OBJECTis_class (OID *obj_oid, OID *class_oid)
 
static int all_classes_processed (void)
 
int extract_objects (const char *exec_name, const char *output_dirname, const char *output_prefix)
 
int is_req_class (DB_OBJECT *class_)
 
static char * ltrim (char *s)
 
int get_requested_classes (const char *input_filename, DB_OBJECT *class_list[])
 

Variables

static char * output_filename = NULL
 
static int output_number = 0
 
static FH_TABLEobj_table = NULL
 
static FH_TABLEcl_table = NULL
 
static char * class_requested = NULL
 
static char * class_referenced = NULL
 
static char * class_processed = NULL
 
static OID null_oid
 
static const char * prohibited_classes []
 
static int64_t class_objects = 0
 
static int64_t total_objects = 0
 
static int failed_objects = 0
 
static int64_t approximate_class_objects = 0
 
static char * gauge_class_name
 
static int64_t total_approximate_class_objects = 0
 
static FILE * unloadlog_file = NULL
 

Macro Definition Documentation

#define GAUGE_INTERVAL   1

Definition at line 85 of file unload_object.c.

Referenced by gauge_alarm_handler(), and process_class().

#define HEADER_FORMAT   "-------------------------------+--------------------------------\n"" %-25s | %23s \n""-------------------------------+--------------------------------\n"

Definition at line 162 of file unload_object.c.

Referenced by extract_objects().

#define IS_CLASS_PROCESSED (   cl_no)    (class_processed[cl_no / 8] & 1 << cl_no % 8)

Definition at line 82 of file unload_object.c.

Referenced by process_class().

#define IS_CLASS_REFERENCED (   cl_no)    (class_referenced[cl_no / 8] & 1 << cl_no % 8)

Definition at line 80 of file unload_object.c.

Referenced by extract_objects(), process_class(), and set_referenced_subclasses().

#define IS_CLASS_REQUESTED (   cl_no)    (class_requested[cl_no / 8] & 1 << cl_no % 8)
#define MARK_CLASS_PROCESSED (   cl_no)    (class_processed[cl_no / 8] |= 1 << cl_no % 8)

Definition at line 76 of file unload_object.c.

Referenced by process_class().

#define MARK_CLASS_REFERENCED (   cl_no)    (class_referenced[cl_no / 8] |= 1 << cl_no % 8)

Definition at line 74 of file unload_object.c.

Referenced by extract_objects(), and set_referenced_subclasses().

#define MARK_CLASS_REQUESTED (   cl_no)    (class_requested[cl_no / 8] |= 1 << cl_no % 8)

Definition at line 72 of file unload_object.c.

Referenced by extract_objects().

#define MSG_FORMAT   " %-25s | %10ld (%3d%% / %5d%%)"

Definition at line 163 of file unload_object.c.

Referenced by gauge_alarm_handler(), and process_class().

#define OBJECT_SUFFIX   "_objects"

Definition at line 160 of file unload_object.c.

Referenced by extract_objects().

Function Documentation

static int all_classes_processed ( void  )
static

Definition at line 1820 of file unload_object.c.

References class_processed, class_referenced, and class_requested.

Referenced by extract_objects().

Here is the caller graph for this function:

static bool check_referenced_domain ( DB_DOMAIN dom_list,
bool  set_cls_ref,
int *  num_cls_refp 
)
static
int extract_objects ( const char *  exec_name,
const char *  output_dirname,
const char *  output_prefix 
)

Definition at line 432 of file unload_object.c.

References all_classes_processed(), au_fetch_class(), AU_FETCH_READ, AU_SELECT, text_output::buffer, cached_pages, check_referenced_domain(), class_processed, class_referenced, class_requested, text_output::count, datafile_per_class, db_attribute_name(), DB_FETCH_READ, DB_SIZEOF, sm_attribute::domain, error(), est_size, extractobjects_cleanup(), extractobjects_term_handler(), failed_objects, fh_create(), FH_OID_KEY, fh_put(), fopen_ex(), text_output::fp, free_and_init, get_estimated_objs(), hash_filename, sm_attribute::header, HEADER_FORMAT, HFID_IS_NULL, i, ID_ATTRIBUTE, ignore_err_flag, input_filename, text_output::iosize, IS_CLASS_REFERENCED, IS_CLASS_REQUESTED, is_req_class(), locator_fetch_set(), locator_get_append_lsa(), MARK_CLASS_REFERENCED, MARK_CLASS_REQUESTED, mark_referenced_domain(), MSGCAT_CATALOG_UTILS, msgcat_message(), MSGCAT_UTIL_SET_UNLOADDB, sm_component::name_space, sm_component::next, NO_ERROR, NULL, obj_out, OBJECT_SUFFIX, log_lsa::offset, oid_compare_equals(), oid_hash(), OR_PUT_NULL_OID, sm_attribute::order_link, os_set_signal_handler(), output_filename, page_size, log_lsa::pageid, PRINT_IDENTIFIER, process_class(), prohibited_classes, text_output::ptr, required_class_only, sm_ch_heap(), sm_ch_name(), sm_is_system_class(), sm_Root_class_mop, strlen, text_print(), text_print_flush(), total_approximate_class_objects, total_objects, UNLOADDB_MSG_INVALID_CACHED_PAGE_SIZE, UNLOADDB_MSG_INVALID_CACHED_PAGES, UNLOADDB_MSG_INVALID_DIR_NAME, UNLOADDB_MSG_LOG_LSA, UNLOADDB_MSG_OBJECTS_DUMPED, UNLOADDB_MSG_OBJECTS_FAILED, unloadlog_file, verbose_flag, ws_find(), WS_IS_DELETED, and ws_oid().

Referenced by unloaddb().

Here is the caller graph for this function:

static void extractobjects_cleanup ( void  )
static
static void extractobjects_term_handler ( int  sig)
static

Definition at line 374 of file unload_object.c.

References _exit(), and extractobjects_cleanup().

Referenced by extract_objects().

Here is the caller graph for this function:

static void gauge_alarm_handler ( int  sig)
static

Definition at line 1005 of file unload_object.c.

References approximate_class_objects, class_objects, gauge_class_name, GAUGE_INTERVAL, MSG_FORMAT, total_approximate_class_objects, and total_objects.

Referenced by process_class().

Here is the caller graph for this function:

static int get_estimated_objs ( HFID hfid,
int64_t *  est_objects 
)
static

Definition at line 189 of file unload_object.c.

References error(), heap_get_class_num_objects_pages(), and NO_ERROR.

Referenced by extract_objects(), and process_class().

Here is the caller graph for this function:

int get_requested_classes ( const char *  input_filename,
DB_OBJECT class_list[] 
)

Definition at line 1867 of file unload_object.c.

References DB_MAX_IDENTIFIER_LENGTH, error(), free_and_init, i, locator_find_class(), ltrim(), NULL, sm_downcase_name(), SM_MAX_IDENTIFIER_LENGTH, sm_partitioned_class_type(), and strlen.

Referenced by unloaddb().

Here is the caller graph for this function:

static DB_OBJECT * is_class ( OID obj_oid,
OID class_oid 
)
static

Definition at line 1786 of file unload_object.c.

References NULL, OID_EQ, sm_Root_class_mop, ws_mop(), and WS_OID.

Referenced by process_value().

Here is the caller graph for this function:

int is_req_class ( DB_OBJECT class_)

Definition at line 1802 of file unload_object.c.

References req_class_table.

Referenced by extract_objects(), filter_unrequired_classes(), and set_referenced_subclasses().

Here is the caller graph for this function:

static char* ltrim ( char *  s)
static

Definition at line 1837 of file unload_object.c.

References assert, begin(), and NULL.

Referenced by get_requested_classes().

Here is the caller graph for this function:

static bool mark_referenced_domain ( SM_CLASS class_ptr,
int *  num_set 
)
static
static int process_set ( DB_SET set)
static
static int set_referenced_subclasses ( DB_OBJECT class_)
static
static void update_hash ( OID object_oid,
OID class_oid,
int *  data 
)
static

Definition at line 1744 of file unload_object.c.

References error(), fh_get(), fh_put(), NO_ERROR, and NULL.

Referenced by process_object(), and process_value().

Here is the caller graph for this function:

Variable Documentation

int64_t approximate_class_objects = 0
static

Definition at line 155 of file unload_object.c.

Referenced by gauge_alarm_handler(), and process_class().

FH_TABLE* cl_table = NULL
static

Definition at line 92 of file unload_object.c.

int64_t class_objects = 0
static

Definition at line 151 of file unload_object.c.

Referenced by gauge_alarm_handler(), and process_class().

char* class_processed = NULL
static

Definition at line 96 of file unload_object.c.

Referenced by all_classes_processed(), extract_objects(), and extractobjects_cleanup().

char* class_referenced = NULL
static

Definition at line 95 of file unload_object.c.

Referenced by all_classes_processed(), extract_objects(), and extractobjects_cleanup().

char* class_requested = NULL
static

Definition at line 94 of file unload_object.c.

Referenced by all_classes_processed(), extract_objects(), and extractobjects_cleanup().

int failed_objects = 0
static

Definition at line 153 of file unload_object.c.

Referenced by extract_objects(), and process_class().

char* gauge_class_name
static

Definition at line 156 of file unload_object.c.

Referenced by gauge_alarm_handler(), and process_class().

OID null_oid
static

Definition at line 98 of file unload_object.c.

FH_TABLE* obj_table = NULL
static

Definition at line 91 of file unload_object.c.

char* output_filename = NULL
static
int output_number = 0
static

Definition at line 89 of file unload_object.c.

const char* prohibited_classes[]
static

Definition at line 100 of file unload_object.c.

Referenced by extract_objects().

int64_t total_approximate_class_objects = 0
static

Definition at line 157 of file unload_object.c.

Referenced by extract_objects(), gauge_alarm_handler(), and process_class().

int64_t total_objects = 0
static

Definition at line 152 of file unload_object.c.

Referenced by extract_objects(), gauge_alarm_handler(), and process_class().

FILE* unloadlog_file = NULL
static

Definition at line 164 of file unload_object.c.

Referenced by extract_objects(), and process_class().