Commit 504823bc authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-21174: Cleanup MLOG_PAGE_CREATE

page_create_write_log(), mlog_write_initial_log_record():
Merge to the only caller, and use
mlog_write_initial_log_record_low() for writing the log record.
parent 57444a3b
......@@ -89,17 +89,6 @@ mlog_memset(buf_block_t* b, ulint ofs, ulint len, byte val, mtr_t* mtr);
@param[in,out] mtr mini-transaction */
void mlog_memset(byte* b, ulint len, byte val, mtr_t* mtr);
/********************************************************//**
Writes initial part of a log record consisting of one-byte item
type and four-byte space and page numbers. */
void
mlog_write_initial_log_record(
/*==========================*/
const byte* ptr, /*!< in: pointer to (inside) a buffer
frame holding the file page where
modification is made */
mlog_id_t type, /*!< in: log item type: MLOG_1BYTE, ... */
mtr_t* mtr); /*!< in: mini-transaction handle */
/********************************************************//**
Catenates 1 - 4 bytes to the mtr log. The value is not compressed. */
UNIV_INLINE
......@@ -195,7 +184,7 @@ mlog_write_initial_log_record_fast(
been opened */
mtr_t* mtr); /*!< in: mtr */
/********************************************************//**
Parses an initial log record written by mlog_write_initial_log_record.
Parses an initial log record written by mlog_write_initial_log_record_low().
@return parsed record end, NULL if not a complete record */
const byte*
mlog_parse_initial_log_record(
......
......@@ -50,38 +50,7 @@ mlog_catenate_string(
}
/********************************************************//**
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. */
void
mlog_write_initial_log_record(
/*==========================*/
const byte* ptr, /*!< in: pointer to (inside) a buffer
frame holding the file page where
modification is made */
mlog_id_t type, /*!< in: log item type: MLOG_1BYTE, ... */
mtr_t* mtr) /*!< in: mini-transaction handle */
{
byte* log_ptr;
ut_ad(type <= MLOG_BIGGEST_TYPE);
ut_ad(type > MLOG_8BYTES);
log_ptr = mlog_open(mtr, 11);
/* If no logging is requested, we may return now */
if (log_ptr == NULL) {
return;
}
log_ptr = mlog_write_initial_log_record_fast(ptr, type, log_ptr, mtr);
mlog_close(mtr, log_ptr);
}
/********************************************************//**
Parses an initial log record written by mlog_write_initial_log_record.
Parses an initial log record written by mlog_write_initial_log_record_low().
@return parsed record end, NULL if not a complete record */
const byte*
mlog_parse_initial_log_record(
......
......@@ -250,30 +250,6 @@ page_set_autoinc(
}
}
/**********************************************************//**
Writes a log record of page creation. */
UNIV_INLINE
void
page_create_write_log(
/*==================*/
buf_frame_t* frame, /*!< in: a buffer frame where the page is
created */
mtr_t* mtr, /*!< in: mini-transaction handle */
ibool comp, /*!< in: TRUE=compact page format */
bool is_rtree) /*!< in: whether it is R-tree */
{
mlog_id_t type;
if (is_rtree) {
type = comp ? MLOG_COMP_PAGE_CREATE_RTREE
: MLOG_PAGE_CREATE_RTREE;
} else {
type = comp ? MLOG_COMP_PAGE_CREATE : MLOG_PAGE_CREATE;
}
mlog_write_initial_log_record(frame, type, mtr);
}
/** The page infimum and supremum of an empty page in ROW_FORMAT=REDUNDANT */
static const byte infimum_supremum_redundant[] = {
/* the infimum record */
......@@ -398,7 +374,22 @@ page_create(
bool is_rtree) /*!< in: whether it is a R-Tree page */
{
ut_ad(mtr->is_named_space(block->page.id.space()));
page_create_write_log(buf_block_get_frame(block), mtr, comp, is_rtree);
mtr->set_modified();
if (mtr->get_log_mode() != MTR_LOG_ALL) {
ut_ad(mtr->get_log_mode() == MTR_LOG_NONE
|| mtr->get_log_mode() == MTR_LOG_NO_REDO);
} else {
mlog_id_t type = is_rtree
? (comp
? MLOG_COMP_PAGE_CREATE_RTREE
: MLOG_PAGE_CREATE_RTREE)
: (comp ? MLOG_COMP_PAGE_CREATE : MLOG_PAGE_CREATE);
byte *l= mtr->get_log()->open(11);
l = mlog_write_initial_log_record_low(
type, block->page.id.space(), block->page.id.page_no(),
l, mtr);
mlog_close(mtr, l);
}
return(page_create_low(block, comp, is_rtree));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment