CUBRID Engine  latest
util_sa.c File Reference
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>
#include "porting.h"
#include "chartype.h"
#include "error_manager.h"
#include "message_catalog.h"
#include "databases_file.h"
#include "environment_variable.h"
#include "system_parameter.h"
#include "boot_sr.h"
#include "db.h"
#include "authenticate.h"
#include "schema_manager.h"
#include "heap_file.h"
#include "btree.h"
#include "extendible_hash.h"
#include "locator_sr.h"
#include "xserver_interface.h"
#include "utility.h"
#include "transform.h"
#include "csql.h"
#include "locator_cl.h"
#include "network_interface_cl.h"
#include "locale_support.h"
#include "tz_support.h"
#include "tz_compile.h"
#include "boot_cl.h"
#include "tsc_timer.h"
#include <dlfcn.h>
#include "dbtype.h"
#include "thread_manager.hpp"
#include "log_volids.hpp"

Go to the source code of this file.

Macros

#define MAX_LINE_LEN   4096
 
#define COMMENT_CHAR   '-'
 
#define COMMAND_USER   "user"
 
#define COMMAND_GROUP   "group"
 
#define COMMAND_MEMBERS   "members"
 
#define COMMAND_GROUPS   "groups"
 
#define BO_DB_FULLNAME   (bo_Dbfullname)
 
#define FILE_STMT_NAME   "cubrid_synccolldb_"
 
#define QUERY_SIZE   1024
 
#define QUERY_BUF_SIZE   2048
 
#define APPLY_INFO_VALUES   15
 
#define QUERY_BUF_SIZE   2048
 
#define APPLY_INFO_VALUES   2
 
#define QUERY_BUF_SIZE   2048
 

Enumerations

enum  DIAGDUMP_TYPE {
  DIAGDUMP_ALL = -1, DIAGDUMP_FILE_TABLES = 1, DIAGDUMP_FILE_CAPACITIES, DIAGDUMP_HEAP_CAPACITIES,
  DIAGDUMP_INDEX_CAPACITIES, DIAGDUMP_CLASSNAMES, DIAGDUMP_DISK_BITMAPS, DIAGDUMP_CATALOG,
  DIAGDUMP_LOG, DIAGDUMP_HEAP, DIAGDUMP_END_OF_OPTION
}
 

Functions

int catcls_compile_catalog_classes (THREAD_ENTRY *thread_p)
 
int catcls_get_db_collation (THREAD_ENTRY *thread_p, LANG_COLL_COMPAT **db_collations, int *coll_cnt)
 
static int parse_user_define_line (char *line, FILE *output_file)
 
static int parse_user_define_file (FILE *user_define_file, FILE *output_file)
 
static int parse_up_to_date (char *up_to_date, struct tm *time_date)
 
static int print_backup_info (char *database_name, BO_RESTART_ARG *restart_arg)
 
static int synccoll_check (const char *db_name, int *db_obs_coll_cnt, int *new_sys_coll_cnt)
 
static int delete_all_ha_apply_info (void)
 
static int insert_ha_apply_info (char *database_name, char *master_host_name, INT64 database_creation, INT64 pageid, int offset)
 
static int delete_all_slave_ha_apply_info (char *database_name, char *master_host_name)
 
static bool check_ha_db_and_node_list (char *database_name, char *source_host_name)
 
void util_admin_usage (const char *argv0)
 
void util_admin_version (const char *argv0)
 
static void make_valid_page_size (int *v)
 
int createdb (UTIL_FUNCTION_ARG *arg)
 
int deletedb (UTIL_FUNCTION_ARG *arg)
 
int restoredb (UTIL_FUNCTION_ARG *arg)
 
int renamedb (UTIL_FUNCTION_ARG *arg)
 
int installdb (UTIL_FUNCTION_ARG *arg)
 
int copydb (UTIL_FUNCTION_ARG *arg)
 
int optimizedb (UTIL_FUNCTION_ARG *arg)
 
int diagdb (UTIL_FUNCTION_ARG *arg)
 
int patchdb (UTIL_FUNCTION_ARG *arg)
 
