drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
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 dependency graph for mtr0mtr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  mtr_memo_slot_struct
struct  mtr_struct

Macros

#define mtr0mtr_h
#define MTR_LOG_ALL
#define MTR_LOG_NONE   22 /* log no operations */
#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
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_BIGGEST_TYPE   ((byte)51)

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
#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_ACTIVE   12231
#define MTR_COMMITTING   56456
#define MTR_COMMITTED   34676
typedef struct mtr_memo_slot_struct mtr_memo_slot_t
UNIV_INLINE void mtr_start (mtr_t *mtr) __attribute__((nonnull))
UNIV_INTERN void mtr_commit (mtr_t *mtr) __attribute__((nonnull))
UNIV_INLINE ulint mtr_set_savepoint (mtr_t *mtr)
UNIV_INTERN void mtr_rollback_to_savepoint (mtr_t *mtr, ulint savepoint)
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 void mtr_memo_release (mtr_t *mtr, void *object, ulint type)
UNIV_INLINE dyn_array_t * mtr_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

Definition in file mtr0mtr.h.

Macro Definition Documentation

◆ MLOG_1BYTE

#define MLOG_1BYTE   (1)

one byte is written

Definition at line 66 of file mtr0mtr.h.

◆ MLOG_2BYTES

#define MLOG_2BYTES   (2)

2 bytes ...

Definition at line 67 of file mtr0mtr.h.

◆ MLOG_4BYTES

#define MLOG_4BYTES   (4)

4 bytes ...

Definition at line 68 of file mtr0mtr.h.

◆ MLOG_8BYTES

#define MLOG_8BYTES   (8)

8 bytes ...

Definition at line 69 of file mtr0mtr.h.

◆ MLOG_BIGGEST_TYPE

#define MLOG_BIGGEST_TYPE   ((byte)51)

biggest value (used in assertions)

Definition at line 180 of file mtr0mtr.h.

◆ MLOG_COMP_LIST_END_COPY_CREATED

#define MLOG_COMP_LIST_END_COPY_CREATED   ((byte)45)

copy compact record list end to a new created index page

Definition at line 163 of file mtr0mtr.h.

◆ MLOG_COMP_LIST_END_DELETE

#define MLOG_COMP_LIST_END_DELETE   ((byte)43)

delete compact record list end on index page

Definition at line 159 of file mtr0mtr.h.

◆ MLOG_COMP_LIST_START_DELETE

#define MLOG_COMP_LIST_START_DELETE   ((byte)44)

delete compact record list start on index page

Definition at line 161 of file mtr0mtr.h.

◆ MLOG_COMP_PAGE_CREATE

#define MLOG_COMP_PAGE_CREATE   ((byte)37)

create a compact index page

Definition at line 138 of file mtr0mtr.h.

◆ MLOG_COMP_PAGE_REORGANIZE

#define MLOG_COMP_PAGE_REORGANIZE   ((byte)46)

reorganize an index page

Definition at line 168 of file mtr0mtr.h.

◆ MLOG_COMP_REC_CLUST_DELETE_MARK

#define MLOG_COMP_REC_CLUST_DELETE_MARK   ((byte)39)

mark compact clustered index record deleted

Definition at line 141 of file mtr0mtr.h.

◆ MLOG_COMP_REC_DELETE

#define MLOG_COMP_REC_DELETE   ((byte)42)

delete a compact record from a page

Definition at line 157 of file mtr0mtr.h.

◆ MLOG_COMP_REC_INSERT

#define MLOG_COMP_REC_INSERT   ((byte)38)

compact record insert

Definition at line 140 of file mtr0mtr.h.

◆ MLOG_COMP_REC_MIN_MARK

#define MLOG_COMP_REC_MIN_MARK   ((byte)36)

mark a compact index record as the predefined minimum record

Definition at line 134 of file mtr0mtr.h.

◆ MLOG_COMP_REC_SEC_DELETE_MARK

#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.

Definition at line 145 of file mtr0mtr.h.

