InnoDB Plugin  1.0
Data Structures | Macros | Functions
mtr0mtr.h File Reference
#include "univ.i"
#include "mem0mem.h"
#include "dyn0dyn.h"
#include "buf0types.h"
#include "sync0rw.h"
#include "ut0byte.h"
#include "mtr0types.h"
#include "page0types.h"
#include "log0log.h"
#include "mtr0mtr.ic"
Include dependency graph for mtr0mtr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mtr_memo_slot_t
struct  mtr_t

Macros

#define MTR_LOG_ALL
#define MTR_LOG_NONE   22 /* log no operations */
#define MTR_LOG_NO_REDO   23 /* Don't generate REDO */
#define MTR_LOG_SHORT_INSERTS
#define MTR_MEMO_PAGE_S_FIX   RW_S_LATCH
#define MTR_MEMO_PAGE_X_FIX   RW_X_LATCH
#define MTR_MEMO_BUF_FIX   RW_NO_LATCH
#define MTR_MEMO_MODIFY   54
#define MTR_MEMO_S_LOCK   55
#define MTR_MEMO_X_LOCK   56
#define mtr_s_lock(B, MTR)
#define mtr_x_lock(B, MTR)
#define MTR_BUF_MEMO_SIZE   200 /* number of slots in memo */
#define MTR_MAGIC_N   54551
#define MTR_ACTIVE   12231
#define MTR_COMMITTING   56456
#define MTR_COMMITTED   34676
Log item types

The log items are declared 'byte' so that the compiler can warn if val and type parameters are switched in a call to mlog_write_ulint. NOTE! For 1 - 8 bytes, the flag value must give the length also!

#define MLOG_SINGLE_REC_FLAG   128
#define MLOG_1BYTE   (1)
#define MLOG_2BYTES   (2)
#define MLOG_4BYTES   (4)
#define MLOG_8BYTES   (8)
#define MLOG_REC_INSERT   ((byte)9)
#define MLOG_REC_CLUST_DELETE_MARK   ((byte)10)
#define MLOG_REC_SEC_DELETE_MARK   ((byte)11)
#define MLOG_REC_UPDATE_IN_PLACE   ((byte)13)
#define MLOG_REC_DELETE   ((byte)14)
#define MLOG_LIST_END_DELETE   ((byte)15)
#define MLOG_LIST_START_DELETE   ((byte)16)
#define MLOG_LIST_END_COPY_CREATED   ((byte)17)
#define MLOG_PAGE_REORGANIZE   ((byte)18)
#define MLOG_PAGE_CREATE   ((byte)19)
#define MLOG_UNDO_INSERT   ((byte)20)
#define MLOG_UNDO_ERASE_END   ((byte)21)
#define MLOG_UNDO_INIT   ((byte)22)
#define MLOG_UNDO_HDR_DISCARD   ((byte)23)
#define MLOG_UNDO_HDR_REUSE   ((byte)24)
#define MLOG_UNDO_HDR_CREATE   ((byte)25)
#define MLOG_REC_MIN_MARK   ((byte)26)
#define MLOG_IBUF_BITMAP_INIT   ((byte)27)
#define MLOG_INIT_FILE_PAGE   ((byte)29)
#define MLOG_WRITE_STRING   ((byte)30)
#define MLOG_MULTI_REC_END   ((byte)31)
#define MLOG_DUMMY_RECORD   ((byte)32)
#define MLOG_FILE_CREATE   ((byte)33)
#define MLOG_FILE_RENAME   ((byte)34)
#define MLOG_FILE_DELETE   ((byte)35)
#define MLOG_COMP_REC_MIN_MARK   ((byte)36)
#define MLOG_COMP_PAGE_CREATE   ((byte)37)
#define MLOG_COMP_REC_INSERT   ((byte)38)
#define MLOG_COMP_REC_CLUST_DELETE_MARK   ((byte)39)
#define MLOG_COMP_REC_SEC_DELETE_MARK   ((byte)40)
#define MLOG_COMP_REC_UPDATE_IN_PLACE   ((byte)41)
#define MLOG_COMP_REC_DELETE   ((byte)42)
#define MLOG_COMP_LIST_END_DELETE   ((byte)43)
#define MLOG_COMP_LIST_START_DELETE   ((byte)44)
#define MLOG_COMP_LIST_END_COPY_CREATED   ((byte)45)
#define MLOG_COMP_PAGE_REORGANIZE   ((byte)46)
#define MLOG_FILE_CREATE2   ((byte)47)
#define MLOG_ZIP_WRITE_NODE_PTR   ((byte)48)
#define MLOG_ZIP_WRITE_BLOB_PTR   ((byte)49)
#define MLOG_ZIP_WRITE_HEADER   ((byte)50)
#define MLOG_ZIP_PAGE_COMPRESS   ((byte)51)
#define MLOG_ZIP_PAGE_COMPRESS_NO_DATA   ((byte)52)
#define MLOG_ZIP_PAGE_REORGANIZE   ((byte)53)
#define MLOG_BIGGEST_TYPE   ((byte)53)
Flags for MLOG_FILE operations

