Skip to content

File checksumdb.c

FileList > cubrid > src > executables > checksumdb.c

Go to the source code of this file

  • #include "config.h"
  • #include <stdio.h>
  • #include <stdlib.h>
  • #include <string.h>
  • #include <ctype.h>
  • #include <assert.h>
  • #include "authenticate.h"
  • #include "error_code.h"
  • #include "system_parameter.h"
  • #include "message_catalog.h"
  • #include "db.h"
  • #include "utility.h"
  • #include "parser.h"
  • #include "object_print.h"
  • #include "schema_manager.h"
  • #include "transaction_cl.h"
  • #include "util_func.h"
  • #include "client_support.h"
  • #include "connection_support.hpp"
  • #include "environment_variable.h"
  • #include "network_interface_cl.h"
  • #include "locator_cl.h"
  • #include "db_value_printer.hpp"
  • #include "mem_block.hpp"
  • #include "string_buffer.hpp"
  • #include "dbtype.h"

Classes

Type Name
struct chksum_arg
struct chksum_result

Public Types

Type Name
typedef struct chksum_arg CHKSUM_ARG
typedef struct chksum_result CHKSUM_RESULT

Public Attributes

Type Name
CHKSUM_RESULT * chksum_Prev_results = [**NULL**](freelistheap_8h.md#define-null)
char chksum_result_Table_name
char chksum_schema_Table_name

Public Functions

Type Name
int checksumdb (UTIL_FUNCTION_ARG * arg)

Public Static Functions

Type Name
int chksum_calculate_checksum (PARSER_CONTEXT * parser, const OID * class_oidp, const char * table_name, DB_ATTRIBUTE * attributes, PARSER_VARCHAR * lower_bound, int chunk_id, int chunk_size)
int chksum_drop_and_create_checksum_table (void)
void chksum_free_results (CHKSUM_RESULT * results)
CHKSUM_RESULT * chksum_get_checksum_result (const char * table_name)
PARSER_VARCHAR * chksum_get_initial_lower_bound (PARSER_CONTEXT * parser, const char * table_name, DB_CONSTRAINT * pk_cons, int * exec_error)
PARSER_VARCHAR * chksum_get_next_lower_bound (PARSER_CONTEXT * parser, const char * table_name, DB_CONSTRAINT * pk_cons, PARSER_VARCHAR * prev_lower_bound, int chunk_size, int * exec_error)
int chksum_get_prev_checksum_results (void)
PARSER_VARCHAR * chksum_get_quote_escaped_lower_bound (PARSER_CONTEXT * parser, PARSER_VARCHAR * orig_lower_bound)
int chksum_init_checksum_tables (bool resume)
int chksum_insert_schema_definition (const char * table_name, int repid)
bool chksum_need_skip_table (const char * table_name, CHKSUM_ARG * chksum_arg)
PARSER_VARCHAR * chksum_print_attribute_list (PARSER_CONTEXT * parser, DB_ATTRIBUTE * attributes)
PARSER_VARCHAR * chksum_print_checksum_query (PARSER_CONTEXT * parser, const char * table_name, DB_ATTRIBUTE * attributes, PARSER_VARCHAR * lower_bound, int chunk_id, int chunk_size)
PARSER_VARCHAR * chksum_print_lower_bound_string (PARSER_CONTEXT * parser, DB_VALUE values, DB_CONSTRAINT * pk, int pk_col_cnt)
PARSER_VARCHAR * chksum_print_pk_list (PARSER_CONTEXT * parser, DB_CONSTRAINT * pk, int * pk_col_cnt, bool include_decs)
PARSER_VARCHAR * chksum_print_select_last_chunk (PARSER_CONTEXT * parser, const char * table_name, PARSER_VARCHAR * pk_list, PARSER_VARCHAR * pk_orderby, PARSER_VARCHAR * prev_lower_bound, int limit)
PARSER_VARCHAR * chksum_print_select_master_checksum (PARSER_CONTEXT * parser, const char * table_name, int chunk_id)
PARSER_VARCHAR * chksum_print_update_master_checksum (PARSER_CONTEXT * parser, const char * table_name, int chunk_id, int master_checksum)
int chksum_report (const char * command_name, const char * database)
int chksum_report_diff (FILE * fp)
void chksum_report_header (FILE * fp, const char * database)
FILE * chksum_report_open_file (const char * command_name)
int chksum_report_schema_diff (FILE * fp)
int chksum_report_summary (FILE * fp)
int chksum_set_initial_chunk_id_and_lower_bound (PARSER_CONTEXT * parser, const char * table_name, DB_CONSTRAINT * pk_cons, int * chunk_id, PARSER_VARCHAR ** lower_bound)
int chksum_set_repl_info_and_demote_table_lock (const char * table_name, const char * checksum_query, const OID * class_oidp)
int chksum_start (CHKSUM_ARG * chksum_arg)
int chksum_update_current_schema_definition (const char * table_name, int repid)
int chksum_update_master_checksum (PARSER_CONTEXT * parser, const char * table_name, int chunk_id)

Macros

Type Name
define CHKSUM_DEFAULT_LIST_SIZE 10
define CHKSUM_DEFAULT_TABLE_NAME "db\_ha\_checksum"
define CHKSUM_DEFAULT_TABLE_OWNER_NAME "dba"
define CHKSUM_MIN_CHUNK_SIZE 100
define CHKSUM_PRINT_AND_LOG (fp, ...) /* multi line expression */
define CHKSUM_SCHEMA_TABLE_SUFFIX "\_schema"
define CHKSUM_STOP_ON_ERROR (err, arg) /* multi line expression */
define CHKSUM_TABLE_BEGINS_AT_COL "begins\_at"
define CHKSUM_TABLE_CHUNK_CHECKSUM_COL "chunk\_checksum"
define CHKSUM_TABLE_CHUNK_ID_COL "chunk\_id"
define CHKSUM_TABLE_CLASS_NAME_COL "class\_name"
define CHKSUM_TABLE_COUNT_COL "chunk\_count"
define CHKSUM_TABLE_ELAPSED_TIME_COL "elapsed\_time"
define CHKSUM_TABLE_LOWER_BOUND_COL "chunk\_lower\_bound"
define CHKSUM_TABLE_MASTER_CHEKSUM_COL "master\_checksum"
define CHKSUM_TABLE_MASTER_SCHEMA_COL "master\_schema\_def"
define CHKSUM_TABLE_SCHEMA_COL "schema\_def"
define CHKSUM_TABLE_SCHEMA_REPID_COL "representation\_id"
define CHKSUM_TABLE_SCHEMA_TIME_COL "collected\_time"
define QUERY_BUF_SIZE 1024
define QUERY_BUF_SIZE 1024
define QUERY_BUF_SIZE 1024
define QUERY_BUF_SIZE 1024
define QUERY_BUF_SIZE 1024
define QUERY_BUF_SIZE 1024
define QUERY_BUF_SIZE 1024

Public Types Documentation

typedef CHKSUM_ARG

typedef struct chksum_arg CHKSUM_ARG;

typedef CHKSUM_RESULT

typedef struct chksum_result CHKSUM_RESULT;

Public Attributes Documentation

variable chksum_Prev_results

CHKSUM_RESULT* chksum_Prev_results;

variable chksum_result_Table_name

char chksum_result_Table_name[SM_MAX_IDENTIFIER_LENGTH];

variable chksum_schema_Table_name

char chksum_schema_Table_name[SM_MAX_IDENTIFIER_LENGTH];

Public Functions Documentation

function checksumdb

int checksumdb (
    UTIL_FUNCTION_ARG * arg
) 

Public Static Functions Documentation

function chksum_calculate_checksum

static int chksum_calculate_checksum (
    PARSER_CONTEXT * parser,
    const  OID * class_oidp,
    const  char * table_name,
    DB_ATTRIBUTE * attributes,
    PARSER_VARCHAR * lower_bound,
    int chunk_id,
    int chunk_size
) 

function chksum_drop_and_create_checksum_table

static int chksum_drop_and_create_checksum_table (
    void
) 

function chksum_free_results

static void chksum_free_results (
    CHKSUM_RESULT * results
) 

function chksum_get_checksum_result

static CHKSUM_RESULT * chksum_get_checksum_result (
    const  char * table_name
) 

function chksum_get_initial_lower_bound

static PARSER_VARCHAR * chksum_get_initial_lower_bound (
    PARSER_CONTEXT * parser,
    const  char * table_name,
    DB_CONSTRAINT * pk_cons,
    int * exec_error
) 

function chksum_get_next_lower_bound

static PARSER_VARCHAR * chksum_get_next_lower_bound (
    PARSER_CONTEXT * parser,
    const  char * table_name,
    DB_CONSTRAINT * pk_cons,
    PARSER_VARCHAR * prev_lower_bound,
    int chunk_size,
    int * exec_error
) 

function chksum_get_prev_checksum_results

static int chksum_get_prev_checksum_results (
    void
) 

function chksum_get_quote_escaped_lower_bound

static PARSER_VARCHAR * chksum_get_quote_escaped_lower_bound (
    PARSER_CONTEXT * parser,
    PARSER_VARCHAR * orig_lower_bound
) 

function chksum_init_checksum_tables

static int chksum_init_checksum_tables (
    bool resume
) 

function chksum_insert_schema_definition

static int chksum_insert_schema_definition (
    const  char * table_name,
    int repid
) 

function chksum_need_skip_table

static bool chksum_need_skip_table (
    const  char * table_name,
    CHKSUM_ARG * chksum_arg
) 

function chksum_print_attribute_list

static PARSER_VARCHAR * chksum_print_attribute_list (
    PARSER_CONTEXT * parser,
    DB_ATTRIBUTE * attributes
) 

function chksum_print_checksum_query

static PARSER_VARCHAR * chksum_print_checksum_query (
    PARSER_CONTEXT * parser,
    const  char * table_name,
    DB_ATTRIBUTE * attributes,
    PARSER_VARCHAR * lower_bound,
    int chunk_id,
    int chunk_size
) 

function chksum_print_lower_bound_string

static PARSER_VARCHAR * chksum_print_lower_bound_string (
    PARSER_CONTEXT * parser,
    DB_VALUE values,
    DB_CONSTRAINT * pk,
    int pk_col_cnt
) 

function chksum_print_pk_list

static PARSER_VARCHAR * chksum_print_pk_list (
    PARSER_CONTEXT * parser,
    DB_CONSTRAINT * pk,
    int * pk_col_cnt,
    bool include_decs
) 

function chksum_print_select_last_chunk

static PARSER_VARCHAR * chksum_print_select_last_chunk (
    PARSER_CONTEXT * parser,
    const  char * table_name,
    PARSER_VARCHAR * pk_list,
    PARSER_VARCHAR * pk_orderby,
    PARSER_VARCHAR * prev_lower_bound,
    int limit
) 

function chksum_print_select_master_checksum

static PARSER_VARCHAR * chksum_print_select_master_checksum (
    PARSER_CONTEXT * parser,
    const  char * table_name,
    int chunk_id
) 

function chksum_print_update_master_checksum

static PARSER_VARCHAR * chksum_print_update_master_checksum (
    PARSER_CONTEXT * parser,
    const  char * table_name,
    int chunk_id,
    int master_checksum
) 

function chksum_report

static int chksum_report (
    const  char * command_name,
    const  char * database
) 

function chksum_report_diff

static int chksum_report_diff (
    FILE * fp
) 

function chksum_report_header

static void chksum_report_header (
    FILE * fp,
    const  char * database
) 

function chksum_report_open_file

static FILE * chksum_report_open_file (
    const  char * command_name
) 

function chksum_report_schema_diff

static int chksum_report_schema_diff (
    FILE * fp
) 

function chksum_report_summary

static int chksum_report_summary (
    FILE * fp
) 

function chksum_set_initial_chunk_id_and_lower_bound

static int chksum_set_initial_chunk_id_and_lower_bound (
    PARSER_CONTEXT * parser,
    const  char * table_name,
    DB_CONSTRAINT * pk_cons,
    int * chunk_id,
    PARSER_VARCHAR ** lower_bound
) 

function chksum_set_repl_info_and_demote_table_lock

static int chksum_set_repl_info_and_demote_table_lock (
    const  char * table_name,
    const  char * checksum_query,
    const  OID * class_oidp
) 

function chksum_start

static int chksum_start (
    CHKSUM_ARG * chksum_arg
) 

function chksum_update_current_schema_definition

static int chksum_update_current_schema_definition (
    const  char * table_name,
    int repid
) 

function chksum_update_master_checksum

static int chksum_update_master_checksum (
    PARSER_CONTEXT * parser,
    const  char * table_name,
    int chunk_id
) 

Macro Definition Documentation

define CHKSUM_DEFAULT_LIST_SIZE

#define CHKSUM_DEFAULT_LIST_SIZE `10`

define CHKSUM_DEFAULT_TABLE_NAME

#define CHKSUM_DEFAULT_TABLE_NAME `"db_ha_checksum"`

define CHKSUM_DEFAULT_TABLE_OWNER_NAME

#define CHKSUM_DEFAULT_TABLE_OWNER_NAME `"dba"`

define CHKSUM_MIN_CHUNK_SIZE

#define CHKSUM_MIN_CHUNK_SIZE `100`

define CHKSUM_PRINT_AND_LOG

#define CHKSUM_PRINT_AND_LOG (
    fp,
    ...
) `/* multi line expression */`

