Drizzled Public API Documentation

mtr0log.h File Reference
#include "univ.i"
#include "mtr0mtr.h"
#include "dict0types.h"

Go to the source code of this file.

Defines

#define MLOG_BUF_MARGIN   256

Functions

UNIV_INTERN void mlog_write_ulint (byte *ptr, ulint val, byte type, mtr_t *mtr)
UNIV_INTERN void mlog_write_ull (byte *ptr, ib_uint64_t val, mtr_t *mtr)
UNIV_INTERN void mlog_write_string (byte *ptr, const byte *str, ulint len, mtr_t *mtr)
UNIV_INTERN void mlog_log_string (byte *ptr, ulint len, mtr_t *mtr)
UNIV_INTERN void mlog_write_initial_log_record (const byte *ptr, byte type, mtr_t *mtr)
UNIV_INLINE byte * mlog_write_initial_log_record_for_file_op (ulint type, ulint space_id, ulint page_no, byte *log_ptr, mtr_t *mtr)
UNIV_INLINE void mlog_catenate_ulint (mtr_t *mtr, ulint val, ulint type)
UNIV_INTERN void mlog_catenate_string (mtr_t *mtr, const byte *str, ulint len)
UNIV_INLINE void mlog_catenate_ulint_compressed (mtr_t *mtr, ulint val)
UNIV_INLINE void mlog_catenate_ull_compressed (mtr_t *mtr, ib_uint64_t val)
UNIV_INLINE byte * mlog_open (mtr_t *mtr, ulint size)
UNIV_INLINE void mlog_close (mtr_t *mtr, byte *ptr)
UNIV_INLINE byte * mlog_write_initial_log_record_fast (const byte *ptr, byte type, byte *log_ptr, mtr_t *mtr)
UNIV_INTERN byte * mlog_parse_initial_log_record (byte *ptr, byte *end_ptr, byte *type, ulint *space, ulint *page_no)
UNIV_INTERN byte * mlog_parse_nbytes (ulint type, byte *ptr, byte *end_ptr, byte *page, void *page_zip)
UNIV_INTERN byte * mlog_parse_string (byte *ptr, byte *end_ptr, byte *page, void *page_zip)
UNIV_INTERN byte * mlog_open_and_write_index (mtr_t *mtr, const byte *rec, dict_index_t *index, byte type, ulint size)
UNIV_INTERN byte * mlog_parse_index (byte *ptr, const byte *end_ptr, ibool comp, dict_index_t **index)

Detailed Description

Mini-transaction logging routines

Created 12/7/1995 Heikki Tuuri

Definition in file mtr0log.h.


Function Documentation

UNIV_INTERN void mlog_catenate_string ( mtr_t mtr,
const byte *  str,
ulint  len 
)

Catenates n bytes to the mtr log. in: string length

Catenates n bytes to the mtr log.

Parameters:
mtrin: mtr
strin: string to write
lenin: string length

Definition at line 44 of file mtr0log.cc.

References dyn_push_string(), mtr_struct::log, mlog_catenate_string(), and mtr_get_log_mode().

Referenced by mlog_catenate_string(), mlog_log_string(), and row_upd_index_write_log().

UNIV_INLINE void mlog_catenate_ulint ( mtr_t mtr,
ulint  val,
ulint  type 
)

Catenates 1 - 4 bytes to the mtr log. in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES

Parameters:
mtrin: mtr
valin: value to write
UNIV_INLINE void mlog_catenate_ulint_compressed ( mtr_t mtr,
ulint  val 
)

Catenates a compressed ulint to mlog. in: value to write

Parameters:
mtrin: mtr
UNIV_INLINE void mlog_catenate_ull_compressed ( mtr_t mtr,
ib_uint64_t  val 
)

Catenates a compressed 64-bit integer to mlog. in: value to write

Parameters:
mtrin: mtr
UNIV_INLINE void mlog_close ( mtr_t mtr,
byte *  ptr 
)

Closes a buffer opened to mlog. in: buffer space from ptr up was not used

Parameters:
mtrin: mtr

