CUBRID Engine
latest
|
#include <stdio.h>
#include <assert.h>
#include <time.h>
#include <libgen.h>
#include <errno.h>
#include <unistd.h>
#include "log_applier_sql_log.h"
#include "system_parameter.h"
#include "object_primitive.h"
#include "object_template.h"
#include "object_print.h"
#include "error_manager.h"
#include "parser.h"
#include "work_space.h"
#include "class_object.h"
#include "environment_variable.h"
#include "set_object.h"
#include "cci_applier.h"
#include "schema_manager.h"
#include "dbtype.h"
#include "db_value_printer.hpp"
#include "mem_block.hpp"
#include "string_buffer.hpp"
Go to the source code of this file.
Classes | |
struct | sl_info |
Macros | |
#define | SL_LOG_FILE_MAX_SIZE (prm_get_integer_value (PRM_ID_HA_SQL_LOG_MAX_SIZE_IN_MB) * 1024 * 1024) |
#define | FILE_ID_FORMAT "%d" |
#define | SQL_ID_FORMAT "%010u" |
#define | CATALOG_FORMAT FILE_ID_FORMAT " | " SQL_ID_FORMAT |
Typedefs | |
typedef struct sl_info | SL_INFO |
Functions | |
static int | sl_write_sql (string_buffer &query, string_buffer *select) |
static void | sl_print_insert_att_names (string_buffer &strbuf, OBJ_TEMPASSIGN **assignments, int num_assignments) |
static void | sl_print_insert_att_values (string_buffer &strbuf, OBJ_TEMPASSIGN **assignments, int num_assignments) |
static int | sl_print_pk (string_buffer &strbuf, SM_CLASS *sm_class, DB_VALUE *key) |
static void | sl_print_midxkey (string_buffer &strbuf, SM_ATTRIBUTE **attributes, const DB_MIDXKEY *midxkey) |
static void | sl_print_update_att_set (string_buffer &strbuf, OBJ_TEMPASSIGN **assignments, int num_assignments) |
static void | sl_print_att_value (string_buffer &strbuf, const char *att_name, OBJ_TEMPASSIGN **assignments, int num_assignments) |
static DB_VALUE * | sl_find_att_value (const char *att_name, OBJ_TEMPASSIGN **assignments, int num_assignments) |
static FILE * | sl_open_next_file (FILE *old_fp) |
static FILE * | sl_log_open (void) |
static int | sl_read_catalog (void) |
static int | sl_write_catalog (void) |
static int | create_dir (const char *new_dir) |
static char * | trim_single_quote (char *str, size_t len) |
static int | sl_print_select (string_buffer &strbuf, SM_CLASS *sm_class, DB_VALUE *key) |
int | sl_init (const char *db_name, const char *repl_log_path) |
int | sl_write_insert_sql (DB_OTMPL *inst_tp, DB_VALUE *key) |
int | sl_write_update_sql (DB_OTMPL *inst_tp, DB_VALUE *key) |
int | sl_write_delete_sql (char *class_name, MOBJ mclass, DB_VALUE *key) |
int | sl_write_statement_sql (char *class_name, char *db_user, int item_type, const char *stmt_text, char *ha_sys_prm) |
Variables | |
SL_INFO | sl_Info |
static FILE * | log_fp |
static FILE * | catalog_fp |
static char | sql_log_base_path [PATH_MAX] |
static char | sql_catalog_path [PATH_MAX] |
#define CATALOG_FORMAT FILE_ID_FORMAT " | " SQL_ID_FORMAT |
Definition at line 54 of file log_applier_sql_log.c.
Referenced by sl_read_catalog(), and sl_write_catalog().
#define FILE_ID_FORMAT "%d" |
Definition at line 52 of file log_applier_sql_log.c.
#define SL_LOG_FILE_MAX_SIZE (prm_get_integer_value (PRM_ID_HA_SQL_LOG_MAX_SIZE_IN_MB) * 1024 * 1024) |
Definition at line 50 of file log_applier_sql_log.c.
Referenced by sl_log_open(), and sl_write_sql().
#define SQL_ID_FORMAT "%010u" |
Definition at line 53 of file log_applier_sql_log.c.
Definition at line 56 of file log_applier_sql_log.c.
|
static |
|
static |
Definition at line 293 of file log_applier_sql_log.c.
References i, NULL, and obj_tempassign::variable.
Referenced by sl_print_att_value(), and sl_write_update_sql().
Definition at line 171 of file log_applier_sql_log.c.
References basename(), catalog_fp, create_dir(), sl_info::curr_file_id, ER_FAILED, sl_info::last_inserted_sql_id, log_fp, NO_ERROR, NULL, sl_read_catalog(), sql_catalog_path, and sql_log_base_path.
Referenced by la_apply_log_file().
|
static |
Definition at line 556 of file log_applier_sql_log.c.
References ARG_FILE_LINE, assert, sl_info::curr_file_id, er_log_debug, NULL, SL_LOG_FILE_MAX_SIZE, sl_open_next_file(), and sql_log_base_path.
Referenced by sl_write_sql().
|
static |
Definition at line 590 of file log_applier_sql_log.c.
References assert, sl_info::curr_file_id, sl_info::last_inserted_sql_id, NO_ERROR, NULL, sl_write_catalog(), and sql_log_base_path.
Referenced by sl_log_open(), and sl_write_sql().
|
static |
Definition at line 307 of file log_applier_sql_log.c.
References db_value_printer::describe_value(), NULL, and sl_find_att_value().
Referenced by sl_write_update_sql().
|
static |
Definition at line 237 of file log_applier_sql_log.c.
References i.
Referenced by sl_write_insert_sql().
|
static |
Definition at line 250 of file log_applier_sql_log.c.
References db_value_printer::describe_value(), and i.
Referenced by sl_write_insert_sql().
|
static |
Definition at line 271 of file log_applier_sql_log.c.
References db_value_printer::describe_value(), i, db_midxkey::ncolumns, NULL, and pr_midxkey_get_element_nocopy().
Referenced by sl_print_pk().
|
static |
Definition at line 209 of file log_applier_sql_log.c.
References sm_class_constraint::attributes, classobj_find_class_primary_key(), db_get_midxkey(), DB_TYPE_MIDXKEY, DB_VALUE_TYPE, db_value_printer::describe_value(), ER_FAILED, sm_attribute::header, sm_component::name, NO_ERROR, NULL, and sl_print_midxkey().
Referenced by sl_print_select(), sl_write_delete_sql(), and sl_write_update_sql().
|
static |
Definition at line 98 of file log_applier_sql_log.c.
References ER_FAILED, NO_ERROR, sl_print_pk(), and sm_ch_name().
Referenced by sl_write_delete_sql(), sl_write_insert_sql(), and sl_write_update_sql().
|
static |
Definition at line 319 of file log_applier_sql_log.c.
References db_value_printer::describe_value(), and i.
Referenced by sl_write_update_sql().
|
static |
Definition at line 139 of file log_applier_sql_log.c.
References CATALOG_FORMAT, sl_info::curr_file_id, ER_FAILED, sl_info::last_inserted_sql_id, NO_ERROR, NULL, sl_write_catalog(), and sql_catalog_path.
Referenced by sl_init().
|
static |
Definition at line 113 of file log_applier_sql_log.c.
References ARG_FILE_LINE, CATALOG_FORMAT, catalog_fp, sl_info::curr_file_id, ER_FAILED, er_log_debug, sl_info::last_inserted_sql_id, NO_ERROR, NULL, and sql_catalog_path.
Referenced by sl_open_next_file(), sl_read_catalog(), and sl_write_sql().
Definition at line 423 of file log_applier_sql_log.c.
References ER_FAILED, NO_ERROR, sl_print_pk(), sl_print_select(), and sl_write_sql().
Referenced by la_apply_delete_log().
Definition at line 335 of file log_applier_sql_log.c.
References obj_template::assignments, obj_template::class_, ER_FAILED, obj_template::nassigns, NO_ERROR, sl_print_insert_att_names(), sl_print_insert_att_values(), sl_print_select(), sl_write_sql(), and sm_ch_name().
Referenced by la_apply_insert_log().
|
static |
Definition at line 507 of file log_applier_sql_log.c.
References assert, ER_FAILED, string_buffer::get_buffer(), sl_info::last_inserted_sql_id, string_buffer::len(), log_fp, NO_ERROR, NULL, SL_LOG_FILE_MAX_SIZE, sl_log_open(), sl_open_next_file(), and sl_write_catalog().
Referenced by sl_write_delete_sql(), sl_write_insert_sql(), sl_write_statement_sql(), and sl_write_update_sql().
int sl_write_statement_sql | ( | char * | class_name, |
char * | db_user, | ||
int | item_type, | ||
const char * | stmt_text, | ||
char * | ha_sys_prm | ||
) |
Definition at line 445 of file log_applier_sql_log.c.
References string_buffer::clear(), CUBRID_STMT_CREATE_CLASS, ER_FAILED, error(), NO_ERROR, NULL, PRM_ERR_NO_ERROR, rc, sl_write_sql(), strlen, sysprm_make_default_values(), and sysprm_set_error().
Referenced by la_apply_statement_log().
Definition at line 361 of file log_applier_sql_log.c.
References obj_template::assignments, obj_template::class_, ER_FAILED, string_buffer::get_buffer(), string_buffer::len(), obj_template::nassigns, NO_ERROR, NULL, numeric_db_value_add(), numeric_db_value_print(), NUMERIC_MAX_STRING_SIZE, sl_find_att_value(), sl_print_att_value(), sl_print_pk(), sl_print_select(), sl_print_update_att_set(), sl_write_sql(), sm_ch_name(), and trim_single_quote().
Referenced by la_apply_update_log().
|
static |
Definition at line 87 of file log_applier_sql_log.c.
Referenced by sl_write_update_sql().
|
static |
Definition at line 66 of file log_applier_sql_log.c.
Referenced by sl_init(), and sl_write_catalog().
|
static |
Definition at line 65 of file log_applier_sql_log.c.
Referenced by sl_init(), and sl_write_sql().
SL_INFO sl_Info |
Definition at line 63 of file log_applier_sql_log.c.
|
static |
Definition at line 68 of file log_applier_sql_log.c.
Referenced by sl_init(), sl_read_catalog(), and sl_write_catalog().
|
static |
Definition at line 67 of file log_applier_sql_log.c.
Referenced by sl_init(), sl_log_open(), and sl_open_next_file().