(stored in the page number parameter, called log_flags in the functions). The page number parameter was originally written as 0.

#define MLOG_FILE_FLAG_TEMP   1

Functions

UNIV_INLINE void mtr_start (mtr_t *mtr))
UNIV_INTERN void mtr_commit (mtr_t *mtr))
UNIV_INLINE ulint mtr_set_savepoint (mtr_t *mtr)
UNIV_INLINE void mtr_release_s_latch_at_savepoint (mtr_t *mtr, ulint savepoint, rw_lock_t *lock)
UNIV_INLINE ulint mtr_get_log_mode (mtr_t *mtr)
UNIV_INLINE ulint mtr_set_log_mode (mtr_t *mtr, ulint mode)
UNIV_INTERN ulint mtr_read_ulint (const byte *ptr, ulint type, mtr_t *mtr)
UNIV_INLINE void mtr_s_lock_func (rw_lock_t *lock, const char *file, ulint line, mtr_t *mtr)
UNIV_INLINE void mtr_x_lock_func (rw_lock_t *lock, const char *file, ulint line, mtr_t *mtr)
UNIV_INTERN bool mtr_memo_release (mtr_t *mtr, void *object, ulint type))
UNIV_INLINE bool mtr_memo_contains (mtr_t *mtr, const void *object, ulint type))
UNIV_INTERN ibool mtr_memo_contains_page (mtr_t *mtr, const byte *ptr, ulint type)
UNIV_INTERN void mtr_print (mtr_t *mtr)
UNIV_INLINE dyn_array_tmtr_get_log (mtr_t *mtr)
UNIV_INLINE void mtr_memo_push (mtr_t *mtr, void *object, ulint type)

Detailed Description

Mini-transaction buffer

Created 11/26/1995 Heikki Tuuri

Macro Definition Documentation

#define MLOG_1BYTE   (1)

one byte is written

#define MLOG_2BYTES   (2)

2 bytes ...

#define MLOG_4BYTES   (4)

4 bytes ...

#define MLOG_8BYTES   (8)

8 bytes ...

#define MLOG_BIGGEST_TYPE   ((byte)53)

biggest value (used in assertions)

#define MLOG_COMP_LIST_END_COPY_CREATED   ((byte)45)

copy compact record list end to a new created index page

#define MLOG_COMP_LIST_END_DELETE   ((byte)43)

delete compact record list end on index page

#define MLOG_COMP_LIST_START_DELETE   ((byte)44)

delete compact record list start on index page

#define MLOG_COMP_PAGE_CREATE   ((byte)37)

create a compact index page

#define MLOG_COMP_PAGE_REORGANIZE   ((byte)46)

reorganize an index page

#define MLOG_COMP_REC_CLUST_DELETE_MARK   ((byte)39)

mark compact clustered index record deleted

#define MLOG_COMP_REC_DELETE   ((byte)42)

delete a compact record from a page

#define MLOG_COMP_REC_INSERT   ((byte)38)

compact record insert

#define MLOG_COMP_REC_MIN_MARK   ((byte)36)

mark a compact index record as the predefined minimum record

#define MLOG_COMP_REC_SEC_DELETE_MARK   ((byte)40)

mark compact secondary index record deleted; this log record type is redundant, as MLOG_REC_SEC_DELETE_MARK is independent of the record format.

#define MLOG_COMP_REC_UPDATE_IN_PLACE   ((byte)41)

update of a compact record, preserves record field sizes