Referenced by mlog_log_string(), mlog_open_and_write_index(), mlog_write_initial_log_record(), mlog_write_ulint(), mlog_write_ull(), and row_upd_index_write_log().

UNIV_INTERN void mlog_log_string ( byte *  ptr,
ulint  len,
mtr_t mtr 
)

Logs a write of a string to a file page buffered in the buffer pool. Writes the corresponding log record to the mini-transaction log. in: mini-transaction handle

Logs a write of a string to a file page buffered in the buffer pool. Writes the corresponding log record to the mini-transaction log.

Parameters:
ptrin: pointer written to
lenin: string length
mtrin: mini-transaction handle

Definition at line 350 of file mtr0log.cc.

References mach_write_to_2(), mlog_catenate_string(), mlog_close(), mlog_log_string(), mlog_open(), mlog_write_initial_log_record_fast(), MLOG_WRITE_STRING, page_offset(), and ut_ad.

Referenced by btr_store_big_rec_extern_fields(), mlog_log_string(), and mlog_write_string().

UNIV_INLINE byte* mlog_open ( mtr_t mtr,
ulint  size 
)

Opens a buffer to mlog. It must be closed with mlog_close.

Returns:
buffer, NULL if log mode MTR_LOG_NONE in: buffer size in bytes; MUST be smaller than DYN_ARRAY_DATA_SIZE!
Parameters:
mtrin: mtr

Referenced by mlog_log_string(), mlog_open_and_write_index(), mlog_write_initial_log_record(), mlog_write_ulint(), mlog_write_ull(), and row_upd_index_write_log().

UNIV_INTERN byte* mlog_open_and_write_index ( mtr_t mtr,
const byte *  rec,
dict_index_t index,
byte  type,
ulint  size 
)

Opens a buffer for mlog, writes the initial log record and, if needed, the field lengths of an index. Reserves space for further log entries. The log entry must be closed with mtr_close().

Returns:
buffer, NULL if log mode MTR_LOG_NONE in: requested buffer size in bytes (if 0, calls mlog_close() and returns NULL)

Opens a buffer for mlog, writes the initial log record and, if needed, the field lengths of an index.

Returns:
buffer, NULL if log mode MTR_LOG_NONE
Parameters:
mtrin: mtr
recin: index record or page
indexin: record descriptor
typein: log item type
sizein: requested buffer size in bytes (if 0, calls mlog_close() and returns NULL)

Definition at line 440 of file mtr0log.cc.

References dict_field_get_col(), dict_index_get_n_fields(), dict_index_get_n_unique_in_tree(), dict_table_is_comp(), DYN_ARRAY_DATA_SIZE, dict_field_struct::fixed_len, dict_col_struct::len, mach_write_to_2(), mlog_close(), mlog_open(), mlog_open_and_write_index(), mlog_write_initial_log_record_fast(), dict_col_struct::mtype, page_rec_is_comp(), dict_col_struct::prtype, dict_index_struct::table, ut_a, and ut_ad.

Referenced by mlog_open_and_write_index().

UNIV_INTERN byte* mlog_parse_index ( byte *  ptr,
const byte *  end_ptr,
ibool  comp,
dict_index_t **  index 
)

Parses a log record written by mlog_open_and_write_index.

Returns:
parsed record end, NULL if not a complete record out, own: dummy index

Parses a log record written by mlog_open_and_write_index.

Returns:
parsed record end, NULL if not a complete record
Parameters:
ptrin: buffer
end_ptrin: buffer end
compin: TRUE=compact record format
indexout, own: dummy index

Definition at line 537 of file mtr0log.cc.

References dict_index_struct::cached, dict_field_struct::col, dict_table_struct::cols, DICT_CLUSTERED, dict_index_get_nth_col(), DICT_TF_COMPACT, dict_index_struct::fields, dict_table_struct::heap, mach_read_from_2(), mlog_parse_index(), dict_index_struct::n_uniq, dict_index_struct::table, dict_index_struct::type, ut_a, and ut_ad.

Referenced by mlog_parse_index().