int alterdbhost (UTIL_FUNCTION_ARG *arg)
 
int genlocale (UTIL_FUNCTION_ARG *arg)
 
int dumplocale (UTIL_FUNCTION_ARG *arg)
 
int synccolldb (UTIL_FUNCTION_ARG *arg)
 
int synccoll_force (void)
 
int restoreslave (UTIL_FUNCTION_ARG *arg)
 
int gen_tz (UTIL_FUNCTION_ARG *arg)
 
int dump_tz (UTIL_FUNCTION_ARG *arg)
 

Variables

static char bo_Dbfullname [PATH_MAX]
 
bool catcls_Enable
 
int log_default_input_for_archive_log_location
 

Macro Definition Documentation

#define APPLY_INFO_VALUES   15
#define APPLY_INFO_VALUES   2
#define BO_DB_FULLNAME   (bo_Dbfullname)

Definition at line 90 of file util_sa.c.

Referenced by alterdbhost(), and print_backup_info().

#define COMMAND_GROUP   "group"

Definition at line 81 of file util_sa.c.

#define COMMAND_GROUPS   "groups"

Definition at line 83 of file util_sa.c.

Referenced by parse_user_define_line().

#define COMMAND_MEMBERS   "members"

Definition at line 82 of file util_sa.c.

Referenced by parse_user_define_line().

#define COMMAND_USER   "user"

Definition at line 80 of file util_sa.c.

Referenced by parse_user_define_line().

#define COMMENT_CHAR   '-'

Definition at line 79 of file util_sa.c.

Referenced by parse_user_define_file().

#define FILE_STMT_NAME   "cubrid_synccolldb_"

Referenced by synccoll_check().

#define MAX_LINE_LEN   4096

Definition at line 77 of file util_sa.c.

Referenced by parse_user_define_file().

#define QUERY_BUF_SIZE   2048
#define QUERY_BUF_SIZE   2048
#define QUERY_BUF_SIZE   2048
#define QUERY_SIZE   1024

Referenced by synccoll_check().

Enumeration Type Documentation

Enumerator
DIAGDUMP_ALL 
DIAGDUMP_FILE_TABLES 
DIAGDUMP_FILE_CAPACITIES 
DIAGDUMP_HEAP_CAPACITIES 
DIAGDUMP_INDEX_CAPACITIES 
DIAGDUMP_CLASSNAMES 
DIAGDUMP_DISK_BITMAPS 
DIAGDUMP_CATALOG 
DIAGDUMP_LOG 
DIAGDUMP_HEAP 
DIAGDUMP_END_OF_OPTION 

Definition at line 1426 of file util_sa.c.

Function Documentation

int catcls_compile_catalog_classes ( THREAD_ENTRY thread_p)

Definition at line 4332 of file catalog_class.c.

Referenced by catcls_vclass_install(), and createdb().

Here is the caller graph for this function:

int catcls_get_db_collation ( THREAD_ENTRY thread_p,
LANG_COLL_COMPAT **  db_collations,
int *  coll_cnt 
)

Definition at line 4910 of file catalog_class.c.

Referenced by synccoll_check().

Here is the caller graph for this function:

static bool check_ha_db_and_node_list ( char *  database_name,
char *  source_host_name 
)
static

Definition at line 3685 of file util_sa.c.

References _ha_config::db_names, i, NO_ERROR, _ha_config::node_conf, node_name, NULL, _ha_config::num_node_conf, util_free_ha_conf(), util_is_localhost(), and util_make_ha_conf().

Referenced by restoreslave().

Here is the caller graph for this function:

int createdb ( UTIL_FUNCTION_ARG arg)

Definition at line 303 of file util_sa.c.

