CUBRID Engine
latest
|
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <assert.h>
#include "porting.h"
#include "chartype.h"
#include "error_manager.h"
#include "databases_file.h"
#include "boot.h"
#include "connection_defs.h"
#include "memory_alloc.h"
#include "environment_variable.h"
#include "system_parameter.h"
Go to the source code of this file.
Macros | |
#define | CFG_MAX_LINE 4096 |
Functions | |
static char * | cfg_next_char (char *str_p) |
static char * | cfg_next_line (char *str_p) |
static char * | cfg_pop_token (char *str_p, char **token_p) |
static char * | cfg_pop_linetoken (char *str_p, char **token_p) |
static void | cfg_get_directory_filename (char *buffer, int *local) |
static int | cfg_ensure_directory_write (void) |
static FILE * | cfg_open_directory_file (bool write_flag) |
static char ** | cfg_copy_hosts (const char **host_array, int *num_hosts) |
static const char * | cfg_pop_host (const char *host_list, char *buffer, int *length) |
static bool | cfg_host_exists (char *host_list, char *hostname, int num_items) |
char * | cfg_os_working_directory (void) |
char * | cfg_maycreate_get_directory_filename (char *buffer) |
int | cfg_read_directory (DB_INFO **info_p, bool write_flag) |
int | cfg_read_directory_ex (int vdes, DB_INFO **info_p, bool write_flag) |
void | cfg_write_directory (const DB_INFO *databases) |
void | cfg_write_directory_ex (int vdes, const DB_INFO *databases) |
void | cfg_free_directory (DB_INFO *databases) |
void | cfg_update_db (DB_INFO *db_info_p, const char *path, const char *logpath, const char *lobpath, const char *host) |
DB_INFO * | cfg_new_db (const char *name, const char *path, const char *logpath, const char *lobpath, const char **hosts) |
DB_INFO * | cfg_find_db_list (DB_INFO *db_info_list_p, const char *name) |
DB_INFO * | cfg_add_db (DB_INFO **dir, const char *name, const char *path, const char *logpath, const char *lobpath, const char *host) |
DB_INFO * | cfg_find_db (const char *db_name) |
bool | cfg_delete_db (DB_INFO **dir_info_p, const char *name) |
char ** | cfg_get_hosts (const char *prim_host, int *count, bool include_local_host) |
void | cfg_free_hosts (char **host_array) |
char * | cfg_create_host_list (const char *primary_host_name, bool include_local_host, int *count) |
Variables | |
static char | CFG_HOST_SEPARATOR = ':' |
#define CFG_MAX_LINE 4096 |
Definition at line 61 of file databases_file.c.
Referenced by cfg_read_directory().
DB_INFO* cfg_add_db | ( | DB_INFO ** | dir, |
const char * | name, | ||
const char * | path, | ||
const char * | logpath, | ||
const char * | lobpath, | ||
const char * | host | ||
) |
Definition at line 1035 of file databases_file.c.
References cfg_new_db(), host, database_info::next, and NULL.
Referenced by installdb(), xboot_copy(), xboot_initialize_server(), and xboot_soft_rename().
|
static |
Definition at line 1356 of file databases_file.c.
References ARG_FILE_LINE, assert, ER_ERROR_SEVERITY, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), free_and_init, host, NULL, and strlen.
Referenced by cfg_new_db().
Definition at line 1425 of file databases_file.c.
References assert, cfg_host_exists(), CFG_HOST_SEPARATOR, cfg_pop_host(), CUB_MAXHOSTNAMELEN, free_and_init, GETHOSTNAME, NULL, prm_get_string_value(), PRM_ID_CFG_DB_HOSTS, and strlen.
Referenced by cfg_get_hosts().
Definition at line 1128 of file databases_file.c.
References cfg_free_directory(), database_info::name, database_info::next, NULL, and success().
Referenced by installdb(), xboot_delete(), and xboot_soft_rename().
|
static |
Definition at line 303 of file databases_file.c.
References ARG_FILE_LINE, cfg_get_directory_filename(), ER_CFG_NO_WRITE_ACCESS, ER_ERROR_SEVERITY, er_set_with_oserror(), and NULL.
Referenced by cfg_read_directory().
Definition at line 1067 of file databases_file.c.
References ARG_FILE_LINE, cfg_find_db_list(), cfg_free_directory(), cfg_new_db(), cfg_read_directory(), DATABASES_FILENAME, ER_CFG_FIND_DATABASE, ER_CFG_READ_DATABASES, ER_ERROR_SEVERITY, er_set(), ER_WARNING_SEVERITY, database_info::hosts, database_info::lobpath, database_info::logpath, database_info::name, NO_ERROR, NULL, and database_info::pathname.
Referenced by boot_restart_client(), installdb(), javasp_check_database(), main(), sboot_change_ha_mode(), and server_monitor_thr_f().
Definition at line 1008 of file databases_file.c.
Referenced by alterdbhost(), boot_restart_server(), cfg_find_db(), get_db_path(), print_backup_info(), xboot_copy(), xboot_delete(), xboot_emergency_patch(), xboot_initialize_server(), and xboot_soft_rename().
void cfg_free_directory | ( | DB_INFO * | databases | ) |
Definition at line 759 of file databases_file.c.
References cfg_free_hosts(), free_and_init, database_info::hosts, i, database_info::lobpath, database_info::logpath, database_info::name, database_info::next, NULL, and database_info::pathname.
Referenced by alterdbhost(), boot_initialize_client(), boot_restart_client(), boot_restart_server(), cfg_delete_db(), cfg_find_db(), cfg_read_directory(), cfg_read_directory_ex(), gen_tz(), get_db_path(), installdb(), javasp_check_database(), print_backup_info(), qdata_list_dbs(), sboot_change_ha_mode(), server_monitor_thr_f(), tzc_compute_timezone_checksum(), xboot_copy(), xboot_delete(), xboot_emergency_patch(), xboot_initialize_server(), and xboot_soft_rename().
void cfg_free_hosts | ( | char ** | host_array | ) |
Definition at line 1222 of file databases_file.c.
References free_and_init, and NULL.
Referenced by alterdbhost(), boot_restart_client(), cfg_free_directory(), and cfg_update_db().
|
static |
Definition at line 220 of file databases_file.c.
References DATABASES_ENVNAME, DATABASES_FILENAME, envvar_get(), envvar_vardir_file(), NULL, and strlen.
Referenced by cfg_ensure_directory_write(), cfg_maycreate_get_directory_filename(), and cfg_open_directory_file().
Definition at line 1174 of file databases_file.c.
References cfg_create_host_list(), CFG_HOST_SEPARATOR, cubregex::count(), free_and_init, i, and NULL.
Referenced by alterdbhost(), boot_client_all_finalize(), boot_restart_client(), cfg_new_db(), cfg_read_directory(), cfg_read_directory_ex(), and cfg_update_db().
|
static |
Definition at line 1311 of file databases_file.c.
References CAST_STRLEN, CFG_HOST_SEPARATOR, i, NULL, and strlen.
Referenced by cfg_create_host_list().
char* cfg_maycreate_get_directory_filename | ( | char * | buffer | ) |
Definition at line 277 of file databases_file.c.
References ARG_FILE_LINE, cfg_get_directory_filename(), ER_CFG_NO_WRITE_ACCESS, ER_ERROR_SEVERITY, er_set_with_oserror(), ER_WARNING_SEVERITY, and NULL.
Referenced by alterdbhost(), boot_restart_server(), xboot_copy(), xboot_delete(), xboot_emergency_patch(), xboot_initialize_server(), and xboot_soft_rename().
DB_INFO* cfg_new_db | ( | const char * | name, |
const char * | path, | ||
const char * | logpath, | ||
const char * | lobpath, | ||
const char ** | hosts | ||
) |
Definition at line 904 of file databases_file.c.
References cfg_copy_hosts(), cfg_get_hosts(), cfg_os_working_directory(), DB_SIZEOF, error(), free_and_init, database_info::hosts, database_info::lobpath, database_info::logpath, database_info::name, database_info::next, NULL, database_info::num_hosts, database_info::pathname, and strdup().
Referenced by boot_initialize_client(), boot_restart_client(), cfg_add_db(), and cfg_find_db().
|
static |
Definition at line 86 of file databases_file.c.
References char_isspace(), and p.
Referenced by cfg_read_directory(), and cfg_read_directory_ex().
|
static |
Definition at line 105 of file databases_file.c.
References char_iseol(), and p.
Referenced by cfg_read_directory_ex().
|
static |
Definition at line 332 of file databases_file.c.
References ARG_FILE_LINE, cfg_get_directory_filename(), ER_CFG_NO_WRITE_ACCESS, ER_ERROR_SEVERITY, er_set_with_oserror(), and NULL.
Referenced by cfg_read_directory(), and cfg_write_directory().
char* cfg_os_working_directory | ( | void | ) |
Definition at line 257 of file databases_file.c.
References NULL.
Referenced by cfg_new_db().
Definition at line 1247 of file databases_file.c.
References CFG_HOST_SEPARATOR, char_isspace(), CUB_MAXHOSTNAMELEN, host, and NULL.
Referenced by cfg_create_host_list().
|
static |
Definition at line 174 of file databases_file.c.
References char_iseol(), char_isspace(), NULL, and p.
Referenced by cfg_read_directory_ex().
|
static |
Definition at line 135 of file databases_file.c.
References char_isspace(), NULL, and p.
Referenced by cfg_read_directory().
Definition at line 394 of file databases_file.c.
References ARG_FILE_LINE, cfg_ensure_directory_write(), cfg_free_directory(), cfg_get_hosts(), CFG_MAX_LINE, cfg_next_char(), cfg_open_directory_file(), cfg_pop_token(), DATABASES_FILENAME, ER_CFG_INVALID_DATABASES, ER_ERROR_SEVERITY, ER_FAILED, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), free_and_init, HA_DISABLED, database_info::hosts, database_info::lobpath, database_info::logpath, database_info::name, database_info::next, NO_ERROR, NULL, database_info::num_hosts, database_info::pathname, prm_get_string_value(), and PRM_ID_HA_NODE_LIST.
Referenced by alterdbhost(), boot_restart_server(), cfg_find_db(), cfg_read_directory_ex(), cfg_write_directory_ex(), gen_tz(), get_db_path(), installdb(), print_backup_info(), qdata_list_dbs(), tzc_compute_timezone_checksum(), xboot_copy(), xboot_delete(), xboot_emergency_patch(), xboot_initialize_server(), and xboot_soft_rename().
Definition at line 497 of file databases_file.c.
References ARG_FILE_LINE, cfg_free_directory(), cfg_get_hosts(), cfg_next_char(), cfg_next_line(), cfg_pop_linetoken(), cfg_read_directory(), DATABASES_FILENAME, ER_CFG_INVALID_DATABASES, ER_ERROR_SEVERITY, ER_FAILED, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), free_and_init, database_info::hosts, database_info::lobpath, database_info::logpath, database_info::name, database_info::next, NO_ERROR, NULL, database_info::num_hosts, and database_info::pathname.
Referenced by alterdbhost(), boot_restart_server(), xboot_copy(), xboot_delete(), xboot_emergency_patch(), xboot_initialize_server(), and xboot_soft_rename().
void cfg_update_db | ( | DB_INFO * | db_info_p, |
const char * | path, | ||
const char * | logpath, | ||
const char * | lobpath, | ||
const char * | host | ||
) |
Definition at line 847 of file databases_file.c.
References cfg_free_hosts(), cfg_get_hosts(), free_and_init, database_info::hosts, database_info::lobpath, database_info::logpath, NULL, database_info::num_hosts, database_info::pathname, and strdup().
Referenced by xboot_initialize_server(), and xboot_soft_rename().
Definition at line 599 of file databases_file.c.
References cfg_open_directory_file(), database_info::hosts, database_info::lobpath, database_info::logpath, database_info::name, database_info::next, NULL, database_info::pathname, and strlen.
Referenced by alterdbhost(), installdb(), xboot_copy(), xboot_delete(), xboot_initialize_server(), and xboot_soft_rename().
Definition at line 687 of file databases_file.c.
References cfg_read_directory(), database_info::hosts, database_info::lobpath, database_info::logpath, database_info::name, database_info::next, NULL, database_info::pathname, and strlen.
Referenced by alterdbhost(), xboot_copy(), xboot_delete(), xboot_initialize_server(), and xboot_soft_rename().
|
static |
Definition at line 63 of file databases_file.c.
Referenced by cfg_create_host_list(), cfg_get_hosts(), cfg_host_exists(), and cfg_pop_host().