◆ MLOG_COMP_REC_UPDATE_IN_PLACE

#define MLOG_COMP_REC_UPDATE_IN_PLACE   ((byte)41

update of a compact record, preserves record field sizes

Definition at line 153 of file mtr0mtr.h.

◆ MLOG_DUMMY_RECORD

#define MLOG_DUMMY_RECORD   ((byte)32)

dummy log record used to pad a log block full

Definition at line 126 of file mtr0mtr.h.

◆ MLOG_FILE_CREATE

#define MLOG_FILE_CREATE   ((byte)33)

log record about an .ibd file creation

Definition at line 128 of file mtr0mtr.h.

◆ MLOG_FILE_CREATE2

#define MLOG_FILE_CREATE2   ((byte)47)

log record about creating an .ibd file, with format

Definition at line 169 of file mtr0mtr.h.

◆ MLOG_FILE_DELETE

#define MLOG_FILE_DELETE   ((byte)35)

log record about an .ibd file deletion

Definition at line 132 of file mtr0mtr.h.

◆ MLOG_FILE_FLAG_TEMP

#define MLOG_FILE_FLAG_TEMP   1

identifies TEMPORARY TABLE in MLOG_FILE_CREATE, MLOG_FILE_CREATE2

Definition at line 187 of file mtr0mtr.h.

◆ MLOG_FILE_RENAME

#define MLOG_FILE_RENAME   ((byte)34)

log record about an .ibd file rename

Definition at line 130 of file mtr0mtr.h.

◆ MLOG_IBUF_BITMAP_INIT

#define MLOG_IBUF_BITMAP_INIT   ((byte)27)

initialize an ibuf bitmap page

Definition at line 105 of file mtr0mtr.h.

◆ MLOG_INIT_FILE_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

Definition at line 111 of file mtr0mtr.h.

◆ MLOG_LIST_END_COPY_CREATED

#define MLOG_LIST_END_COPY_CREATED   ((byte)17)

copy record list end to a new created index page

Definition at line 83 of file mtr0mtr.h.

◆ MLOG_LIST_END_DELETE

#define MLOG_LIST_END_DELETE   ((byte)15)

delete record list end on index page

Definition at line 79 of file mtr0mtr.h.

◆ MLOG_LIST_START_DELETE

#define MLOG_LIST_START_DELETE   ((byte)16)

delete record list start on index page

Definition at line 81 of file mtr0mtr.h.

◆ MLOG_MULTI_REC_END

#define MLOG_MULTI_REC_END   ((byte)31)

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

Definition at line 122 of file mtr0mtr.h.

◆ MLOG_PAGE_CREATE

#define MLOG_PAGE_CREATE   ((byte)19)

create an index page

Definition at line 88 of file mtr0mtr.h.

◆ MLOG_PAGE_REORGANIZE

#define MLOG_PAGE_REORGANIZE   ((byte)18)

reorganize an index page in ROW_FORMAT=REDUNDANT

Definition at line 85 of file mtr0mtr.h.

◆ MLOG_REC_CLUST_DELETE_MARK

#define MLOG_REC_CLUST_DELETE_MARK   ((byte)10)

mark clustered index record deleted

Definition at line 71 of file mtr0mtr.h.

◆ MLOG_REC_DELETE

#define MLOG_REC_DELETE   ((byte)14)

delete a record from a page

Definition at line 77 of file mtr0mtr.h.

◆ MLOG_REC_INSERT

#define MLOG_REC_INSERT   ((byte)9)

record insert

Definition at line 70 of file mtr0mtr.h.

◆ MLOG_REC_MIN_MARK

#define MLOG_REC_MIN_MARK   ((byte)26)

mark an index record as the predefined minimum record

Definition at line 101 of file mtr0mtr.h.

◆ MLOG_REC_SEC_DELETE_MARK

#define MLOG_REC_SEC_DELETE_MARK   ((byte)11)

mark secondary index record deleted

Definition at line 73 of file mtr0mtr.h.

◆ MLOG_REC_UPDATE_IN_PLACE

