libjf API reference guide

Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

jf_journal_cold_recovery.h File Reference

#include <jf/jf_config.h>
#include <jf/jf_journal_recovery.h>
#include <jf/jf_recind_pool.h>

Go to the source code of this file.

Data Structures

struct  jf_journal_ctrl_code_s

Defines

#define JF_TRACE_MODULE   JF_TRACE_MOD_LIB_FILE

Functions

int jf_journal_cold_recovery (jf_journal_t *journal, const struct jf_journal_opts_s *options, int simulation, FILE *out_stream)
int jf_journal_cold_recovery_analyze (const char *path, int force_mode, FILE *out_stream, uint32_t analyze_flags)
int jf_journal_cold_recovery_patch (jf_journal_t *journal, const jf_recind_pool_t *rip, int simulation, FILE *out_stream, uint32_t analyze_flags)
int jf_journal_cold_recovery_patch_record (jf_journal_t *journal, jf_offset_t rec_off, int redo, struct jf_journal_record_s *jr, int simulation, FILE *out_stream, uint32_t analyze_flags)
int jf_journal_cold_recovery_patch_seq (jf_journal_t *journal, jf_word_t id, const jf_recind_seq_t *ris, int simulation, FILE *out_stream, uint32_t analyze_flags)
int jf_journal_cold_recovery_prep_pool (jf_journal_t *journal, jf_recind_pool_t *rip, const struct jf_journal_opts_s *options, int simulation, FILE *out_stream)
int jf_journal_cold_recovery_update_lists (jf_journal_t *journal, jf_offset_t rec_off, const struct jf_journal_ctrl_code_s *jcc, jf_recind_pool_t *rip, jf_recind_list_t *ril)
int jf_journal_fetch_ctrl_code (const jf_journal_t *journal, struct jf_journal_ctrl_code_s *jcc)


Define Documentation

#define JF_TRACE_MODULE   JF_TRACE_MOD_LIB_FILE
 

Definition at line 41 of file jf_journal_cold_recovery.h.


Function Documentation

int jf_journal_cold_recovery jf_journal_t journal,
const struct jf_journal_opts_s options,
int  simulation,
FILE *  out_stream
 

Check a journal to verify is cold recovery must be performed and perform it (if recovery cannot be performed reason code JF_RC_COLD_RECOVERY_NEEDED is returned)

Parameters:
journal IN/OUT journal object
options IN values related to how the recovery can proceed
simulation IN boolean value, if TRUE cold recovery is NOT performed (useful to dump operations should be done)
out_stream IN/OUT stream must be used to produce a verbose XML output; if analyze_flags NOT zero, stdout is assumed as default value if this param is NULL
Returns:
a reason code
Definition at line 38 of file jf_journal_cold_recovery.c.

References CATCH, FALSE, jf_journal_t::file_id_mask, jf_journal_t::file_id_mask_shift, jf_journal_t::file_table, fseeko, ftello, JF_JOURNAL_ANALYZE_TRACE, JF_JOURNAL_ANALYZE_TRACE_HEX_DATA, JF_JOURNAL_ANALYZE_TRACE_TEXT_DATA, jf_journal_close_detach_file(), jf_journal_cold_recovery_patch(), jf_journal_cold_recovery_prep_pool(), jf_journal_file_get_stream(), jf_journal_file_set_last_pos(), JF_JOURNAL_FILE_TAB_CTRL, jf_journal_file_tab_get_jfile(), jf_journal_file_tab_get_number_of_files(), JF_JOURNAL_FIRST_FILE_ID, jf_journal_get_stream(), JF_JOURNAL_GLOBAL_FILE_ID, JF_JOURNAL_JOURNAL_FILE_ID, JF_JOURNAL_OP_CODE_ROLLBACK, jf_journal_sync(), jf_journal_update_file_table(), jf_offset_t, JF_RC_COLD_RECOVERY_NEEDED, JF_RC_DAMAGED_JOURNAL, JF_RC_FSEEK_ERROR, JF_RC_FTELL_ERROR, JF_RC_FWRITE_ERROR, JF_RC_INTERNAL_ERROR, JF_RC_OK, jf_recind_pool_create(), jf_recind_pool_destroy(), jf_recind_pool_get_seq(), jf_recind_seq_get_size(), JF_TRACE, jf_word_t, jf_journal_opts_s::recovery_analyze_flags, jf_journal_opts_s::recovery_damaged_journal, jf_journal_opts_s::recovery_enabled, THROW, and TRUE.

Referenced by jf_journal_cold_recovery_analyze(), and jf_journal_open().

int jf_journal_cold_recovery_analyze const char *  path,
int  force_mode,
FILE *  out_stream,
uint32_t  analyze_flags
 

Analyze a journal and print a report with the operation will be performed if a cold recovery are performed

Parameters:
path IN file name of the journal file
force_mode IN analyze damaged journal too
out_stream IN a standard I/O stream must be used for output data
analyze_flags IN if NOT zero, only a simulation (analysis) will be performed; available values are:
Returns:
a reason code
Definition at line 892 of file jf_journal_cold_recovery.c.