define CHKSUM_SCHEMA_TABLE_SUFFIX

#define CHKSUM_SCHEMA_TABLE_SUFFIX `"_schema"`

define CHKSUM_STOP_ON_ERROR

#define CHKSUM_STOP_ON_ERROR (
    err,
    arg
) `/* multi line expression */`

define CHKSUM_TABLE_BEGINS_AT_COL

#define CHKSUM_TABLE_BEGINS_AT_COL `"begins_at"`

define CHKSUM_TABLE_CHUNK_CHECKSUM_COL

#define CHKSUM_TABLE_CHUNK_CHECKSUM_COL `"chunk_checksum"`

define CHKSUM_TABLE_CHUNK_ID_COL

#define CHKSUM_TABLE_CHUNK_ID_COL `"chunk_id"`

define CHKSUM_TABLE_CLASS_NAME_COL

#define CHKSUM_TABLE_CLASS_NAME_COL `"class_name"`

define CHKSUM_TABLE_COUNT_COL

#define CHKSUM_TABLE_COUNT_COL `"chunk_count"`

define CHKSUM_TABLE_ELAPSED_TIME_COL

#define CHKSUM_TABLE_ELAPSED_TIME_COL `"elapsed_time"`

define CHKSUM_TABLE_LOWER_BOUND_COL