#define MLOG_DUMMY_RECORD   ((byte)32)

dummy log record used to pad a log block full

#define MLOG_FILE_CREATE   ((byte)33)

log record about an .ibd file creation

#define MLOG_FILE_CREATE2   ((byte)47)

log record about creating an .ibd file, with format

#define MLOG_FILE_DELETE   ((byte)35)

log record about an .ibd file deletion

#define MLOG_FILE_FLAG_TEMP   1

identifies TEMPORARY TABLE in MLOG_FILE_CREATE, MLOG_FILE_CREATE2

#define MLOG_FILE_RENAME   ((byte)34)

log record about an .ibd file rename

#define MLOG_IBUF_BITMAP_INIT   ((byte)27)

initialize an ibuf bitmap page

#define MLOG_INIT_FILE_PAGE   ((byte)29)

this means that a file page is taken into use and the prior contents of the page should be ignored: in recovery we must not trust the lsn values stored to the file page

#define MLOG_LIST_END_COPY_CREATED   ((byte)17)

copy record list end to a new created index page

#define MLOG_LIST_END_DELETE   ((byte)15)

delete record list end on index page

#define MLOG_LIST_START_DELETE   ((byte)16)

delete record list start on index page

#define MLOG_MULTI_REC_END   ((byte)31)

if a single mtr writes several log records, this log record ends the sequence of these records

#define MLOG_PAGE_CREATE   ((byte)19)

create an index page

#define MLOG_PAGE_REORGANIZE   ((byte)18)

reorganize an index page in ROW_FORMAT=REDUNDANT

#define MLOG_REC_CLUST_DELETE_MARK   ((byte)10)

mark clustered index record deleted

#define MLOG_REC_DELETE   ((byte)14)

delete a record from a page

#define MLOG_REC_INSERT   ((byte)9)

record insert

#define MLOG_REC_MIN_MARK   ((byte)26)

mark an index record as the predefined minimum record

#define MLOG_REC_SEC_DELETE_MARK   ((byte)11)

mark secondary index record deleted

#define MLOG_REC_UPDATE_IN_PLACE   ((byte)13)

update of a record, preserves record field sizes

#define MLOG_SINGLE_REC_FLAG   128

if the mtr contains only one log record for one page, i.e., write_initial_log_record has been called only once, this flag is ORed to the type of that first log record

#define MLOG_UNDO_ERASE_END   ((byte)21)

erase an undo log page end

#define MLOG_UNDO_HDR_CREATE   ((byte)25)

create an undo log header

#define MLOG_UNDO_HDR_DISCARD   ((byte)23)

discard an update undo log header

#define MLOG_UNDO_HDR_REUSE   ((byte)24)

reuse an insert undo log header

#define MLOG_UNDO_INIT   ((byte)22)

initialize a page in an undo log

#define MLOG_UNDO_INSERT   ((byte)20)

insert entry in an undo log

#define MLOG_WRITE_STRING   ((byte)30)

write a string to a page

#define MLOG_ZIP_PAGE_COMPRESS   ((byte)51)

compress an index page

#define MLOG_ZIP_PAGE_COMPRESS_NO_DATA   ((byte)52)

compress an index page without logging it's image

#define MLOG_ZIP_PAGE_REORGANIZE   ((byte)53)

reorganize a compressed page

#define MLOG_ZIP_WRITE_BLOB_PTR   ((byte)49)

write the BLOB pointer of an externally stored column on a compressed page

#define MLOG_ZIP_WRITE_HEADER   ((byte)50)

write to compressed page header

#define MLOG_ZIP_WRITE_NODE_PTR   ((byte)48)

write the node pointer of a record on a compressed non-leaf B-tree page

#define MTR_LOG_ALL
Value:
21 /* default mode: log all operations
modifying disk-based data */
#define MTR_LOG_SHORT_INSERTS
Value:
24 /* inserts are logged in a shorter
form */
#define mtr_s_lock (   B,
  MTR 
)
Value:
mtr_s_lock_func((B), __FILE__, __LINE__,\
(MTR))

This macro locks an rw-lock in s-mode.

#define mtr_x_lock (   B,
  MTR 
)
Value:
mtr_x_lock_func((B), __FILE__, __LINE__,\
(MTR))

This macro locks an rw-lock in x-mode.

Function Documentation