References CATCH, jf_journal_t::file_table, fseeko, JF_JOURNAL_ANALYZE_TRACE, jf_journal_cold_recovery(), jf_journal_file_get_last_pos(), jf_journal_file_tab_get_jfile(), jf_journal_get_real_path(), jf_journal_init(), JF_JOURNAL_JOURNAL_FILE_ID, jf_journal_load(), JF_OFFSET_T_FORMAT, JF_RC_FOPEN_ERROR, JF_RC_FSEEK_ERROR, JF_RC_INTERNAL_ERROR, JF_RC_OK, jf_set_default_journal_opts(), JF_TRACE, jf_journal_opts_s::recovery_analyze_flags, jf_journal_opts_s::recovery_damaged_journal, THROW, and TRUE.

Referenced by main().

int jf_journal_cold_recovery_patch jf_journal_t journal,
const jf_recind_pool_t rip,
int  simulation,
FILE *  out_stream,
uint32_t  analyze_flags
 

Patch journaled files using record index pool instruction

Parameters:
journal IN/OUT journal object
rip IN record index pool object
simulation IN boolean value, if TRUE cold recovery is NOT performed (useful to dump operations should be done)
out_stream IN a standard I/O stream must be used for output data
analyze_flags IN if NOT zero, only a simulation (analysis) will be performed; available values are:
Returns:
a reason code
Definition at line 486 of file jf_journal_cold_recovery.c.

References CATCH, jf_journal_t::file_table, jf_file_open(), JF_JOURNAL_ANALYZE_TRACE, jf_journal_cold_recovery_patch_seq(), jf_journal_file_get_last_pos(), jf_journal_file_get_last_size(), jf_journal_file_get_path(), jf_journal_file_get_stream(), jf_journal_file_set_last_pos(), jf_journal_file_tab_get_jfile(), jf_offset_t, JF_OFFSET_T_FORMAT, JF_RC_INTERNAL_ERROR, JF_RC_OK, jf_recind_pool_get_seq(), jf_recind_pool_get_size(), jf_recind_seq_get_size(), JF_TRACE, jf_word_t, and THROW.

Referenced by jf_journal_cold_recovery().

int jf_journal_cold_recovery_patch_record jf_journal_t journal,
jf_offset_t  rec_off,
int  redo,
struct jf_journal_record_s jr,
int  simulation,
FILE *  out_stream,
uint32_t  analyze_flags
 

Patch a journaled file with record specified by journal

Parameters:
journal IN/OUT journal object
rec_off IN journal record offset
redo IN boolean value: TRUE redo changes (commit), FALSE undo changes
jr IN/OUT record object used to fetch data from journal; NOTE: this could be a local object but re-using it reduce realloc/free number of operations
simulation IN boolean value, if TRUE cold recovery is NOT performed (useful to dump operations should be done)
out_stream IN a standard I/O stream must be used for output data
analyze_flags IN if NOT zero, only a simulation (analysis) will be performed; available values are:
Returns:
a reason code
Definition at line 685 of file jf_journal_cold_recovery.c.

References CATCH, fseeko, JF_JOURNAL_ANALYZE_TRACE, jf_journal_apply_changes(), jf_journal_fetch_record(), jf_journal_get_stream(), jf_journal_remove_changes(), jf_journal_trace_record(), jf_offset_t, JF_RC_FSEEK_ERROR, JF_RC_INTERNAL_ERROR, JF_RC_OK, JF_TRACE, THROW, and TRUE.

Referenced by jf_journal_cold_recovery_patch_seq().

int jf_journal_cold_recovery_patch_seq jf_journal_t journal,
jf_word_t  id,
const jf_recind_seq_t ris,
int  simulation,
FILE *  out_stream,
uint32_t  analyze_flags
 

Patch a journaled file using record index sequence instruction

Parameters:
journal IN/OUT journal object
id IN journaled file id
ris IN record index sequence object
simulation IN boolean value, if TRUE cold recovery is NOT performed (useful to dump operations should be done)
out_stream IN a standard I/O stream must be used for output data
analyze_flags IN if NOT zero, only a simulation (analysis) will be performed; available values are:
Returns:
a reason code
Definition at line 572 of file jf_journal_cold_recovery.c.

References CATCH, FALSE, jf_journal_t::file_table, JF_JOURNAL_ANALYZE_TRACE, jf_journal_cold_recovery_patch_record(), jf_journal_file_get_last_size(), jf_journal_file_get_last_uc_size(), jf_journal_file_set_last_size(), jf_journal_file_tab_get_jfile(), jf_journal_record_destroy(), jf_journal_record_reset(), jf_offset_t, JF_RC_INTERNAL_ERROR, JF_RC_OK, jf_recind_list_get_elem(), jf_recind_list_get_size(), jf_recind_list_get_uow_type(), JF_RECIND_OPER_MUST_COMMIT, JF_RECIND_OPER_MUST_ROLLBACK, jf_recind_seq_get_elem(), jf_recind_seq_get_size(), JF_TRACE, jf_word_t, THROW, and TRUE.