References UTIL_FUNCTION_ARG::arg_map, UTIL_FUNCTION_ARG::argv0, AU_DISABLE_PASSWORDS, au_dump_to_file(), au_force_write_new_auth(), CSQL_ARGUMENT::auto_commit, basename(), catcls_compile_catalog_classes(), catcls_Enable, char_isdigit(), check_new_database_name(), tz_data::checksum, UTIL_FUNCTION_ARG::command_name, CREATE_COMMENT_S, CREATE_CSQL_INITIALIZATION_FILE_S, CREATE_DB_PAGE_SIZE_L, CREATE_DB_PAGE_SIZE_S, CREATE_DB_VOLUME_SIZE_L, CREATE_DB_VOLUME_SIZE_S, CREATE_FILE_PATH_S, CREATE_LOB_PATH_S, CREATE_LOG_PAGE_COUNT_L, CREATE_LOG_PAGE_COUNT_S, CREATE_LOG_PAGE_SIZE_L, CREATE_LOG_PAGE_SIZE_S, CREATE_LOG_PATH_S, CREATE_LOG_VOLUME_SIZE_L, CREATE_LOG_VOLUME_SIZE_S, CREATE_MORE_VOLUME_FILE_S, CREATE_OUTPUT_FILE_S, CREATE_PAGE_SIZE_L, CREATE_PAGE_SIZE_S, CREATE_PAGES_L, CREATE_PAGES_S, CREATE_REPLACE_S, CREATE_SERVER_NAME_S, CREATE_USER_DEFINITION_FILE_S, CREATE_VERBOSE_S, CREATEDB_MSG_BAD_OUTPUT, CREATEDB_MSG_BAD_RANGE, CREATEDB_MSG_BAD_USERFILE, CREATEDB_MSG_CREATING, CREATEDB_MSG_FAILURE, CREATEDB_MSG_INVALID_SIZE, CREATEDB_MSG_USAGE, csql(), database_name, DB_CLIENT_TYPE_ADMIN_UTILITY, db_commit_transaction(), db_error_string(), db_init(), db_login(), CSQL_ARGUMENT::db_name, db_page_size(), db_set_client_type(), db_shutdown(), DISK_SECTOR_NPAGES, disk_sectors_to_extend_npages(), er_init(), ER_NEVER_EXIT, CSQL_ARGUMENT::in_file_name, IO_PAGESIZE, lang_db_put_charset(), make_valid_page_size(), max, tf_meta_class::mc_n_variable, min, MSGCAT_CATALOG_UTILS, msgcat_message(), MSGCAT_UTIL_GENERIC_INVALID_ARGUMENT, MSGCAT_UTIL_GENERIC_SERVICE_PROPERTY_FAIL, MSGCAT_UTIL_SET_CREATEDB, NO_ERROR, NULL, OPTION_STRING_TABLE, output_file, parse_user_define_file(), PRINT_AND_LOG_ERR_MSG, prm_get_bigint_value(), prm_get_name(), PRM_ID_DB_VOLUME_SIZE, PRM_ID_JAVA_STORED_PROCEDURE, PRM_ID_LOG_VOLUME_SIZE, PRM_ID_PB_NBUFFERS, PRM_ID_XASL_CACHE_MAX_ENTRIES, program_name, put_timezone_checksum(), sm_force_write_all_classes(), sm_mark_system_classes(), sm_update_all_catalog_statistics(), STATS_WITH_FULLSCAN, strlen, sysprm_check_range(), sysprm_get_range(), SYSPRM_LOAD_ALL, sysprm_load_and_init(), sysprm_set_force(), tf_compile_meta_classes(), tf_Metaclass_class, tz_get_data(), tz_load(), util_byte_to_size_string(), util_log_write_errid(), util_log_write_errstr(), util_print_deprecated(), util_size_string_to_byte(), utility_get_option_bool_value(), utility_get_option_int_value(), utility_get_option_string_table_size(), and utility_get_option_string_value().

static int delete_all_ha_apply_info ( void  )
static

Definition at line 3446 of file util_sa.c.

References AU_DISABLE, AU_ENABLE, CT_HA_APPLY_INFO_NAME, db_execute(), db_query_end(), error(), NO_ERROR, and QUERY_BUF_SIZE.

Referenced by restoreslave().

Here is the caller graph for this function:

static int delete_all_slave_ha_apply_info ( char *  database_name,
char *  master_host_name 
)
static
int dumplocale ( UTIL_FUNCTION_ARG arg)