#define MLOG_REC_UPDATE_IN_PLACE   ((byte)13)

update of a record, preserves record field sizes

Definition at line 75 of file mtr0mtr.h.

◆ MLOG_SINGLE_REC_FLAG

#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

Definition at line 60 of file mtr0mtr.h.

◆ MLOG_UNDO_ERASE_END

#define MLOG_UNDO_ERASE_END   ((byte)21)

erase an undo log page end

Definition at line 91 of file mtr0mtr.h.

◆ MLOG_UNDO_HDR_CREATE

#define MLOG_UNDO_HDR_CREATE   ((byte)25)

create an undo log header

Definition at line 99 of file mtr0mtr.h.

◆ MLOG_UNDO_HDR_DISCARD

#define MLOG_UNDO_HDR_DISCARD   ((byte)23)

discard an update undo log header

Definition at line 95 of file mtr0mtr.h.

◆ MLOG_UNDO_HDR_REUSE

#define MLOG_UNDO_HDR_REUSE   ((byte)24)

reuse an insert undo log header

Definition at line 97 of file mtr0mtr.h.

◆ MLOG_UNDO_INIT

#define MLOG_UNDO_INIT   ((byte)22)

initialize a page in an undo log

Definition at line 93 of file mtr0mtr.h.

◆ MLOG_UNDO_INSERT

#define MLOG_UNDO_INSERT   ((byte)20)

insert entry in an undo log

Definition at line 89 of file mtr0mtr.h.

◆ MLOG_WRITE_STRING

#define MLOG_WRITE_STRING   ((byte)30)

write a string to a page

Definition at line 120 of file mtr0mtr.h.

◆ MLOG_ZIP_PAGE_COMPRESS

#define MLOG_ZIP_PAGE_COMPRESS   ((byte)51)

compress an index page

Definition at line 179 of file mtr0mtr.h.

◆ MLOG_ZIP_WRITE_BLOB_PTR

#define MLOG_ZIP_WRITE_BLOB_PTR   ((byte)49)

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

Definition at line 174 of file mtr0mtr.h.

◆ MLOG_ZIP_WRITE_HEADER

#define MLOG_ZIP_WRITE_HEADER   ((byte)50)

write to compressed page header

Definition at line 177 of file mtr0mtr.h.

◆ MLOG_ZIP_WRITE_NODE_PTR

#define MLOG_ZIP_WRITE_NODE_PTR   ((byte)48)

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

Definition at line 171 of file mtr0mtr.h.

◆ mtr0mtr_h

#define mtr0mtr_h

Definition at line 28 of file mtr0mtr.h.

◆ MTR_ACTIVE

#define MTR_ACTIVE   12231

Definition at line 403 of file mtr0mtr.h.

◆ MTR_BUF_MEMO_SIZE

#define MTR_BUF_MEMO_SIZE   200 /* number of slots in memo */

Definition at line 345 of file mtr0mtr.h.

◆ MTR_COMMITTED

#define MTR_COMMITTED   34676

Definition at line 405 of file mtr0mtr.h.

◆ MTR_COMMITTING

#define MTR_COMMITTING   56456

Definition at line 404 of file mtr0mtr.h.

◆ MTR_LOG_ALL

#define MTR_LOG_ALL
Value:
21 /* default mode: log all operations
modifying disk-based data */

Definition at line 40 of file mtr0mtr.h.

◆ MTR_LOG_NONE

#define MTR_LOG_NONE   22 /* log no operations */

Definition at line 41 of file mtr0mtr.h.

◆ MTR_LOG_SHORT_INSERTS

#define MTR_LOG_SHORT_INSERTS
Value:
24 /* inserts are logged in a shorter
form */

Definition at line 45 of file mtr0mtr.h.

◆ MTR_MEMO_BUF_FIX

#define MTR_MEMO_BUF_FIX   RW_NO_LATCH

Definition at line 51 of file mtr0mtr.h.

◆ MTR_MEMO_MODIFY

#define MTR_MEMO_MODIFY   54

