Skip to content

Commit 504823b

Browse files
committed
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.
1 parent 57444a3 commit 504823b

File tree

3 files changed

+18
-69
lines changed

3 files changed

+18
-69
lines changed

storage/innobase/include/mtr0log.h

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,6 @@ mlog_memset(buf_block_t* b, ulint ofs, ulint len, byte val, mtr_t* mtr);
8989
@param[in,out] mtr mini-transaction */
9090
void mlog_memset(byte* b, ulint len, byte val, mtr_t* mtr);
9191

92-
/********************************************************//**
93-
Writes initial part of a log record consisting of one-byte item
94-
type and four-byte space and page numbers. */
95-
void
96-
mlog_write_initial_log_record(
97-
/*==========================*/
98-
const byte* ptr, /*!< in: pointer to (inside) a buffer
99-
frame holding the file page where
100-
modification is made */
101-
mlog_id_t type, /*!< in: log item type: MLOG_1BYTE, ... */
102-
mtr_t* mtr); /*!< in: mini-transaction handle */
10392
/********************************************************//**
10493
Catenates 1 - 4 bytes to the mtr log. The value is not compressed. */
10594
UNIV_INLINE
@@ -195,7 +184,7 @@ mlog_write_initial_log_record_fast(
195184
been opened */
196185
mtr_t* mtr); /*!< in: mtr */
197186
/********************************************************//**
198-
Parses an initial log record written by mlog_write_initial_log_record.
187+
Parses an initial log record written by mlog_write_initial_log_record_low().
199188
@return parsed record end, NULL if not a complete record */
200189
const byte*
201190
mlog_parse_initial_log_record(

storage/innobase/mtr/mtr0log.cc

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -50,38 +50,7 @@ mlog_catenate_string(
5050
}
5151

5252
/********************************************************//**
53-
Writes the initial part of a log record consisting of one-byte item
54-
type and four-byte space and page numbers. Also pushes info
55-
to the mtr memo that a buffer page has been modified. */
56-
void
57-
mlog_write_initial_log_record(
58-
/*==========================*/
59-
const byte* ptr, /*!< in: pointer to (inside) a buffer
60-
frame holding the file page where
61-
modification is made */
62-
mlog_id_t type, /*!< in: log item type: MLOG_1BYTE, ... */
63-
mtr_t* mtr) /*!< in: mini-transaction handle */
64-
{
65-
byte* log_ptr;
66-
67-
ut_ad(type <= MLOG_BIGGEST_TYPE);
68-
ut_ad(type > MLOG_8BYTES);
69-
70-
log_ptr = mlog_open(mtr, 11);
71-
72-
/* If no logging is requested, we may return now */
73-
if (log_ptr == NULL) {
74-
75-
return;
76-
}
77-
78-
log_ptr = mlog_write_initial_log_record_fast(ptr, type, log_ptr, mtr);
79-
80-
mlog_close(mtr, log_ptr);
81-
}
82-
83-
/********************************************************//**
84-
Parses an initial log record written by mlog_write_initial_log_record.
53+
Parses an initial log record written by mlog_write_initial_log_record_low().
8554
@return parsed record end, NULL if not a complete record */
8655
const byte*
8756
mlog_parse_initial_log_record(

storage/innobase/page/page0page.cc

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -250,30 +250,6 @@ page_set_autoinc(
250250
}
251251
}
252252

253-
/**********************************************************//**
254-
Writes a log record of page creation. */
255-
UNIV_INLINE
256-
void
257-
page_create_write_log(
258-
/*==================*/
259-
buf_frame_t* frame, /*!< in: a buffer frame where the page is
260-
created */
261-
mtr_t* mtr, /*!< in: mini-transaction handle */
262-
ibool comp, /*!< in: TRUE=compact page format */
263-
bool is_rtree) /*!< in: whether it is R-tree */
264-
{
265-
mlog_id_t type;
266-
267-
if (is_rtree) {
268-
type = comp ? MLOG_COMP_PAGE_CREATE_RTREE
269-
: MLOG_PAGE_CREATE_RTREE;
270-
} else {
271-
type = comp ? MLOG_COMP_PAGE_CREATE : MLOG_PAGE_CREATE;
272-
}
273-
274-
mlog_write_initial_log_record(frame, type, mtr);
275-
}
276-
277253
/** The page infimum and supremum of an empty page in ROW_FORMAT=REDUNDANT */
278254
static const byte infimum_supremum_redundant[] = {
279255
/* the infimum record */
@@ -398,7 +374,22 @@ page_create(
398374
bool is_rtree) /*!< in: whether it is a R-Tree page */
399375
{
400376
ut_ad(mtr->is_named_space(block->page.id.space()));
401-
page_create_write_log(buf_block_get_frame(block), mtr, comp, is_rtree);
377+
mtr->set_modified();
378+
if (mtr->get_log_mode() != MTR_LOG_ALL) {
379+
ut_ad(mtr->get_log_mode() == MTR_LOG_NONE
380+
|| mtr->get_log_mode() == MTR_LOG_NO_REDO);
381+
} else {
382+
mlog_id_t type = is_rtree
383+
? (comp
384+
? MLOG_COMP_PAGE_CREATE_RTREE
385+
: MLOG_PAGE_CREATE_RTREE)
386+
: (comp ? MLOG_COMP_PAGE_CREATE : MLOG_PAGE_CREATE);
387+
byte *l= mtr->get_log()->open(11);
388+
l = mlog_write_initial_log_record_low(
389+
type, block->page.id.space(), block->page.id.page_no(),
390+
l, mtr);
391+
mlog_close(mtr, l);
392+
}
402393
return(page_create_low(block, comp, is_rtree));
403394
}
404395

0 commit comments

Comments
 (0)