CUBRID Engine  latest
compactdb_cl.c File Reference
#include "config.h"
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <assert.h>
#include "porting.h"
#include "dbtype.h"
#include "load_object.h"
#include "db.h"
#include "locator_cl.h"
#include "schema_manager.h"
#include "object_accessor.h"
#include "set_object.h"
#include "message_catalog.h"
#include "network_interface_cl.h"
#include "server_interface.h"
#include "system_parameter.h"
#include "utility.h"
#include "authenticate.h"
#include "transaction_cl.h"
#include "execute_schema.h"
#include "object_primitive.h"

Go to the source code of this file.

Macros

#define COMPACT_MIN_PAGES   1
 
#define COMPACT_MAX_PAGES   20
 
#define COMPACT_INSTANCE_MIN_LOCK_TIMEOUT   1
 
#define COMPACT_INSTANCE_MAX_LOCK_TIMEOUT   10
 
#define COMPACT_CLASS_MIN_LOCK_TIMEOUT   1
 
#define COMPACT_CLASS_MAX_LOCK_TIMEOUT   10
 

Functions

static int is_not_system_class (MOBJ class_)
 
static int do_reclaim_addresses (OID *const *class_oids, const int num_class_oids, int *const num_classes_fully_processed, const bool verbose, const int class_lock_timeout)
 
static int do_reclaim_class_addresses (const OID class_oid, char **clas_name, bool *const any_class_can_be_referenced, bool *const correctly_processed, bool *const addresses_reclaimed, int *const error_while_processing)
 
static int class_instances_can_be_referenced (MOP mop, MOP parent_mop, bool *const class_can_be_referenced, bool *const any_class_can_be_referenced, MOP *const all_mops, const int num_mops)
 
static int class_referenced_by_class (MOP referenced_mop, MOP parent_mop, MOP referring_mop, bool *const class_can_be_referenced, bool *const any_class_can_be_referenced)
 
static int class_referenced_by_attributes (MOP referenced_class, MOP parent_mop, SM_ATTRIBUTE *const attributes_list, bool *const class_can_be_referenced, bool *const any_class_can_be_referenced)
 
static void class_referenced_by_domain (MOP referenced_class, TP_DOMAIN *const domain, bool *const class_can_be_referenced, bool *const any_class_can_be_referenced)
 
int get_class_mops (char **class_names, int num_class, MOP **class_list, int *num_class_list)
 
int get_class_mops_from_file (const char *input_filename, MOP **class_list, int *num_class_mops)
 
static void compactdb_usage (const char *argv0)
 
static int find_oid (OID *oid, OID **oids_list, int num_oids)
 
static void show_statistics (OID *class_oid, bool unlocked_class, bool valid_class, bool processed_class, int total_objects, int failed_objects, int modified_objects, int big_objects, bool delete_old_repr_flag, bool old_repr_deleted)
 
static char * get_name_from_class_oid (OID *class_oid)
 
static int compactdb_start (bool verbose_flag, bool delete_old_repr_flag, char *input_filename, char **input_class_names, int input_class_length, int max_processed_space, int instance_lock_timeout, int class_lock_timeout, DB_TRAN_ISOLATION tran_isolation)
 
int compactdb (UTIL_FUNCTION_ARG *arg)
 

Macro Definition Documentation

#define COMPACT_CLASS_MAX_LOCK_TIMEOUT   10

Definition at line 52 of file compactdb_cl.c.

Referenced by compactdb().

#define COMPACT_CLASS_MIN_LOCK_TIMEOUT   1

Definition at line 51 of file compactdb_cl.c.

Referenced by compactdb().

#define COMPACT_INSTANCE_MAX_LOCK_TIMEOUT   10

Definition at line 49 of file compactdb_cl.c.

Referenced by compactdb().

#define COMPACT_INSTANCE_MIN_LOCK_TIMEOUT   1

Definition at line 48 of file compactdb_cl.c.

Referenced by compactdb().

#define COMPACT_MAX_PAGES   20

Definition at line 46 of file compactdb_cl.c.

Referenced by compactdb().

#define COMPACT_MIN_PAGES   1

Definition at line 45 of file compactdb_cl.c.

Referenced by compactdb().

Function Documentation

