Browse Source

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.
pull/1447/head
Marko Mäkelä 6 years ago
parent
commit
600eae9179
  1. 1
      storage/innobase/fsp/fsp0fsp.cc
  2. 1
      storage/innobase/include/mtr0mtr.h
  3. 6
      storage/innobase/include/mtr0mtr.ic
  4. 7
      storage/innobase/include/mtr0types.h
  5. 3
      storage/innobase/include/page0cur.h
  6. 3
      storage/innobase/mtr/mtr0log.cc
  7. 2
      storage/innobase/mtr/mtr0mtr.cc
  8. 71
      storage/innobase/page/page0cur.cc
  9. 3
      storage/innobase/trx/trx0rec.cc
  10. 3
      storage/innobase/trx/trx0undo.cc

1
storage/innobase/fsp/fsp0fsp.cc

@ -506,7 +506,6 @@ updating an allocation bitmap page.
void fil_space_t::modify_check(const mtr_t& mtr) const void fil_space_t::modify_check(const mtr_t& mtr) const
{ {
switch (mtr.get_log_mode()) { switch (mtr.get_log_mode()) {
case MTR_LOG_SHORT_INSERTS:
case MTR_LOG_NONE: case MTR_LOG_NONE:
/* These modes are only allowed within a non-bitmap page /* These modes are only allowed within a non-bitmap page
when there is a higher-level redo log record written. */ when there is a higher-level redo log record written. */

1
storage/innobase/include/mtr0mtr.h

@ -165,6 +165,7 @@ struct mtr_t {
mtr_log_t get_log_mode() const mtr_log_t get_log_mode() const
{ {
static_assert(MTR_LOG_ALL == 0, "efficiency"); 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); return static_cast<mtr_log_t>(m_log_mode);
} }

6
storage/innobase/include/mtr0mtr.ic

@ -185,7 +185,7 @@ mtr_log_t
mtr_t::set_log_mode(mtr_log_t mode) mtr_t::set_log_mode(mtr_log_t mode)
{ {
ut_ad(mode >= MTR_LOG_ALL); 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(); 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); ut_ad(mode == MTR_LOG_NO_REDO || mode == MTR_LOG_NONE);
return(old_mode); return(old_mode);
case MTR_LOG_NONE: case MTR_LOG_NONE:
if (mode == old_mode || mode == MTR_LOG_SHORT_INSERTS) {
if (mode == old_mode) {
/* Keep MTR_LOG_NONE. */ /* Keep MTR_LOG_NONE. */
return(old_mode); return(old_mode);
} }
/* fall through */
case MTR_LOG_SHORT_INSERTS:
ut_ad(mode == MTR_LOG_ALL); ut_ad(mode == MTR_LOG_ALL);
/* fall through */ /* fall through */
case MTR_LOG_ALL: case MTR_LOG_ALL:

7
storage/innobase/include/mtr0types.h

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. 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 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 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, MTR_LOG_NONE,
/** Don't generate REDO log but add dirty pages to flush list */ /** 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 /** @name Log item types

3
storage/innobase/include/page0cur.h

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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 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. Parses a log record of copying a record list end to a new created page.
@return end of log record or NULL */ @return end of log record or NULL */
ATTRIBUTE_COLD /* only used when crash-upgrading */
const byte* const byte*
page_parse_copy_rec_list_to_created_page( page_parse_copy_rec_list_to_created_page(
/*=====================================*/ /*=====================================*/

3
storage/innobase/mtr/mtr0log.cc

@ -404,9 +404,6 @@ mlog_open_and_write_index(
case MTR_LOG_NONE: case MTR_LOG_NONE:
case MTR_LOG_NO_REDO: case MTR_LOG_NO_REDO:
return NULL; return NULL;
case MTR_LOG_SHORT_INSERTS:
ut_ad(0);
/* fall through */
case MTR_LOG_ALL: case MTR_LOG_ALL:
break; break;
} }

2
storage/innobase/mtr/mtr0mtr.cc

@ -502,7 +502,6 @@ mtr_t::is_named_space(ulint space) const
case MTR_LOG_NO_REDO: case MTR_LOG_NO_REDO:
return(true); return(true);
case MTR_LOG_ALL: case MTR_LOG_ALL:
case MTR_LOG_SHORT_INSERTS:
return(m_user_space_id == space return(m_user_space_id == space
|| is_predefined_tablespace(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: case MTR_LOG_NO_REDO:
return true; return true;
case MTR_LOG_ALL: case MTR_LOG_ALL:
case MTR_LOG_SHORT_INSERTS:
return m_user_space == space || is_predefined_tablespace(space->id); return m_user_space == space || is_predefined_tablespace(space->id);
} }

71
storage/innobase/page/page0cur.cc

@ -2,7 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. 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 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 the terms of the GNU General Public License as published by the Free Software
@ -877,8 +877,6 @@ page_cur_insert_rec_write_log(
byte* log_ptr; byte* log_ptr;
if (mtr_get_log_mode(mtr) != MTR_LOG_SHORT_INSERTS) {
if (page_rec_is_comp(insert_rec)) { if (page_rec_is_comp(insert_rec)) {
log_ptr = mlog_open_and_write_index( log_ptr = mlog_open_and_write_index(
mtr, insert_rec, index, MLOG_COMP_REC_INSERT, mtr, insert_rec, index, MLOG_COMP_REC_INSERT,
@ -908,15 +906,6 @@ page_cur_insert_rec_write_log(
/* Write the cursor rec offset as a 2-byte ulint */ /* Write the cursor rec offset as a 2-byte ulint */
mach_write_to_2(log_ptr, page_offset(cursor_rec)); mach_write_to_2(log_ptr, page_offset(cursor_rec));
log_ptr += 2; 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 */
return;
}
log_end = &log_ptr[5 + 1 + 5 + 5 + MLOG_BUF_MARGIN];
}
if (page_rec_is_comp(insert_rec)) { if (page_rec_is_comp(insert_rec)) {
if (UNIV_UNLIKELY if (UNIV_UNLIKELY
@ -2018,37 +2007,10 @@ no_direction:
return(insert_rec); 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. Parses a log record of copying a record list end to a new created page.
@return end of log record or NULL */ @return end of log record or NULL */
ATTRIBUTE_COLD /* only used when crash-upgrading */
const byte* const byte*
page_parse_copy_rec_list_to_created_page( 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)); ut_ad(fil_page_index_page_check(block->frame));
/* This function is never invoked on the clustered index root page, /* This function is never invoked on the clustered index root page,
except in the redo log apply of 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. */ For other pages, this field must be zero-initialized. */
ut_ad(!page_get_instant(block->frame) ut_ad(!page_get_instant(block->frame)
|| !page_has_siblings(block->frame)); || !page_has_siblings(block->frame));
@ -2137,8 +2098,6 @@ page_copy_rec_list_end_to_created_page(
ulint n_recs; ulint n_recs;
ulint slot_index; ulint slot_index;
ulint rec_size; ulint rec_size;
byte* log_ptr;
ulint log_data_len;
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
offset_t offsets_[REC_OFFS_NORMAL_SIZE]; offset_t offsets_[REC_OFFS_NORMAL_SIZE];
offset_t* offsets = offsets_; 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, page_header_set_ptr(new_page, NULL, PAGE_HEAP_TOP,
new_page + srv_page_size - 1); new_page + srv_page_size - 1);
#endif #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); prev_rec = page_get_infimum_rec(new_page);
if (page_is_comp(new_page)) { if (page_is_comp(new_page)) {
heap_top = new_page + PAGE_NEW_SUPREMUM_END; heap_top = new_page + PAGE_NEW_SUPREMUM_END;
@ -2266,18 +2213,6 @@ page_copy_rec_list_end_to_created_page(
mem_heap_free(heap); 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)) { if (page_is_comp(new_page)) {
rec_set_next_offs_new(insert_rec, PAGE_NEW_SUPREMUM); rec_set_next_offs_new(insert_rec, PAGE_NEW_SUPREMUM);
} else { } else {

3
storage/innobase/trx/trx0rec.cc

@ -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_NONE:
case MTR_LOG_NO_REDO: case MTR_LOG_NO_REDO:
return; return;
case MTR_LOG_SHORT_INSERTS:
ut_ad(0);
/* fall through */
case MTR_LOG_ALL: case MTR_LOG_ALL:
break; break;
} }

3
storage/innobase/trx/trx0undo.cc

@ -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_NONE:
case MTR_LOG_NO_REDO: case MTR_LOG_NO_REDO:
return; return;
case MTR_LOG_SHORT_INSERTS:
ut_ad(0);
/* fall through */
case MTR_LOG_ALL: case MTR_LOG_ALL:
break; break;
} }

Loading…
Cancel
Save