Definition at line 2289 of file util_sa.c.

References UTIL_FUNCTION_ARG::arg_map, UTIL_FUNCTION_ARG::argv0, assert, basename(), DUMPLOCALE_ALPHABET_ALL_CASING, DUMPLOCALE_ALPHABET_LOWER_L, DUMPLOCALE_ALPHABET_LOWER_S, DUMPLOCALE_ALPHABET_S, DUMPLOCALE_ALPHABET_UPPER_L, DUMPLOCALE_ALPHABET_UPPER_S, DUMPLOCALE_CALENDAR_S, DUMPLOCALE_COLLATION_S, DUMPLOCALE_CONSOLE_CONV_S, DUMPLOCALE_END_VALUE_S, DUMPLOCALE_IDENTIFIER_ALPHABET_S, DUMPLOCALE_INPUT_PATH_S, DUMPLOCALE_IS_ALPHABET, DUMPLOCALE_IS_ALPHABET_LOWER, DUMPLOCALE_IS_ALPHABET_UPPER, DUMPLOCALE_IS_CALENDAR, DUMPLOCALE_IS_COLLATION_CP_ORDER, DUMPLOCALE_IS_COLLATION_WEIGHT_ORDER, DUMPLOCALE_IS_IDENTIFIER_ALPHABET, DUMPLOCALE_IS_IDENTIFIER_ALPHABET_LOWER, DUMPLOCALE_IS_IDENTIFIER_ALPHABET_UPPER, DUMPLOCALE_IS_NORMALIZATION, DUMPLOCALE_IS_NUMBERING, DUMPLOCALE_IS_TEXT_CONV, DUMPLOCALE_MSG_INCOMPAT_INPUT_SEL, DUMPLOCALE_MSG_INVALID_CP_RANGE, DUMPLOCALE_MSG_INVALID_LOCALE, DUMPLOCALE_MSG_USAGE, DUMPLOCALE_NORMALIZATION_S, DUMPLOCALE_NUMBERING_S, DUMPLOCALE_START_VALUE_S, DUMPLOCALE_WEIGHT_ORDER_S, ER_LOC_GEN, ER_LOC_INIT, error(), free_and_init, i, text_conversion::init_conv_func, lang_load_library(), lang_locale_data_load_from_lib(), locale_file::lib_file, LOC_LOCALE_STR_SIZE, locale_check_and_set_default_files(), locale_dump(), locale_dump_lib_collations(), locale_get_cfg_locales(), locale_file::locale_name, LOG_LOCALE_ERROR, MSGCAT_CATALOG_UTILS, msgcat_message(), MSGCAT_UTIL_GENERIC_INVALID_ARGUMENT, MSGCAT_UTIL_SET_DUMPLOCALE, NO_ERROR, NULL, OPTION_STRING_TABLE, strdup(), strlen, lang_locale_data::txt_conv, util_log_write_errid(), utility_get_option_bool_value(), utility_get_option_int_value(), utility_get_option_string_table_size(), utility_get_option_string_value(), and UTIL_FUNCTION_ARG::valid_arg.

static int insert_ha_apply_info ( char *  database_name,
char *  master_host_name,
INT64  database_creation,
INT64  pageid,
int  offset 
)
static
static void make_valid_page_size ( int *  v)
static

Definition at line 271 of file util_sa.c.

References IO_MAX_PAGE_SIZE, and IO_MIN_PAGE_SIZE.

Referenced by createdb().

Here is the caller graph for this function:

static int parse_up_to_date ( char *  up_to_date,
struct tm *  time_date 
)
static

Definition at line 793 of file util_sa.c.

References ER_GENERIC_ERROR, NO_ERROR, and NULL.

Referenced by restoredb().

Here is the caller graph for this function:

static int parse_user_define_file ( FILE *  user_define_file,
FILE *  output_file 
)
static

Definition at line 246 of file util_sa.c.

References COMMENT_CHAR, MAX_LINE_LEN, NO_ERROR, NULL, parse_user_define_line(), and strlen.