static int class_instances_can_be_referenced ( MOP  mop,
MOP  parent_mop,
bool *const  class_can_be_referenced,
bool *const  any_class_can_be_referenced,
MOP *const  all_mops,
const int  num_mops 
)
static

Definition at line 1289 of file compactdb_cl.c.

References assert, class_referenced_by_class(), i, NO_ERROR, and NULL.

Referenced by do_reclaim_class_addresses().

Here is the caller graph for this function:

static int class_referenced_by_attributes ( MOP  referenced_class,
MOP  parent_mop,
SM_ATTRIBUTE *const  attributes_list,
bool *const  class_can_be_referenced,
bool *const  any_class_can_be_referenced 
)
static

Definition at line 1409 of file compactdb_cl.c.

References class_referenced_by_domain(), sm_attribute::domain, sm_attribute::header, sm_component::next, NO_ERROR, and NULL.

Referenced by class_referenced_by_class().

Here is the caller graph for this function:

static int class_referenced_by_class ( MOP  referenced_mop,
MOP  parent_mop,
MOP  referring_mop,
bool *const  class_can_be_referenced,
bool *const  any_class_can_be_referenced 
)
static
static void class_referenced_by_domain ( MOP  referenced_class,
TP_DOMAIN *const  domain,
bool *const  class_can_be_referenced,
bool *const  any_class_can_be_referenced 
)
static

Definition at line 1438 of file compactdb_cl.c.

References assert, db_domain_class(), db_domain_next(), db_domain_set(), db_is_subclass(), DB_TYPE_OBJECT, NULL, pr_is_set_type(), and TP_DOMAIN_TYPE.

Referenced by class_referenced_by_attributes().

Here is the caller graph for this function:

static int compactdb_start ( bool  verbose_flag,
bool  delete_old_repr_flag,
char *  input_filename,
char **  input_class_names,
int  input_class_length,
int  max_processed_space,
int  instance_lock_timeout,
int  class_lock_timeout,
DB_TRAN_ISOLATION  tran_isolation 
)
static
static void compactdb_usage ( const char *  argv0)
static

Definition at line 81 of file compactdb_cl.c.

References basename(), MSGCAT_CATALOG_UTILS, msgcat_message(), MSGCAT_UTIL_GENERIC_INVALID_ARGUMENT, MSGCAT_UTIL_SET_COMPACTDB, and util_log_write_errid().

Referenced by compactdb().

Here is the caller graph for this function:

static int do_reclaim_addresses ( OID *const class_oids,
const int  num_class_oids,
int *const  num_classes_fully_processed,
const bool  verbose,
const int  class_lock_timeout 
)
static
static int find_oid ( OID oid,
OID **  oids_list,
int  num_oids 
)
static

Definition at line 98 of file compactdb_cl.c.

References i, NULL, and OID_EQ.

Referenced by compactdb_start().

Here is the caller graph for this function:

int get_class_mops ( char **  class_names,
int  num_class,
MOP **  class_list,
int *  num_class_list 
)
int get_class_mops_from_file ( const char *  input_filename,
MOP **  class_list,
int *  num_class_mops 
)

Definition at line 165 of file compactdb_common.c.

References CAST_BUFLEN, DB_MAX_IDENTIFIER_LENGTH, DB_SIZEOF, ER_FAILED, free_and_init, get_class_mops(), get_num_requested_class(), i, NO_ERROR, NULL, and strlen.

Referenced by compactdb_start().

Here is the caller graph for this function:

static char* get_name_from_class_oid ( OID class_oid)
static

Definition at line 208 of file compactdb_cl.c.

References db_get_class_name(), db_object(), NULL, and strlen.

Referenced by compactdb_start().

Here is the caller graph for this function:

static int is_not_system_class ( MOBJ  class_)
static

Definition at line 1009 of file compactdb_cl.c.

References SM_CLASSFLAG_SYSTEM.

Referenced by do_reclaim_class_addresses().

Here is the caller graph for this function:

static void show_statistics ( OID class_oid,
bool  unlocked_class,
bool  valid_class,
bool  processed_class,
int  total_objects,
int  failed_objects,
int  modified_objects,
int  big_objects,
bool  delete_old_repr_flag,
bool  old_repr_deleted 
)
static