Commit 9ee8917d authored by Marko Mäkelä's avatar Marko Mäkelä

Replace MLOG_UNDO_INSERT with MLOG_WRITE_STRING, MLOG_2BYTES

parent ccb35502
......@@ -100,9 +100,6 @@ enum mlog_id_t {
/** Create an index page */
MLOG_PAGE_CREATE = 19,
/** Insert entry in an undo log */
MLOG_UNDO_INSERT = 20,
/** erase an undo log page end */
MLOG_UNDO_ERASE_END = 21,
......
......@@ -237,15 +237,6 @@ trx_undo_prev_version_build(
And if we read "after image" of undo log */
/***********************************************************//**
Parses a redo log record of adding an undo log record.
@return end of log record or NULL */
byte*
trx_undo_parse_add_undo_rec(
/*========================*/
byte* ptr, /*!< in: buffer */
byte* end_ptr,/*!< in: buffer end */
page_t* page); /*!< in: page or NULL */
/***********************************************************//**
Parses a redo log record of erasing of an undo page end.
@return end of log record or NULL */
byte*
......
......@@ -1394,10 +1394,6 @@ recv_parse_or_apply_log_rec_body(
page_parse_create(block, type == MLOG_COMP_PAGE_CREATE_RTREE,
true);
break;
case MLOG_UNDO_INSERT:
ut_ad(!page || page_type == FIL_PAGE_UNDO_LOG);
ptr = trx_undo_parse_add_undo_rec(ptr, end_ptr, page);
break;
case MLOG_UNDO_ERASE_END:
ut_ad(!page || page_type == FIL_PAGE_UNDO_LOG);
ptr = trx_undo_parse_erase_page_end(ptr, end_ptr, page, mtr);
......@@ -3626,9 +3622,6 @@ get_mlog_string(mlog_id_t type)
case MLOG_PAGE_CREATE:
return("MLOG_PAGE_CREATE");
case MLOG_UNDO_INSERT:
return("MLOG_UNDO_INSERT");
case MLOG_UNDO_ERASE_END:
return("MLOG_UNDO_ERASE_END");
......
......@@ -65,78 +65,15 @@ trx_undof_page_add_undo_rec_log(
ulint new_free, /*!< in: end offset of the entry */
mtr_t* mtr) /*!< in: mtr */
{
byte* log_ptr;
const byte* log_end;
ulint len;
log_ptr = mlog_open(mtr, 11 + 13 + MLOG_BUF_MARGIN);
if (log_ptr == NULL) {
return;
}
log_end = &log_ptr[11 + 13 + MLOG_BUF_MARGIN];
log_ptr = mlog_write_initial_log_record_fast(
undo_page, MLOG_UNDO_INSERT, log_ptr, mtr);
len = new_free - old_free - 4;
mach_write_to_2(log_ptr, len);
log_ptr += 2;
if (log_ptr + len <= log_end) {
memcpy(log_ptr, undo_page + old_free + 2, len);
mlog_close(mtr, log_ptr + len);
} else {
mlog_close(mtr, log_ptr);
mlog_catenate_string(mtr, undo_page + old_free + 2, len);
}
}
/***********************************************************//**
Parses a redo log record of adding an undo log record.
@return end of log record or NULL */
byte*
trx_undo_parse_add_undo_rec(
/*========================*/
byte* ptr, /*!< in: buffer */
byte* end_ptr,/*!< in: buffer end */
page_t* page) /*!< in: page or NULL */
{
ulint len;
byte* rec;
ulint first_free;
if (end_ptr < ptr + 2) {
return(NULL);
}
len = mach_read_from_2(ptr);
ptr += 2;
if (end_ptr < ptr + len) {
return(NULL);
}
if (page == NULL) {
return(ptr + len);
}
first_free = mach_read_from_2(page + TRX_UNDO_PAGE_HDR
+ TRX_UNDO_PAGE_FREE);
rec = page + first_free;
mach_write_to_2(rec, first_free + 4 + len);
mach_write_to_2(rec + 2 + len, first_free);
mach_write_to_2(page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_FREE,
first_free + 4 + len);
ut_memcpy(rec + 2, ptr, len);
return(ptr + len);
ut_ad(old_free >= TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_HDR_SIZE);
ut_ad(new_free >= old_free);
ut_ad(new_free < UNIV_PAGE_SIZE);
ut_ad(mach_read_from_2(undo_page
+ TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_FREE)
== new_free);
mlog_write_ulint(undo_page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_FREE,
new_free, MLOG_2BYTES, mtr);
mlog_log_string(undo_page + old_free, new_free - old_free, mtr);
}
/**********************************************************************//**
......
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