summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-12-02 18:50:05 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-12-03 11:05:18 +0200
commit504823bcce5926bd5a20b8b8f202ed479ff6d750 (patch)
tree00d33728a19768899cdb5f320474a5e71dbcf2c2
parent57444a3b3086e96272cf10c3749c5ddb5f990492 (diff)
downloadmariadb-git-504823bcce5926bd5a20b8b8f202ed479ff6d750.tar.gz
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.
-rw-r--r--storage/innobase/include/mtr0log.h13
-rw-r--r--storage/innobase/mtr/mtr0log.cc33
-rw-r--r--storage/innobase/page/page0page.cc41
3 files changed, 18 insertions, 69 deletions
diff --git a/storage/innobase/include/mtr0log.h b/storage/innobase/include/mtr0log.h
index 9fc19673230..6ebf834456c 100644
--- a/storage/innobase/include/mtr0log.h
+++ b/storage/innobase/include/mtr0log.h
@@ -90,17 +90,6 @@ mlog_memset(buf_block_t* b, ulint ofs, ulint len, byte val, mtr_t* mtr);
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
void
@@ -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(
diff --git a/storage/innobase/mtr/mtr0log.cc b/storage/innobase/mtr/mtr0log.cc
index 4726e828d42..bd56ec67394 100644
--- a/storage/innobase/mtr/mtr0log.cc
+++ b/storage/innobase/mtr/mtr0log.cc
@@ -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(
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index e6d32d416bb..a6e1e5e5b8a 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -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));
}