mco_translog_query_info

This function reads a specified log file to check it for compatibility with the current database and to enumerate its labels.

For an overview see page TL Applications

Prototype

    MCO_RET mco_translog_query_info (mco_db_h db,
                                   char const *file_path,
                                   mco_TL_labels_proc labels_proc,
                                   void * user_data,
                                   mco_TL_log_info_h info);

Arguments

db
The database connection handle.
file_path
The path and filename or disk partition of the log file.
labels_proc
A user-defined callback function that enumerates labels inside the log file. This argument may be NULL if it is not used.
user_data
A pointer to user-specified data that will be passed to the callback function labels_proc.
info
A pointer to a structure defined as:
    typedef struct mco_TL_log_info_
    {
        mco_trans_counter_t start_trans_counter;
        mco_trans_counter_t stop_trans_counter;
        mco_trans_counter_t stored_transactions;
        uint2               disk_page_size;
        uint2               page_size;
        mco_size_t          log_size;
        int                 labels_count;
        mco_bool            crc;
        mco_bool            aligned;
        mco_bool            dictionary_compat;
        mco_bool            transaction_apply_compat;
        mco_bool            transaction_append_compat;
        mco_bool            not_corrupted;
        mco_bool            iteratable;
    } mco_TL_log_info_t,*mco_TL_log_info_h;

Note: This argument may be NULL if it is not used (i.e., if the function is used only to enumerate labels). The structure elements are explained below.

Description

This function reads a specified log file to check it for compatibility with the current database and to enumerate its labels.

Return Codes

MCO_S_OK
The log file was queried successfully.
MCO_E_TL_LOG_NOT_OPENED
The log file could not be opened.
MCO_E_TL_IO_ERROR
A disk I/O error occurred.
MCO_E_VERS_MISMATCH
The log file is incompatible with the runtime settings or the database version.
MCO_E_TL_INVFORMAT
The log file is corrupted.
MCO_S_TL_INVDATA
The log file was not read completely but some transactions were found, or no end-of-file was found. In the latter case, info.transaction_apply_compat will be MCO_YES, info.not_corrupted will be MCO_NO, and info.transaction_append_compat will be MCO_NO.

The structure elements for mco_TL_log_info_t are defined as follows:

start_trans_counter
The value of the transaction counter when the log file was started.
stop_trans_counter
The value of the transaction counter when the log file was finished.
stored_transactions
The count of transactions stored in the log file.
disk_page_size
The size of a single disk page.
page_size
The size of an in-memory database page.
log_size
The total size of the log file, in bytes.
labels_count
The count of labels stored in the log file.
crc
MCO_YES if the log was created with the MCO_TRANSLOG_CRCflag; otherwise MCO_NO.
aligned
MCO_YES if the log was created with the MCO_TRANSLOG_ALIGNEDflag; otherwise MCO_NO.
dictionary_compat
MCO_YES if the log file is compatible with the database specified by the argument db; otherwise MCO_NO.
transaction_apply_compat
MCO_YES if the log file is compatible for applying to the database specified by the argument db (by transaction number); otherwise MCO_NO.
transaction_append_compat
MCO_YES if the log file is compatible for appending to the database specified by the argument db (by transaction number); otherwise MCO_NO.
not_corrupted
MCO_YES if no data has been lost since the last savepoint.
iteratable
MCO_YES if the log file was written with the MCO_TRANSLOG_ITERABLEflag.

The user-defined callback procedure labels_proc must have the following prototype:

    typedef void(*mco_TL_labels_proc)(const char *label, int label_id, void *data);

Here, label is the label text, label_id is the integer value associated with this label (generated by the TL runtime when the mco_translog_label() function was called), and data is a pointer to application-specific data that may be used in the implementation of the label procedure.

Files

Header file:
mcolog.h
Source file:
mcolog.c
Library:
libmcolog.a