#define CHKSUM_TABLE_LOWER_BOUND_COL `"chunk_lower_bound"`

define CHKSUM_TABLE_MASTER_CHEKSUM_COL

#define CHKSUM_TABLE_MASTER_CHEKSUM_COL `"master_checksum"`

define CHKSUM_TABLE_MASTER_SCHEMA_COL

#define CHKSUM_TABLE_MASTER_SCHEMA_COL `"master_schema_def"`

define CHKSUM_TABLE_SCHEMA_COL

#define CHKSUM_TABLE_SCHEMA_COL `"schema_def"`

define CHKSUM_TABLE_SCHEMA_REPID_COL

#define CHKSUM_TABLE_SCHEMA_REPID_COL `"representation_id"`

define CHKSUM_TABLE_SCHEMA_TIME_COL

#define CHKSUM_TABLE_SCHEMA_TIME_COL `"collected_time"`

define QUERY_BUF_SIZE

#define QUERY_BUF_SIZE `1024`

define QUERY_BUF_SIZE

#define QUERY_BUF_SIZE `1024`

define QUERY_BUF_SIZE

#define QUERY_BUF_SIZE `1024`

define QUERY_BUF_SIZE

#define QUERY_BUF_SIZE `1024`

define QUERY_BUF_SIZE

#define QUERY_BUF_SIZE `1024`

define QUERY_BUF_SIZE

#define QUERY_BUF_SIZE `1024`

define QUERY_BUF_SIZE

#define QUERY_BUF_SIZE `1024`


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