UNIV_INTERN void mtr_commit ( mtr_t mtr)

Commits a mini-transaction.

Parameters
mtrin/out: mini-transaction
UNIV_INLINE dyn_array_t* mtr_get_log ( mtr_t mtr)

Returns the log object of a mini-transaction buffer.

Returns
log in: mini-transaction

Returns the log object of a mini-transaction buffer.

Returns
log
Parameters
mtrin: mini-transaction
UNIV_INLINE ulint mtr_get_log_mode ( mtr_t mtr)

Gets the logging mode of a mini-transaction.

Returns
logging mode: MTR_LOG_NONE, ... in: mtr

Gets the logging mode of a mini-transaction.

Returns
logging mode: MTR_LOG_NONE, ...
Parameters
mtrin: mtr
UNIV_INLINE bool mtr_memo_contains ( mtr_t mtr,
const void *  object,
ulint  type 
)

Checks if memo contains the given item.

Returns
TRUE if contains
Parameters
mtrin: mtr
objectin: object to search
typein: type of object
UNIV_INTERN ibool mtr_memo_contains_page ( mtr_t mtr,
const byte *  ptr,
ulint  type 
)

Checks if memo contains the given page.

Returns
TRUE if contains in: type of object
Parameters
mtrin: mtr
ptrin: pointer to buffer frame
UNIV_INLINE void mtr_memo_push ( mtr_t mtr,
void *  object,
ulint  type 
)

Pushes an object to an mtr memo stack. in: object type: MTR_MEMO_S_LOCK, ...

Pushes an object to an mtr memo stack.

Parameters
mtrin: mtr
objectin: object
typein: object type: MTR_MEMO_S_LOCK, ...
UNIV_INTERN bool mtr_memo_release ( mtr_t mtr,
void *  object,
ulint  type 
)

Releases an object in the memo stack.

Returns
true if released
Parameters
mtrin/out: mini-transaction
objectin: object
typein: object type: MTR_MEMO_S_LOCK, ...
UNIV_INTERN void mtr_print ( mtr_t mtr)

Prints info of an mtr handle. in: mtr

UNIV_INTERN ulint mtr_read_ulint ( const byte *  ptr,
ulint  type,
mtr_t mtr 
)

Reads 1 - 4 bytes from a file page buffered in the buffer pool.

Returns
value read in: mini-transaction handle
Parameters
ptrin: pointer from where to read
typein: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES
UNIV_INLINE void mtr_release_s_latch_at_savepoint ( mtr_t mtr,
ulint  savepoint,
rw_lock_t lock 
)

Releases the (index tree) s-latch stored in an mtr memo after a savepoint. in: latch to release

Releases the (index tree) s-latch stored in an mtr memo after a savepoint.

Parameters
mtrin: mtr
savepointin: savepoint
lockin: latch to release
UNIV_INLINE void mtr_s_lock_func ( rw_lock_t lock,
const char *  file,
ulint  line,
mtr_t mtr 
)

NOTE! Use the macro above! Locks a lock in s-mode. in: mtr

Locks a lock in s-mode.

Parameters
lockin: rw-lock
filein: file name
linein: line number
mtrin: mtr
UNIV_INLINE ulint mtr_set_log_mode ( mtr_t mtr,
ulint  mode 
)

Changes the logging mode of a mini-transaction.

Returns
old mode in: logging mode: MTR_LOG_NONE, ...

Changes the logging mode of a mini-transaction.

Returns
old mode
Parameters
mtrin: mtr
modein: logging mode: MTR_LOG_NONE, ...
UNIV_INLINE ulint mtr_set_savepoint ( mtr_t mtr)

Sets and returns a savepoint in mtr.

Returns
savepoint in: mtr

Sets and returns a savepoint in mtr.

Returns
savepoint
Parameters
mtrin: mtr
UNIV_INLINE void mtr_start ( mtr_t mtr)

Starts a mini-transaction.

Parameters
mtrout: mini-transaction
UNIV_INLINE void mtr_x_lock_func ( rw_lock_t lock,
const char *  file,
ulint  line,
mtr_t mtr 
)

NOTE! Use the macro above! Locks a lock in x-mode. in: mtr

Locks a lock in x-mode.

Parameters
lockin: rw-lock
filein: file name
linein: line number
mtrin: mtr