Commit 600eae91 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-12353: Remove MTR_LOG_SHORT_INSERTS

No longer emit the redo log records
MLOG_LIST_END_COPY_CREATED, MLOG_COMP_LIST_END_COPY_CREATED.
parent ac51bcfd
......@@ -506,7 +506,6 @@ updating an allocation bitmap page.
void fil_space_t::modify_check(const mtr_t& mtr) const
{
switch (mtr.get_log_mode()) {
case MTR_LOG_SHORT_INSERTS:
case MTR_LOG_NONE:
/* These modes are only allowed within a non-bitmap page
when there is a higher-level redo log record written. */
......
......@@ -165,6 +165,7 @@ struct mtr_t {
mtr_log_t get_log_mode() const
{
static_assert(MTR_LOG_ALL == 0, "efficiency");
ut_ad(m_log_mode <= MTR_LOG_NO_REDO);
return static_cast<mtr_log_t>(m_log_mode);
}
......
......@@ -185,7 +185,7 @@ mtr_log_t
mtr_t::set_log_mode(mtr_log_t mode)
{
ut_ad(mode >= MTR_LOG_ALL);
ut_ad(mode <= MTR_LOG_SHORT_INSERTS);
ut_ad(mode <= MTR_LOG_NO_REDO);
const mtr_log_t old_mode = get_log_mode();
......@@ -195,12 +195,10 @@ mtr_t::set_log_mode(mtr_log_t mode)
ut_ad(mode == MTR_LOG_NO_REDO || mode == MTR_LOG_NONE);
return(old_mode);
case MTR_LOG_NONE:
if (mode == old_mode || mode == MTR_LOG_SHORT_INSERTS) {
if (mode == old_mode) {
/* Keep MTR_LOG_NONE. */
return(old_mode);
}
/* fall through */
case MTR_LOG_SHORT_INSERTS:
ut_ad(mode == MTR_LOG_ALL);
/* fall through */
case MTR_LOG_ALL:
......
/*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation.
Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -44,10 +44,7 @@ enum mtr_log_t {
MTR_LOG_NONE,
/** Don't generate REDO log but add dirty pages to flush list */
MTR_LOG_NO_REDO,
/** Inserts are logged in a shorter form */
MTR_LOG_SHORT_INSERTS
MTR_LOG_NO_REDO
};
/** @name Log item types
......
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2018, 2019, MariaDB Corporation.
Copyright (c) 2018, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -350,6 +350,7 @@ page_cur_parse_insert_rec(
/**********************************************************//**
Parses a log record of copying a record list end to a new created page.
@return end of log record or NULL */
ATTRIBUTE_COLD /* only used when crash-upgrading */
const byte*
page_parse_copy_rec_list_to_created_page(
/*=====================================*/
......
......@@ -404,9 +404,6 @@ mlog_open_and_write_index(
case MTR_LOG_NONE:
case MTR_LOG_NO_REDO:
return NULL;
case MTR_LOG_SHORT_INSERTS:
ut_ad(0);
/* fall through */
case MTR_LOG_ALL:
break;
}
......
......@@ -502,7 +502,6 @@ mtr_t::is_named_space(ulint space) const
case MTR_LOG_NO_REDO:
return(true);
case MTR_LOG_ALL:
case MTR_LOG_SHORT_INSERTS:
return(m_user_space_id == space
|| is_predefined_tablespace(space));
}
......@@ -523,7 +522,6 @@ bool mtr_t::is_named_space(const fil_space_t* space) const
case MTR_LOG_NO_REDO:
return true;
case MTR_LOG_ALL:
case MTR_LOG_SHORT_INSERTS:
return m_user_space == space || is_predefined_tablespace(space->id);
}
......
......@@ -2,7 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2018, 2019, MariaDB Corporation.
Copyright (c) 2018, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -877,47 +877,36 @@ page_cur_insert_rec_write_log(
byte* log_ptr;
if (mtr_get_log_mode(mtr) != MTR_LOG_SHORT_INSERTS) {
if (page_rec_is_comp(insert_rec)) {
log_ptr = mlog_open_and_write_index(
mtr, insert_rec, index, MLOG_COMP_REC_INSERT,
2 + 5 + 1 + 5 + 5 + MLOG_BUF_MARGIN);
if (UNIV_UNLIKELY(!log_ptr)) {
/* Logging in mtr is switched off
during crash recovery: in that case
mlog_open returns NULL */
return;
}
} else {
log_ptr = mlog_open(mtr, 11
+ 2 + 5 + 1 + 5 + 5
+ MLOG_BUF_MARGIN);
if (UNIV_UNLIKELY(!log_ptr)) {
/* Logging in mtr is switched off
during crash recovery: in that case
mlog_open returns NULL */
return;
}
log_ptr = mlog_write_initial_log_record_fast(
insert_rec, MLOG_REC_INSERT, log_ptr, mtr);
if (page_rec_is_comp(insert_rec)) {
log_ptr = mlog_open_and_write_index(
mtr, insert_rec, index, MLOG_COMP_REC_INSERT,
2 + 5 + 1 + 5 + 5 + MLOG_BUF_MARGIN);
if (UNIV_UNLIKELY(!log_ptr)) {
/* Logging in mtr is switched off
during crash recovery: in that case
mlog_open returns NULL */
return;
}
log_end = &log_ptr[2 + 5 + 1 + 5 + 5 + MLOG_BUF_MARGIN];
/* Write the cursor rec offset as a 2-byte ulint */
mach_write_to_2(log_ptr, page_offset(cursor_rec));
log_ptr += 2;
} else {
log_ptr = mlog_open(mtr, 5 + 1 + 5 + 5 + MLOG_BUF_MARGIN);
if (!log_ptr) {
/* Logging in mtr is switched off during crash
recovery: in that case mlog_open returns NULL */
log_ptr = mlog_open(mtr, 11
+ 2 + 5 + 1 + 5 + 5
+ MLOG_BUF_MARGIN);
if (UNIV_UNLIKELY(!log_ptr)) {
/* Logging in mtr is switched off
during crash recovery: in that case
mlog_open returns NULL */
return;
}
log_end = &log_ptr[5 + 1 + 5 + 5 + MLOG_BUF_MARGIN];
log_ptr = mlog_write_initial_log_record_fast(
insert_rec, MLOG_REC_INSERT, log_ptr, mtr);
}
log_end = &log_ptr[2 + 5 + 1 + 5 + 5 + MLOG_BUF_MARGIN];
/* Write the cursor rec offset as a 2-byte ulint */
mach_write_to_2(log_ptr, page_offset(cursor_rec));
log_ptr += 2;
if (page_rec_is_comp(insert_rec)) {
if (UNIV_UNLIKELY
(rec_get_info_and_status_bits(insert_rec, TRUE)
......@@ -2018,37 +2007,10 @@ page_cur_insert_rec_zip(
return(insert_rec);
}
/**********************************************************//**
Writes a log record of copying a record list end to a new created page.
@return 4-byte field where to write the log data length, or NULL if
logging is disabled */
UNIV_INLINE
byte*
page_copy_rec_list_to_created_page_write_log(
/*=========================================*/
page_t* page, /*!< in: index page */
dict_index_t* index, /*!< in: record descriptor */
mtr_t* mtr) /*!< in: mtr */
{
byte* log_ptr;
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
ut_ad(mtr->is_named_space(index->table->space));
log_ptr = mlog_open_and_write_index(mtr, page, index,
page_is_comp(page)
? MLOG_COMP_LIST_END_COPY_CREATED
: MLOG_LIST_END_COPY_CREATED, 4);
if (UNIV_LIKELY(log_ptr != NULL)) {
mlog_close(mtr, log_ptr + 4);
}
return(log_ptr);
}
/**********************************************************//**
Parses a log record of copying a record list end to a new created page.
@return end of log record or NULL */
ATTRIBUTE_COLD /* only used when crash-upgrading */
const byte*
page_parse_copy_rec_list_to_created_page(
/*=====================================*/
......@@ -2087,8 +2049,7 @@ page_parse_copy_rec_list_to_created_page(
ut_ad(fil_page_index_page_check(block->frame));
/* This function is never invoked on the clustered index root page,
except in the redo log apply of
page_copy_rec_list_end_to_created_page() which was logged by.
page_copy_rec_list_to_created_page_write_log().
page_copy_rec_list_end_to_created_page().
For other pages, this field must be zero-initialized. */
ut_ad(!page_get_instant(block->frame)
|| !page_has_siblings(block->frame));
......@@ -2137,8 +2098,6 @@ page_copy_rec_list_end_to_created_page(
ulint n_recs;
ulint slot_index;
ulint rec_size;
byte* log_ptr;
ulint log_data_len;
mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_;
......@@ -2169,18 +2128,6 @@ page_copy_rec_list_end_to_created_page(
page_header_set_ptr(new_page, NULL, PAGE_HEAP_TOP,
new_page + srv_page_size - 1);
#endif
log_ptr = page_copy_rec_list_to_created_page_write_log(new_page,
index, mtr);
log_data_len = mtr->get_log()->size();
/* Individual inserts are logged in a shorter form */
const mtr_log_t log_mode = index->table->is_temporary()
|| !index->is_readable() /* IMPORT TABLESPACE */
? mtr_get_log_mode(mtr)
: mtr_set_log_mode(mtr, MTR_LOG_SHORT_INSERTS);
prev_rec = page_get_infimum_rec(new_page);
if (page_is_comp(new_page)) {
heap_top = new_page + PAGE_NEW_SUPREMUM_END;
......@@ -2266,18 +2213,6 @@ page_copy_rec_list_end_to_created_page(
mem_heap_free(heap);
}
/* Restore the log mode */
mtr_set_log_mode(mtr, log_mode);
log_data_len = mtr->get_log()->size() - log_data_len;
ut_a(log_data_len < 100U << srv_page_size_shift);
if (log_ptr != NULL) {
mach_write_to_4(log_ptr, log_data_len);
}
if (page_is_comp(new_page)) {
rec_set_next_offs_new(insert_rec, PAGE_NEW_SUPREMUM);
} else {
......
......@@ -74,9 +74,6 @@ static void trx_undof_page_add_undo_rec_log(const buf_block_t* undo_block,
case MTR_LOG_NONE:
case MTR_LOG_NO_REDO:
return;
case MTR_LOG_SHORT_INSERTS:
ut_ad(0);
/* fall through */
case MTR_LOG_ALL:
break;
}
......
......@@ -392,9 +392,6 @@ static void trx_undo_page_init(const buf_block_t *undo_block, mtr_t *mtr)
case MTR_LOG_NONE:
case MTR_LOG_NO_REDO:
return;
case MTR_LOG_SHORT_INSERTS:
ut_ad(0);
/* fall through */
case MTR_LOG_ALL:
break;
}
......
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