MySQL 8.4.2
Source Code Documentation
|
Mini-transaction logging routines. More...
Go to the source code of this file.
Macros | |
#define | COMPACT_FLAG 0x01 |
#define | VERSION_FLAG 0x02 |
#define | INSTANT_FLAG 0x04 |
#define | IS_INSTANT(flags) (flags & INSTANT_FLAG) |
#define | IS_VERSIONED(flags) (flags & VERSION_FLAG) |
#define | IS_COMPACT(flags) (flags & COMPACT_FLAG) |
#define | SET_INSTANT(flags) (flag |= INSTANT_FLAG) |
#define | SET_VERSIONED(flags) (flag |= VERSION_FLAG) |
#define | SET_COMPACT(flags) (flag |= COMPACT_FLAG) |
Functions | |
void | mlog_write_ulint (byte *ptr, ulint val, mlog_id_t type, mtr_t *mtr) |
Writes 1, 2 or 4 bytes to a file page. More... | |
void | mlog_write_ull (byte *ptr, uint64_t val, mtr_t *mtr) |
Writes 8 bytes to a file page. More... | |
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. More... | |
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. More... | |
void | mlog_write_initial_log_record (const byte *ptr, mlog_id_t type, mtr_t *mtr) |
Writes initial part of a log record consisting of one-byte item type and four-byte space and page numbers. More... | |
static void | mlog_catenate_ulint (mtr_buf_t *dyn_buf, ulint val, mlog_id_t type) |
Catenates 1 - 4 bytes to the mtr log. More... | |
static void | mlog_catenate_ulint (mtr_t *mtr, ulint val, mlog_id_t type) |
Catenates 1 - 4 bytes to the mtr log. More... | |
void | mlog_catenate_string (mtr_t *mtr, const byte *str, ulint len) |
Catenates n bytes to the mtr log. More... | |
static void | mlog_catenate_ulint_compressed (mtr_t *mtr, ulint val) |
Catenates a compressed ulint to mlog. More... | |
static void | mlog_catenate_ull_compressed (mtr_t *mtr, uint64_t val) |
Catenates a compressed 64-bit integer to mlog. More... | |
static bool | mlog_open (mtr_t *mtr, ulint size, byte *&buffer) |
Opens a buffer to mlog. More... | |
static bool | mlog_open_metadata (mtr_t *mtr, ulint size, byte *&buffer) |
Opens a buffer to mlog. More... | |
static void | mlog_close (mtr_t *mtr, byte *ptr) |
Closes a buffer opened to mlog. More... | |
static byte * | mlog_write_initial_dict_log_record (mlog_id_t type, table_id_t id, uint64_t version, byte *log_ptr, mtr_t *mtr) |
Writes a log record about a dictionary operation, which would cost at most 23 bytes. More... | |
static byte * | mlog_write_initial_log_record_low (mlog_id_t type, space_id_t space_id, page_no_t page_no, byte *log_ptr, mtr_t *mtr) |
Writes a log record about an operation. More... | |
static byte * | mlog_write_initial_log_record_fast (const byte *ptr, mlog_id_t type, byte *log_ptr, mtr_t *mtr) |
Writes the initial part of a log record (3..11 bytes). More... | |
const byte * | mlog_parse_initial_dict_log_record (const byte *ptr, const byte *end_ptr, mlog_id_t *type, table_id_t *id, uint64_t *version) |
Parses an initial log record written by mlog_write_initial_dict_log_record. More... | |
const byte * | mlog_parse_initial_log_record (const byte *ptr, const byte *end_ptr, mlog_id_t *type, space_id_t *space, page_no_t *page_no) |
Parses an initial log record written by mlog_write_initial_log_record. More... | |
const byte * | mlog_parse_nbytes (mlog_id_t type, const byte *ptr, const byte *end_ptr, byte *page, void *page_zip) |
Parses a log record written by mlog_write_ulint or mlog_write_ull. More... | |
const byte * | mlog_parse_string (const byte *ptr, const byte *end_ptr, byte *page, void *page_zip) |
Parses a log record written by mlog_write_string. More... | |
bool | mlog_open_and_write_index (mtr_t *mtr, const byte *rec, const dict_index_t *index, mlog_id_t type, size_t size, byte *&log_ptr) |
Opens a buffer for mlog, writes the initial log record and, if needed, the field lengths of an index. More... | |
const byte * | mlog_parse_index (const byte *ptr, const byte *end_ptr, dict_index_t **index) |
Parses a log record written by mlog_open_and_write_index. More... | |
const byte * | mlog_parse_index_8027 (const byte *ptr, const byte *end_ptr, bool comp, dict_index_t **index) |
Parses a log record written by mlog_open_and_write_index in version <= 8027. More... | |
Variables | |
constexpr uint8_t | INDEX_LOG_VERSION_0 = 0 |
constexpr uint8_t | INDEX_LOG_VERSION_CURRENT = 1 |
constexpr uint8_t | INDEX_LOG_VERSION_MAX = INDEX_LOG_VERSION_CURRENT |
constexpr size_t | REDO_LOG_INITIAL_INFO_SIZE = 11 |
constexpr auto | MLOG_BUF_MARGIN = 256 |
Insert, update, and maybe other functions may use this value to define an extra mlog buffer size for variable size data. More... | |
Mini-transaction logging routines.
Created 12/7/1995 Heikki Tuuri
#define COMPACT_FLAG 0x01 |
#define INSTANT_FLAG 0x04 |
#define IS_COMPACT | ( | flags | ) | (flags & COMPACT_FLAG) |
#define IS_INSTANT | ( | flags | ) | (flags & INSTANT_FLAG) |
#define IS_VERSIONED | ( | flags | ) | (flags & VERSION_FLAG) |
#define SET_COMPACT | ( | flags | ) | (flag |= COMPACT_FLAG) |
#define SET_INSTANT | ( | flags | ) | (flag |= INSTANT_FLAG) |
#define SET_VERSIONED | ( | flags | ) | (flag |= VERSION_FLAG) |
#define VERSION_FLAG 0x02 |
Catenates n bytes to the mtr log.
[in] | mtr | Mini-transaction |
[in] | str | String to write |
[in] | len | String length |
Catenates 1 - 4 bytes to the mtr log.
The value is not compressed.
[in,out] | dyn_buf | buffer to write |
[in] | val | value to write |
[in] | type | type of value to write |
Catenates 1 - 4 bytes to the mtr log.
[in] | mtr | mtr |
[in] | val | value to write |
[in] | type | MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES |
Catenates a compressed ulint to mlog.
[in] | mtr | mtr |
[in] | val | value to write |
|
inlinestatic |
Catenates a compressed 64-bit integer to mlog.
[in] | mtr | mtr |
[in] | val | value to write |
Closes a buffer opened to mlog.
[in] | mtr | mtr |
[in] | ptr | buffer space from ptr up was not used |
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
Writes the corresponding log record to the mini-transaction log.
ptr | in: pointer written to |
len | in: string length |
mtr | in: mini-transaction handle |
Opens a buffer to mlog.
It must be closed with mlog_close.
[in,out] | mtr | mtr |
[in] | size | buffer size in bytes; MUST be smaller than DYN_ARRAY_DATA_SIZE! |
[out] | buffer | mlog buffer pointer if opened successfully |
true | if opened successfully. |
false | if not opened. One case is when redo is disabled for mtr. |
bool mlog_open_and_write_index | ( | mtr_t * | mtr, |
const byte * | rec, | ||
const dict_index_t * | index, | ||
mlog_id_t | type, | ||
size_t | size, | ||
byte *& | log_ptr | ||
) |
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().
[in,out] | mtr | Mini-transaction |
[in] | rec | Index record or page |
[in] | index | Record descriptor |
[in] | type | Log item type |
[in] | size | Requested buffer size in bytes. if 0, calls mlog_close() and returns false. |
[out] | log_ptr | Log buffer pointer |
true | if opened successfully. |
false | if not opened. One case is when redo is disabled for mtr. |
Opens a buffer to mlog.
It must be closed with mlog_close. This is used for writing log for metadata changes
[in,out] | mtr | mtr |
[in] | size | buffer size in bytes; MUST be smaller than DYN_ARRAY_DATA_SIZE! |
[out] | buffer | mlog buffer pointer if opened successfully |
true | if opened successfully. |
false | if not opened. One case is when redo is disabled for mtr. |
const byte * mlog_parse_index | ( | const byte * | ptr, |
const byte * | end_ptr, | ||
dict_index_t ** | index | ||
) |
Parses a log record written by mlog_open_and_write_index.
[in] | ptr | buffer |
[in] | end_ptr | buffer end |
[out] | index | own: dummy index |
const byte * mlog_parse_index_8027 | ( | const byte * | ptr, |
const byte * | end_ptr, | ||
bool | comp, | ||
dict_index_t ** | index | ||
) |
Parses a log record written by mlog_open_and_write_index in version <= 8027.
This function should never be changed and should be removed once recovery from mysql-8.0.27 is not needed anymore.
[in] | ptr | buffer |
[in] | end_ptr | buffer end |
[in] | comp | true=compact row format |
[out] | index | own: dummy index |
const byte * mlog_parse_initial_dict_log_record | ( | const byte * | ptr, |
const byte * | end_ptr, | ||
mlog_id_t * | type, | ||
table_id_t * | id, | ||
uint64_t * | version | ||
) |
Parses an initial log record written by mlog_write_initial_dict_log_record.
[in] | ptr | buffer |
[in] | end_ptr | buffer end |
[out] | type | log record type, should be MLOG_TABLE_DYNAMIC_META |
[out] | id | table id |
[out] | version | table dynamic metadata version |
const byte * mlog_parse_initial_log_record | ( | const byte * | ptr, |
const byte * | end_ptr, | ||
mlog_id_t * | type, | ||
space_id_t * | space, | ||
page_no_t * | page_no | ||
) |
Parses an initial log record written by mlog_write_initial_log_record.
ptr | in: buffer |
end_ptr | in: buffer end |
type | out: log record type: MLOG_1BYTE, ... |
space | out: space id |
page_no | out: page number |
const byte * mlog_parse_nbytes | ( | mlog_id_t | type, |
const byte * | ptr, | ||
const byte * | end_ptr, | ||
byte * | page, | ||
void * | page_zip | ||
) |
Parses a log record written by mlog_write_ulint or mlog_write_ull.
type | in: log record type: MLOG_1BYTE, ... |
ptr | in: buffer |
end_ptr | in: buffer end |
page | in: page where to apply the log record, or NULL |
page_zip | in/out: compressed page, or NULL |
const byte * mlog_parse_string | ( | const byte * | ptr, |
const byte * | end_ptr, | ||
byte * | page, | ||
void * | page_zip | ||
) |
Parses a log record written by mlog_write_string.
ptr | in: buffer |
end_ptr | in: buffer end |
page | in: page where to apply the log record, or NULL |
page_zip | in/out: compressed page, or NULL |
|
inlinestatic |
Writes a log record about a dictionary operation, which would cost at most 23 bytes.
[in] | type | Redo log record type |
[in] | id | Table id |
[in] | version | Table dynamic metadata version |
[in,out] | log_ptr | Current end of mini-transaction log |
[in,out] | mtr | Mini-transaction |
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 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.
ptr | in: pointer to (inside) a buffer frame holding the file page where modification is made |
type | in: log item type: MLOG_1BYTE, ... |
mtr | in: mini-transaction handle |
|
inlinestatic |
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!
[in] | ptr | pointer to (inside) a buffer frame holding the file page where modification is made |
[in] | type | log item type: MLOG_1BYTE, ... |
[in] | log_ptr | pointer to mtr log which has been opened |
[in] | mtr | mtr |
|
inlinestatic |
Writes a log record about an operation.
[in] | type | Redo log record type |
[in] | space_id | Tablespace identifier |
[in] | page_no | Page number |
[in,out] | log_ptr | Current end of mini-transaction log |
[in,out] | mtr | Mini-transaction |
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 the corresponding log record to the mini-transaction log.
ptr | in: pointer where to write |
str | in: string to write |
len | in: string length |
mtr | in: mini-transaction handle |
Writes 1, 2 or 4 bytes to a file page.
Writes the corresponding log record to the mini-transaction log if mtr is not NULL. in: mini-transaction handle
Writes the corresponding log record to the mini-transaction log if mtr is not NULL.
ptr | in: pointer where to write |
val | in: value to write |
type | in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES |
mtr | in: mini-transaction handle |
Writes 8 bytes to a file page.
Writes the corresponding log record to the mini-transaction log, only if mtr is not NULL in: mini-transaction handle
Writes the corresponding log record to the mini-transaction log, only if mtr is not NULL
ptr | in: pointer where to write |
val | in: value to write |
mtr | in: mini-transaction handle |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
Insert, update, and maybe other functions may use this value to define an extra mlog buffer size for variable size data.
|
constexpr |