Skip to content

File log_applier_sql_log.c

FileList > cubrid > src > transaction > log_applier_sql_log.c

Go to the source code of this file

  • #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 "schema_manager.h"
  • #include "dbtype.h"
  • #include "file_io.h"
  • #include "schema_system_catalog_constants.h"
  • #include "db_value_printer.hpp"
  • #include "mem_block.hpp"
  • #include "string_buffer.hpp"

Classes

Type Name
struct sl_info

Public Types

Type Name
typedef struct sl_info SL_INFO

Public Attributes

Type Name
SL_INFO sl_Info

Public Static Attributes

Type Name
FILE * catalog_fp
FILE * log_fp
char sql_catalog_path
char sql_log_base_path
unsigned int sql_log_max_cnt = 0

Public Functions

Type Name
int sl_init (const char * db_name, const char * repl_log_path)
int sl_write_delete_sql (char * class_name, MOBJ mclass, DB_VALUE * key)
int sl_write_insert_sql (DB_OTMPL * inst_tp, 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)
int sl_write_update_sql (DB_OTMPL * inst_tp, DB_VALUE * key)

Public Static Functions

Type Name
int sl_create_sql_log_dir (const char * repl_log_path, char * path_buf, int path_buf_size)
void sl_delete_oldest_file_if_needed (void)
DB_VALUE * sl_find_att_value (const char * att_name, OBJ_TEMPASSIGN ** assignments, int num_assignments)
FILE * sl_log_open (void)
FILE * sl_open_next_file (FILE * old_fp)
void sl_print_att_value (string_buffer & strbuf, const char * att_name, OBJ_TEMPASSIGN ** assignments, int num_assignments)
void sl_print_insert_att_names (string_buffer & strbuf, OBJ_TEMPASSIGN ** assignments, int num_assignments)
void sl_print_insert_att_values (string_buffer & strbuf, OBJ_TEMPASSIGN ** assignments, int num_assignments)
void sl_print_midxkey (string_buffer & strbuf, SM_ATTRIBUTE ** attributes, const DB_MIDXKEY * midxkey)
int sl_print_pk (string_buffer & strbuf, SM_CLASS * sm_class, DB_VALUE * key)
int sl_print_select (string_buffer & strbuf, SM_CLASS * sm_class, DB_VALUE * key)
void sl_print_update_att_set (string_buffer & strbuf, OBJ_TEMPASSIGN ** assignments, int num_assignments)
int sl_read_catalog (void)
int sl_write_catalog (void)
int sl_write_sql (string_buffer & query, string_buffer * select)
char * trim_single_quote (char * str, size_t len)

Macros

Type Name
define CATALOG_FORMAT [**FILE\_ID\_FORMAT**](log__applier__sql__log_8c.md#define-file_id_format) " \| " [**SQL\_ID\_FORMAT**](log__applier__sql__log_8c.md#define-sql_id_format)
define FILE_ID_FORMAT "%u"
define SL_LOG_FILE_MAX_SIZE ([**prm\_get\_integer\_value**](system__parameter_8h.md#function-prm_get_integer_value) (PRM\_ID\_HA\_SQL\_LOG\_MAX\_SIZE\_IN\_MB) \* 1024 \* 1024)
define SQL_ID_FORMAT "%010u"

Public Types Documentation

typedef SL_INFO

typedef struct sl_info SL_INFO;

Public Attributes Documentation

variable sl_Info

SL_INFO sl_Info;

Public Static Attributes Documentation

variable catalog_fp

FILE* catalog_fp;

variable log_fp

FILE* log_fp;

variable sql_catalog_path

char sql_catalog_path[PATH_MAX];

variable sql_log_base_path

char sql_log_base_path[PATH_MAX];

variable sql_log_max_cnt

unsigned int sql_log_max_cnt;

Public Functions Documentation

function sl_init

int sl_init (
    const  char * db_name,
    const  char * repl_log_path
) 

function sl_write_delete_sql

int sl_write_delete_sql (
    char * class_name,
    MOBJ mclass,
    DB_VALUE * key
) 

function sl_write_insert_sql

int sl_write_insert_sql (
    DB_OTMPL * inst_tp,
    DB_VALUE * key
) 

function sl_write_statement_sql

int sl_write_statement_sql (
    char * class_name,
    char * db_user,
    int item_type,
    const  char * stmt_text,
    char * ha_sys_prm
) 

function sl_write_update_sql

int sl_write_update_sql (
    DB_OTMPL * inst_tp,
    DB_VALUE * key
) 

Public Static Functions Documentation

function sl_create_sql_log_dir

static int sl_create_sql_log_dir (
    const  char * repl_log_path,
    char * path_buf,
    int path_buf_size
) 

function sl_delete_oldest_file_if_needed

static void sl_delete_oldest_file_if_needed (
    void
) 

function sl_find_att_value

static DB_VALUE * sl_find_att_value (
    const  char * att_name,
    OBJ_TEMPASSIGN ** assignments,
    int num_assignments
) 

function sl_log_open

static FILE * sl_log_open (
    void
) 

function sl_open_next_file

static FILE * sl_open_next_file (
    FILE * old_fp
) 

function sl_print_att_value

static void sl_print_att_value (
    string_buffer & strbuf,
    const  char * att_name,
    OBJ_TEMPASSIGN ** assignments,
    int num_assignments
) 

function sl_print_insert_att_names

static void sl_print_insert_att_names (
    string_buffer & strbuf,
    OBJ_TEMPASSIGN ** assignments,
    int num_assignments
) 

function sl_print_insert_att_values

static void sl_print_insert_att_values (
    string_buffer & strbuf,
    OBJ_TEMPASSIGN ** assignments,
    int num_assignments
) 

function sl_print_midxkey

static void sl_print_midxkey (
    string_buffer & strbuf,
    SM_ATTRIBUTE ** attributes,
    const  DB_MIDXKEY * midxkey
) 

function sl_print_pk

static int sl_print_pk (
    string_buffer & strbuf,
    SM_CLASS * sm_class,
    DB_VALUE * key
) 

function sl_print_select

static int sl_print_select (
    string_buffer & strbuf,
    SM_CLASS * sm_class,
    DB_VALUE * key
) 

function sl_print_update_att_set

static void sl_print_update_att_set (
    string_buffer & strbuf,
    OBJ_TEMPASSIGN ** assignments,
    int num_assignments
) 

function sl_read_catalog

static int sl_read_catalog (
    void
) 

function sl_write_catalog

static int sl_write_catalog (
    void
) 

function sl_write_sql

static int sl_write_sql (
    string_buffer & query,
    string_buffer * select
) 

function trim_single_quote

static char * trim_single_quote (
    char * str,
    size_t len
) 

Macro Definition Documentation

define CATALOG_FORMAT

#define CATALOG_FORMAT `FILE_ID_FORMAT " | " SQL_ID_FORMAT`

define FILE_ID_FORMAT

#define FILE_ID_FORMAT `"%u"`

define SL_LOG_FILE_MAX_SIZE

#define SL_LOG_FILE_MAX_SIZE `( prm_get_integer_value ( PRM_ID_HA_SQL_LOG_MAX_SIZE_IN_MB ) * 1024 * 1024)`

define SQL_ID_FORMAT

#define SQL_ID_FORMAT `"%010u"`


The documentation for this class was generated from the following file cubrid/src/transaction/log_applier_sql_log.c