Referenced by jf_journal_cold_recovery_patch().

int jf_journal_cold_recovery_prep_pool jf_journal_t journal,
jf_recind_pool_t rip,
const struct jf_journal_opts_s options,
int  simulation,
FILE *  out_stream
 

Prepare the Record Index Pool associated to journal

Parameters:
journal IN/OUT journal object
rip OUT record index pool object
options IN values related to how the recovery can proceed
simulation IN boolean value, if TRUE cold recovery is NOT performed (useful to dump operations should be done)
out_stream IN a standard I/O stream must be used for output data
Returns:
a reason code
Definition at line 244 of file jf_journal_cold_recovery.c.

References CATCH, FALSE, jf_journal_t::file_id_mask, jf_journal_t::file_id_mask_shift, jf_journal_t::file_table, fseeko, ftello, JF_JOURNAL_ANALYZE_TRACE, jf_journal_cold_recovery_update_lists(), jf_journal_fetch_ctrl_code(), jf_journal_file_tab_get_number_of_files(), jf_journal_get_stream(), JF_JOURNAL_GLOBAL_FILE_ID, JF_JOURNAL_OP_CODE_ROLLBACK, jf_offset_t, JF_RC_DAMAGED_JOURNAL, JF_RC_EOF, JF_RC_FREAD_ERROR, JF_RC_FSEEK_ERROR, JF_RC_FTELL_ERROR, JF_RC_INTERNAL_ERROR, JF_RC_INVALID_CTRL_CODE, JF_RC_MALLOC_ERROR, JF_RC_OK, jf_recind_list_create(), jf_recind_pool_create(), jf_recind_pool_destroy(), jf_stream_truncate(), JF_TRACE, jf_word_t, jf_journal_opts_s::recovery_analyze_flags, jf_journal_opts_s::recovery_damaged_journal, jf_journal_ctrl_code_s::redo_code, THROW, TRUE, and jf_journal_ctrl_code_s::undo_code.

Referenced by jf_journal_cold_recovery().

int jf_journal_cold_recovery_update_lists jf_journal_t journal,
jf_offset_t  rec_off,
const struct jf_journal_ctrl_code_s jcc,
jf_recind_pool_t rip,
jf_recind_list_t ril
 

A sync point (commit/rollback) has been reached and the list must me "closed" (added to pool if not empty)

Parameters:
journal IN/OUT journal object
rec_off IN journal record offset (of jcc)
jcc IN journal control code record
rip IN/OUT record index pool object
ril IN record index list
Returns:
a reason code
Definition at line 398 of file jf_journal_cold_recovery.c.

References CATCH, jf_journal_t::file_id_mask, jf_journal_t::file_id_mask_shift, jf_journal_t::file_table, jf_journal_file_tab_get_number_of_files(), JF_JOURNAL_FIRST_FILE_ID, JF_JOURNAL_GLOBAL_FILE_ID, JF_JOURNAL_OP_CODE_COMMIT, JF_JOURNAL_OP_CODE_ROLLBACK, JF_JOURNAL_OP_MASK, jf_offset_t, JF_RC_INTERNAL_ERROR, JF_RC_OK, jf_recind_list_add(), jf_recind_list_create(), jf_recind_list_get_size(), jf_recind_list_set_uow_type(), JF_RECIND_OPER_MUST_COMMIT, JF_RECIND_OPER_MUST_ROLLBACK, jf_recind_pool_get_seq(), jf_recind_seq_add(), JF_TRACE, jf_word_t, jf_journal_ctrl_code_s::redo_code, and THROW.

Referenced by jf_journal_cold_recovery_prep_pool().

int jf_journal_fetch_ctrl_code const jf_journal_t journal,
struct jf_journal_ctrl_code_s jcc
 

Fetch next control code record from journal file; note: this function does NOT fetch redo/undo data associated to control code, use jf_journal_fetch_record instead

Parameters:
journal IN journal object
jcc OUT fetched control code
Returns:
a reason code
Definition at line 759 of file jf_journal_cold_recovery.c.

References CATCH, fseeko, ftello, jf_journal_describe_code(), jf_journal_get_stream(), JF_JOURNAL_OP_CODE_APPEND, JF_JOURNAL_OP_CODE_MASK, JF_JOURNAL_OP_CODE_NULL, JF_JOURNAL_OP_CODE_SYNC, JF_JOURNAL_OP_CODE_UPDATE, JF_JOURNAL_OP_DO, JF_JOURNAL_OP_MASK, jf_offset_t, JF_OFFSET_T_FORMAT, JF_RC_EOF, JF_RC_FREAD_ERROR, JF_RC_FSEEK_ERROR, JF_RC_INTERNAL_ERROR, JF_RC_INVALID_CTRL_CODE, JF_RC_OK, JF_TRACE, jf_word_t, jf_journal_ctrl_code_s::redo_code, jf_journal_t::size_mask, jf_journal_t::size_mask_shift, THROW, and jf_journal_ctrl_code_s::undo_code.

Referenced by jf_journal_cold_recovery_prep_pool().


Copyright 2005 © Tiian