UNIV_INTERN byte* mlog_parse_initial_log_record ( byte *  ptr,
byte *  end_ptr,
byte *  type,
ulint *  space,
ulint *  page_no 
)

Parses an initial log record written by mlog_write_initial_log_record.

Returns:
parsed record end, NULL if not a complete record out: page number

Parses an initial log record written by mlog_write_initial_log_record.

Returns:
parsed record end, NULL if not a complete record
Parameters:
ptrin: buffer
end_ptrin: buffer end
typeout: log record type: MLOG_1BYTE, ...
spaceout: space id
page_noout: page number

Definition at line 100 of file mtr0log.cc.

References mach_parse_compressed(), MLOG_BIGGEST_TYPE, mlog_parse_initial_log_record(), MLOG_SINGLE_REC_FLAG, and ut_ad.

Referenced by mlog_parse_initial_log_record().

UNIV_INTERN byte* mlog_parse_nbytes ( ulint  type,
byte *  ptr,
byte *  end_ptr,
byte *  page,
void *  page_zip 
)

Parses a log record written by mlog_write_ulint or mlog_write_ull.

Returns:
parsed record end, NULL if not a complete record in/out: compressed page, or NULL

Parses a log record written by mlog_write_ulint or mlog_write_ull.

Returns:
parsed record end, NULL if not a complete record or a corrupt record
Parameters:
typein: log record type: MLOG_1BYTE, ...
ptrin: buffer
end_ptrin: buffer end
pagein: page where to apply the log record, or NULL
page_zipin/out: compressed page, or NULL

Definition at line 140 of file mtr0log.cc.

References FIL_PAGE_INDEX, recv_sys_struct::found_corrupt_log, mach_parse_compressed(), mach_read_from_2(), mach_ull_parse_compressed(), mach_write_to_1(), mach_write_to_2(), mach_write_to_4(), mach_write_to_8(), MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES, MLOG_8BYTES, mlog_parse_nbytes(), recv_sys, and ut_a.

Referenced by mlog_parse_nbytes().

UNIV_INTERN byte* mlog_parse_string ( byte *  ptr,
byte *  end_ptr,
byte *  page,
void *  page_zip 
)

Parses a log record written by mlog_write_string.

Returns:
parsed record end, NULL if not a complete record in/out: compressed page, or NULL

Parses a log record written by mlog_write_string.

Returns:
parsed record end, NULL if not a complete record
Parameters:
ptrin: buffer
end_ptrin: buffer end
pagein: page where to apply the log record, or NULL
page_zipin/out: compressed page, or NULL

Definition at line 388 of file mtr0log.cc.

References FIL_PAGE_INDEX, recv_sys_struct::found_corrupt_log, mach_read_from_2(), mlog_parse_string(), recv_sys, and ut_a.

Referenced by mlog_parse_string().

UNIV_INTERN void mlog_write_initial_log_record ( const byte *  ptr,
byte  type,
mtr_t mtr 
)

Writes initial part of a log record consisting of one-byte item type and four-byte space and page numbers. in: mini-transaction handle

Writes the initial part of a log record consisting of one-byte item type and four-byte space and page numbers. Also pushes info to the mtr memo that a buffer page has been modified.

Parameters:
ptrin: pointer to (inside) a buffer frame holding the file page where modification is made
typein: log item type: MLOG_1BYTE, ...
mtrin: mini-transaction handle

Definition at line 68 of file mtr0log.cc.

References MLOG_8BYTES, MLOG_BIGGEST_TYPE, mlog_close(), mlog_open(), mlog_write_initial_log_record(), mlog_write_initial_log_record_fast(), and ut_ad.

Referenced by fsp_init(), ibuf_bitmap_page_init(), and mlog_write_initial_log_record().

UNIV_INLINE byte* mlog_write_initial_log_record_fast ( const byte *  ptr,
byte  type,
byte *  log_ptr,
mtr_t mtr 
)

Writes the initial part of a log record (3..11 bytes). If the implementation of this function is changed, all size parameters to mlog_open() should be adjusted accordingly!