Definition at line 52 of file mtr0mtr.h.

◆ MTR_MEMO_PAGE_S_FIX

#define MTR_MEMO_PAGE_S_FIX   RW_S_LATCH

Definition at line 49 of file mtr0mtr.h.

◆ MTR_MEMO_PAGE_X_FIX

#define MTR_MEMO_PAGE_X_FIX   RW_X_LATCH

Definition at line 50 of file mtr0mtr.h.

◆ MTR_MEMO_S_LOCK

#define MTR_MEMO_S_LOCK   55

Definition at line 53 of file mtr0mtr.h.

◆ MTR_MEMO_X_LOCK

#define MTR_MEMO_X_LOCK   56

Definition at line 54 of file mtr0mtr.h.

◆ mtr_s_lock

#define mtr_s_lock ( B,
MTR )
Value:
mtr_s_lock_func((B), __FILE__, __LINE__,\
(MTR))
UNIV_INLINE void mtr_s_lock_func(rw_lock_t *lock, const char *file, ulint line, mtr_t *mtr)

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

Definition at line 269 of file mtr0mtr.h.

◆ mtr_x_lock

#define mtr_x_lock ( B,
MTR )
Value:
mtr_x_lock_func((B), __FILE__, __LINE__,\
(MTR))
UNIV_INLINE void mtr_x_lock_func(rw_lock_t *lock, const char *file, ulint line, mtr_t *mtr)

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

Definition at line 273 of file mtr0mtr.h.

Typedef Documentation

◆ mtr_memo_slot_t

typedef struct mtr_memo_slot_struct mtr_memo_slot_t

Definition at line 367 of file mtr0mtr.h.

Function Documentation

◆ mtr_commit()

UNIV_INTERN void mtr_commit ( mtr_t * mtr)

Commits a mini-transaction.

Parameters
mtrin: mini-transaction

Definition at line 247 of file mtr0mtr.cc.

◆ mtr_get_log()

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

◆ mtr_get_log_mode()

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

◆ mtr_memo_push()

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, ...

Parameters
mtrin: mtr
objectin: object

◆ mtr_memo_release()

UNIV_INTERN void mtr_memo_release ( mtr_t * mtr,
void * object,
ulint type )

Releases an object in the memo stack. in: object type: MTR_MEMO_S_LOCK, ...

Releases an object in the memo stack.

Parameters
mtrin: mtr
objectin: object
typein: object type: MTR_MEMO_S_LOCK, ...

Definition at line 316 of file mtr0mtr.cc.

◆ mtr_read_ulint()

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

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

Returns
value read
Parameters
ptrin: pointer from where to read
typein: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES
mtrin: mini-transaction handle

Definition at line 362 of file mtr0mtr.cc.

◆ mtr_release_s_latch_at_savepoint()

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

Parameters
mtrin: mtr
savepointin: savepoint

◆ mtr_rollback_to_savepoint()

UNIV_INTERN void mtr_rollback_to_savepoint ( mtr_t * mtr,
ulint savepoint )

Releases the latches stored in an mtr memo down to a savepoint. NOTE! The mtr must not have made changes to buffer pages after the savepoint, as these can be handled only by mtr_commit. in: savepoint

Releases the latches stored in an mtr memo down to a savepoint. NOTE! The mtr must not have made changes to buffer pages after the savepoint, as these can be handled only by mtr_commit.

Parameters
mtrin: mtr
savepointin: savepoint

Definition at line 280 of file mtr0mtr.cc.

◆ mtr_s_lock_func()

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

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

◆ mtr_set_log_mode()

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, ...
Parameters
mtrin: mtr

◆ mtr_set_savepoint()

UNIV_INLINE ulint mtr_set_savepoint ( mtr_t * mtr)

Sets and returns a savepoint in mtr.

Returns
savepoint in: mtr

◆ mtr_start()

UNIV_INLINE void mtr_start ( mtr_t * mtr)

Starts a mini-transaction.

Parameters
mtrout: mini-transaction

◆ mtr_x_lock_func()

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

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