InnoDB Plugin  1.0
Data Structures | Macros | Enumerations | Functions | Variables
log0recv.h File Reference
#include "univ.i"
#include "ut0byte.h"
#include "buf0types.h"
#include "hash0hash.h"
#include "log0log.h"
#include <list>
#include "log0recv.ic"
Include dependency graph for log0recv.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  recv_data_t
struct  recv_t
struct  recv_addr_t
struct  recv_dblwr_t
struct  recv_sys_t

Macros

#define recv_recover_page(jri, block)   recv_recover_page_func(jri, block)
#define recv_recovery_from_checkpoint_start(type, lim, min, max)   recv_recovery_from_checkpoint_start_func(min,max)
#define RECV_PARSING_BUF_SIZE   (2 * 1024 * 1024)
#define RECV_SCAN_SIZE   (4 * UNIV_PAGE_SIZE)

Enumerations

enum  recv_addr_state { RECV_NOT_PROCESSED, RECV_BEING_READ, RECV_BEING_PROCESSED, RECV_PROCESSED }

Functions

UNIV_INLINE ibool recv_recovery_is_on (void)
UNIV_INTERN void recv_recover_page_func (ibool just_read_in, buf_block_t *block)
UNIV_INTERN dberr_t recv_recovery_from_checkpoint_start_func (lsn_t min_flushed_lsn, lsn_t max_flushed_lsn)
UNIV_INTERN void recv_recovery_from_checkpoint_finish (void)
UNIV_INTERN void recv_recovery_rollback_active (void)
UNIV_INTERN ibool recv_scan_log_recs (ulint available_memory, ibool store_to_hash, const byte *buf, ulint len, lsn_t start_lsn, lsn_t *contiguous_lsn, lsn_t *group_scanned_lsn)
UNIV_INTERN void recv_reset_logs (lsn_t lsn)
UNIV_INTERN void recv_sys_create (void)
UNIV_INTERN void recv_sys_close (void)
UNIV_INTERN void recv_sys_mem_free (void)
UNIV_INTERN void recv_sys_init (ulint available_memory)
UNIV_INTERN void recv_sys_var_init (void)
UNIV_INTERN void recv_apply_hashed_log_recs (ibool allow_ibuf)

Variables

recv_sys_trecv_sys
ibool recv_recovery_on
ibool recv_no_ibuf_operations
ibool recv_needed_recovery
ibool recv_no_log_write
ibool recv_lsn_checks_on
ulint recv_max_parsed_page_no
ulint recv_n_pool_free_frames

Detailed Description

Recovery

Created 9/20/1997 Heikki Tuuri

Macro Definition Documentation

#define RECV_PARSING_BUF_SIZE   (2 * 1024 * 1024)
Size of the parsing buffer; it must accommodate RECV_SCAN_SIZE many

times!

#define recv_recover_page (   jri,
  block 
)    recv_recover_page_func(jri, block)
Wrapper for recv_recover_page_func().

Applies the hashed log records to the page, if the page lsn is less than the lsn of a log record. This can be called when a buffer page has just been read in, or also for a page already in the buffer pool.

Parameters
jriin: TRUE if just read in (the i/o handler calls this for a freshly read page)
blockin/out: the buffer block
#define recv_recovery_from_checkpoint_start (   type,
  lim,
  min,
  max 
)    recv_recovery_from_checkpoint_start_func(min,max)
Wrapper for recv_recovery_from_checkpoint_start_func().

Recovers from a checkpoint. When this function returns, the database is able to start processing of new user transactions, but the function recv_recovery_from_checkpoint_finish should be called later to complete the recovery and free the resources used in it.

Parameters
typeignored: LOG_CHECKPOINT or LOG_ARCHIVE
limignored: recover up to this log sequence number if possible
minin: minimum flushed log sequence number from data files
maxin: maximum flushed log sequence number from data files
Returns
error code or DB_SUCCESS
#define RECV_SCAN_SIZE   (4 * UNIV_PAGE_SIZE)
Size of block reads when the log groups are scanned forward to do a

roll-forward

Enumeration Type Documentation

States of recv_addr_t

Enumerator:
RECV_NOT_PROCESSED 

not yet processed

RECV_BEING_READ 

page is being read

RECV_BEING_PROCESSED 

log records are being applied on the page

RECV_PROCESSED 

log records have been applied on the page, or they have been discarded because the tablespace does not exist

Function Documentation

UNIV_INTERN void recv_apply_hashed_log_recs ( ibool  allow_ibuf)