Referenced by createdb().

Here is the caller graph for this function:

static int parse_user_define_line ( char *  line,
FILE *  output_file 
)
static
static int print_backup_info ( char *  database_name,
BO_RESTART_ARG restart_arg 
)
static
int restoreslave ( UTIL_FUNCTION_ARG arg)

Definition at line 3736 of file util_sa.c.

References UTIL_FUNCTION_ARG::arg_map, UTIL_FUNCTION_ARG::argv0, AU_DISABLE_PASSWORDS, bo_restart_arg::backuppath, basename(), boot_shutdown_server(), check_ha_db_and_node_list(), UTIL_FUNCTION_ARG::command_name, database_name, DB_CLIENT_TYPE_ADMIN_UTILITY, db_commit_transaction(), bo_restart_arg::db_creation, db_datetime_to_string(), db_error_string(), db_localdatetime(), db_login(), db_restart(), db_set_client_type(), db_shutdown(), delete_all_ha_apply_info(), delete_all_slave_ha_apply_info(), ER_ALL_FINAL, er_init(), ER_NEVER_EXIT, insert_ha_apply_info(), bo_restart_arg::is_restore_from_backup, bo_restart_arg::keys_file_path, bo_restart_arg::level, MSGCAT_CATALOG_UTILS, msgcat_message(), MSGCAT_UTIL_GENERIC_INVALID_ARGUMENT, MSGCAT_UTIL_GENERIC_SERVICE_PROPERTY_FAIL, MSGCAT_UTIL_SET_RESTORESLAVE, bo_restart_arg::newvolpath, NO_ERROR, NULL, NULL_TRAN_INDEX, log_lsa::offset, OPTION_STRING_TABLE, log_lsa::pageid, PRINT_AND_LOG_ERR_MSG, print_backup_info(), bo_restart_arg::printtoc, prm_get_name(), PRM_ID_JAVA_STORED_PROCEDURE, bo_restart_arg::restart_repl_lsa, RESTORE_KEYS_FILE_PATH_S, bo_restart_arg::restore_slave, bo_restart_arg::restore_upto_bktime, RESTORESLAVE_BACKUP_FILE_PATH_S, RESTORESLAVE_LIST_S, RESTORESLAVE_MASTER_HOST_NAME_S, RESTORESLAVE_MSG_FAILURE, RESTORESLAVE_MSG_HA_CATALOG_FAIL, RESTORESLAVE_MSG_INVAILD_OPTIONS, RESTORESLAVE_MSG_INVAILD_STATE, RESTORESLAVE_MSG_USAGE, RESTORESLAVE_OUTPUT_FILE_S, RESTORESLAVE_SOURCE_STATE_S, RESTORESLAVE_USE_DATABASE_LOCATION_PATH_S, bo_restart_arg::stopat, SYSPRM_LOAD_ALL, sysprm_load_and_init(), sysprm_set_force(), TRUE, util_log_write_errid(), utility_get_option_bool_value(), utility_get_option_string_table_size(), utility_get_option_string_value(), and bo_restart_arg::verbose_file.

static int synccoll_check ( const char *  db_name,
int *  db_obs_coll_cnt,
int *  new_sys_coll_cnt 
)
static
int synccoll_force ( void  )

Definition at line 3411 of file util_sa.c.

References AU_DISABLE, AU_ENABLE, boot_add_collations(), CT_COLLATION_NAME, db_find_class(), db_truncate_class(), NO_ERROR, and NULL.

Referenced by main(), and synccolldb().

Here is the caller graph for this function:

void util_admin_usage ( const char *  argv0)
void util_admin_version ( const char *  argv0)

Definition at line 139 of file util_sa.c.

References basename(), MSGCAT_UTIL_GENERIC_VERSION, and utility_get_generic_message().

Variable Documentation

char bo_Dbfullname[PATH_MAX]
static

Definition at line 92 of file util_sa.c.

bool catcls_Enable
int log_default_input_for_archive_log_location

Definition at line 268 of file log_page_buffer.c.

Referenced by logpb_fetch_from_archive(), and restoredb().