Returns:
new value of log_ptr in: mtr
Parameters:
ptrin: pointer to (inside) a buffer frame holding the file page where modification is made
typein: log item type: MLOG_1BYTE, ...
log_ptrin: pointer to mtr log which has been opened

Referenced by mlog_log_string(), mlog_open_and_write_index(), mlog_write_initial_log_record(), mlog_write_ulint(), and mlog_write_ull().

UNIV_INLINE byte* mlog_write_initial_log_record_for_file_op ( ulint  type,
ulint  space_id,
ulint  page_no,
byte *  log_ptr,
mtr_t mtr 
)

Writes a log record about an .ibd file create/delete/rename.

Returns:
new value of log_ptr in: mtr
Parameters:
typein: MLOG_FILE_CREATE, MLOG_FILE_DELETE, or MLOG_FILE_RENAME
space_idin: space id, if applicable
page_noin: page number (not relevant currently)
log_ptrin: pointer to mtr log which has been opened
UNIV_INTERN void mlog_write_string ( byte *  ptr,
const byte *  str,
ulint  len,
mtr_t mtr 
)

Writes a string to a file page buffered in the buffer pool. Writes the corresponding log record to the mini-transaction log. in: mini-transaction handle

Writes a string to a file page buffered in the buffer pool. Writes the corresponding log record to the mini-transaction log.

Parameters:
ptrin: pointer where to write
strin: string to write
lenin: string length
mtrin: mini-transaction handle

Definition at line 330 of file mtr0log.cc.

References mlog_log_string(), mlog_write_string(), ut_a, and ut_ad.

Referenced by btr_store_big_rec_extern_fields(), and mlog_write_string().

UNIV_INTERN void mlog_write_ulint ( byte *  ptr,
ulint  val,
byte  type,
mtr_t mtr 
)

Writes 1 - 4 bytes to a file page buffered in the buffer pool. Writes the corresponding log record to the mini-transaction log. in: mini-transaction handle

Writes 1 - 4 bytes to a file page buffered in the buffer pool. Writes the corresponding log record to the mini-transaction log.

Parameters:
ptrin: pointer where to write
valin: value to write
typein: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES
mtrin: mini-transaction handle

Definition at line 247 of file mtr0log.cc.

References mach_write_compressed(), mach_write_to_1(), mach_write_to_2(), mach_write_to_4(), MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES, mlog_close(), mlog_open(), mlog_write_initial_log_record_fast(), mlog_write_ulint(), page_offset(), and ut_error.

Referenced by btr_free_externally_stored_field(), btr_store_big_rec_extern_fields(), dict_hdr_get_new_id(), flst_cut_end(), flst_insert_after(), flst_insert_before(), flst_remove(), flst_truncate_end(), fsp_header_get_space_id(), mlog_write_ulint(), page_rec_write_index_page_no(), trx_purge_add_update_undo_to_history(), trx_rseg_header_create(), trx_sys_create_doublewrite_buf(), trx_sys_mark_upgraded_to_multiple_tablespaces(), trx_undo_set_state_at_finish(), trx_undo_set_state_at_prepare(), and trx_undo_truncate_end().

UNIV_INTERN void mlog_write_ull ( byte *  ptr,
ib_uint64_t  val,
mtr_t mtr 
)

Writes 8 bytes to a file page buffered in the buffer pool. Writes the corresponding log record to the mini-transaction log. in: mini-transaction handle

Writes 8 bytes to a file page buffered in the buffer pool. Writes the corresponding log record to the mini-transaction log.

Parameters:
ptrin: pointer where to write
valin: value to write
mtrin: mini-transaction handle

Definition at line 293 of file mtr0log.cc.

References mach_ull_write_compressed(), mach_write_to_2(), mach_write_to_8(), MLOG_8BYTES, mlog_close(), mlog_open(), mlog_write_initial_log_record_fast(), mlog_write_ull(), page_offset(), and ut_ad.

Referenced by dict_hdr_get_new_id(), fsp_header_get_space_id(), mlog_write_ull(), page_set_max_trx_id(), trx_purge_add_update_undo_to_history(), and trx_sys_flush_commit_id().