Empties the hash table of stored log records, applying them to appropriate pages. in: if TRUE, also ibuf operations are allowed during the application; if FALSE, no ibuf operations are allowed, and after the application all file pages are flushed to disk and invalidated in buffer pool: this alternative means that no new log records can be generated during the application

UNIV_INTERN void recv_recover_page_func ( ibool  just_read_in,
buf_block_t block 
)

Applies the hashed log records to the page, if the page lsn is less than the lsn of a log record. This can be called when a buffer page has just been read in, or also for a page already in the buffer pool. in/out: buffer block

Parameters
just_read_inin: TRUE if the i/o handler calls this for a freshly read page
UNIV_INTERN void recv_recovery_from_checkpoint_finish ( void  )

Completes recovery from a checkpoint.

UNIV_INTERN dberr_t recv_recovery_from_checkpoint_start_func ( lsn_t  min_flushed_lsn,
lsn_t  max_flushed_lsn 
)

Recovers from a checkpoint. When this function returns, the database is able to start processing of new user transactions, but the function recv_recovery_from_checkpoint_finish should be called later to complete the recovery and free the resources used in it.

Returns
error code or DB_SUCCESS in: max flushed lsn from data files
Parameters
min_flushed_lsnin: min flushed lsn from data files
UNIV_INLINE ibool recv_recovery_is_on ( void  )

Returns TRUE if recovery is currently running.

Returns
recv_recovery_on
UNIV_INTERN void recv_recovery_rollback_active ( void  )

Initiates the rollback of active transactions.

UNIV_INTERN void recv_reset_logs ( lsn_t  lsn)

Resets the logs. The contents of log files will be lost! in: reset to this lsn rounded up to be divisible by OS_FILE_LOG_BLOCK_SIZE, after which we add LOG_BLOCK_HDR_SIZE

UNIV_INTERN ibool recv_scan_log_recs ( ulint  available_memory,
ibool  store_to_hash,
const byte *  buf,
ulint  len,
lsn_t  start_lsn,
lsn_t *  contiguous_lsn,
lsn_t *  group_scanned_lsn 
)

Scans log from a buffer and stores new log data to the parsing buffer. Parses and hashes the log records if new data found. Unless UNIV_HOTBACKUP is defined, this function will apply log records automatically when the hash table becomes full.

Returns
TRUE if limit_lsn has been reached, or not able to scan any more in this log group out: scanning succeeded up to this lsn
Parameters
available_memoryin: we let the hash table of recs to grow to this size, at the maximum
store_to_hashin: TRUE if the records should be stored to the hash table; this is set to FALSE if just debug checking is needed
bufin: buffer containing a log segment or garbage
lenin: buffer length
start_lsnin: buffer start lsn
contiguous_lsnin/out: it is known that all log groups contain contiguous log data up to this lsn
UNIV_INTERN void recv_sys_close ( void  )

Release recovery system mutexes.

UNIV_INTERN void recv_sys_create ( void  )

Creates the recovery system.

UNIV_INTERN void recv_sys_init ( ulint  available_memory)

Inits the recovery system for a recovery operation. in: available memory in bytes

UNIV_INTERN void recv_sys_mem_free ( void  )

Frees the recovery system memory.

UNIV_INTERN void recv_sys_var_init ( void  )

Reset the state of the recovery system variables.

Variable Documentation

ibool recv_lsn_checks_on
TRUE if buf_page_is_corrupted() should check if the log sequence

number (FIL_PAGE_LSN) is in the future. Initially FALSE, and set by recv_recovery_from_checkpoint_start_func().

ulint recv_max_parsed_page_no

Maximum page number encountered in the redo log

ulint recv_n_pool_free_frames
This many frames must be left free in the buffer pool when we scan

the log and store the scanned log records in the buffer pool: we will use these free frames to read in pages when we start applying the log records to the database.

ibool recv_needed_recovery

TRUE when recv_init_crash_recovery() has been called.

ibool recv_no_ibuf_operations
If the following is TRUE, the buffer pool file pages must be invalidated

after recovery and no ibuf operations are allowed; this becomes TRUE if the log record hash table becomes too full, and log records must be merged to file pages already before the recovery is finished: in this case no ibuf operations are allowed, as they could modify the pages read in the buffer pool before the pages have been recovered to the up-to-date state.

TRUE means that recovery is running and no operations on the log files are allowed yet: the variable name is misleading.

ibool recv_no_log_write
TRUE if writing to the redo log (mtr_commit) is forbidden.

Protected by log_sys->mutex.

ibool recv_recovery_on
TRUE when applying redo log records during crash recovery; FALSE

otherwise. Note that this is FALSE while a background thread is rolling back incomplete transactions.

recv_sys_t* recv_sys

The recovery system