Commit 3e6fcb6a authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-14935 Remove bogus conditions related to not redo-logging PAGE_MAX_TRX_ID changes

InnoDB originally skipped the redo logging of PAGE_MAX_TRX_ID changes
until I enabled it in commit e76b873f
that was part of MySQL 5.5.5 already.

Later, when a more complete history of the InnoDB Plugin for MySQL 5.1
(aka branches/zip in the InnoDB subversion repository) and of the
planned-to-be closed-source branches/innodb+ that became the basis of
InnoDB in MySQL 5.5 was pushed to the MySQL source repository, the
change was part of commit 509e761f:

 ------------------------------------------------------------------------
 r5038 | marko | 2009-05-19 22:59:07 +0300 (Tue, 19 May 2009) | 30 lines

 branches/zip: Write PAGE_MAX_TRX_ID to the redo log. Otherwise,
 transactions that are started before the rollback of incomplete
 transactions has finished may have an inconsistent view of the
 secondary indexes.

 dict_index_is_sec_or_ibuf(): Auxiliary function for controlling
 updates and checks of PAGE_MAX_TRX_ID: check whether an index is a
 secondary index or the insert buffer tree.

 page_set_max_trx_id(), page_update_max_trx_id(),
 lock_rec_insert_check_and_lock(),
 lock_sec_rec_modify_check_and_lock(), btr_cur_ins_lock_and_undo(),
 btr_cur_upd_lock_and_undo(): Add the parameter mtr.

 page_set_max_trx_id(): Allow mtr to be NULL.  When mtr==NULL, do not
 attempt to write to the redo log.  This only occurs when creating a
 page or reorganizing a compressed page.  In these cases, the
 PAGE_MAX_TRX_ID will be set correctly during the application of redo
 log records, even though there is no explicit log record about it.

 btr_discard_only_page_on_level(): Preserve PAGE_MAX_TRX_ID.  This
 function should be unreachable, though.

 btr_cur_pessimistic_update(): Update PAGE_MAX_TRX_ID.

 Add some assertions for checking that PAGE_MAX_TRX_ID is set on all
 secondary index leaf pages.

 rb://115 tested by Michael, fixes Issue #211
 ------------------------------------------------------------------------

After this fix, some bogus references to recv_recovery_is_on()
remained. Also, some references could be replaced with
references to index->is_dummy to prepare us for MDEV-14481
(background redo log apply).
parent c9c28bef
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2014, 2017, MariaDB Corporation.
Copyright (c) 2014, 2018, 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
......@@ -459,11 +459,7 @@ lock_sec_rec_cons_read_sees(
/* NOTE that we might call this function while holding the search
system latch. */
if (recv_recovery_is_on()) {
return(false);
} else if (dict_table_is_temporary(index->table)) {
if (dict_table_is_temporary(index->table)) {
/* Temp-tables are not shared across connections and multiple
transactions from different connections cannot simultaneously
......@@ -1518,7 +1514,7 @@ lock_sec_rec_some_has_impl(
max trx id to the log, and therefore during recovery, this value
for a page may be incorrect. */
if (max_trx_id < trx_rw_min_trx_id() && !recv_recovery_is_on()) {
if (max_trx_id < trx_rw_min_trx_id()) {
trx = 0;
......@@ -7097,9 +7093,8 @@ lock_sec_rec_read_check_and_lock(
if the max trx id for the page >= min trx id for the trx list or a
database recovery is running. */
if ((page_get_max_trx_id(block->frame) >= trx_rw_min_trx_id()
|| recv_recovery_is_on())
&& !page_rec_is_supremum(rec)) {
if (!page_rec_is_supremum(rec)
&& page_get_max_trx_id(block->frame) >= trx_rw_min_trx_id()) {
lock_rec_convert_impl_to_expl(thr_get_trx(thr), block, rec,
index, offsets);
......
......@@ -2,6 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2018, 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
......@@ -1279,7 +1280,7 @@ page_cur_insert_rec_low(
== (ibool) !!page_is_comp(page));
ut_ad(fil_page_index_page_check(page));
ut_ad(mach_read_from_8(page + PAGE_HEADER + PAGE_INDEX_ID) == index->id
|| recv_recovery_is_on()
|| index->is_dummy
|| (mtr ? mtr->is_inside_ibuf() : dict_index_is_ibuf(index)));
ut_ad(!page_rec_is_supremum(current_rec));
......@@ -1506,8 +1507,8 @@ page_cur_insert_rec_zip(
ut_ad(page_is_comp(page));
ut_ad(fil_page_index_page_check(page));
ut_ad(mach_read_from_8(page + PAGE_HEADER + PAGE_INDEX_ID) == index->id
|| (mtr ? mtr->is_inside_ibuf() : dict_index_is_ibuf(index))
|| recv_recovery_is_on());
|| index->is_dummy
|| (mtr ? mtr->is_inside_ibuf() : dict_index_is_ibuf(index)));
ut_ad(!page_get_instant(page));
ut_ad(!page_cur_is_after_last(cursor));
#ifdef UNIV_ZIP_DEBUG
......@@ -1626,6 +1627,7 @@ page_cur_insert_rec_zip(
because the MLOG_COMP_REC_INSERT should only
be logged after a successful operation. */
ut_ad(!recv_recovery_is_on());
ut_ad(!index->is_dummy);
} else if (recv_recovery_is_on()) {
/* This should be followed by
MLOG_ZIP_PAGE_COMPRESS_NO_DATA,
......@@ -1967,6 +1969,8 @@ page_parse_copy_rec_list_to_created_page(
page_t* page;
page_zip_des_t* page_zip;
ut_ad(index->is_dummy);
if (ptr + 4 > end_ptr) {
return(NULL);
......@@ -1992,8 +1996,7 @@ page_parse_copy_rec_list_to_created_page(
page_copy_rec_list_end_to_created_page() which was logged by.
page_copy_rec_list_to_created_page_write_log().
For other pages, this field must be zero-initialized. */
ut_ad(!page_get_instant(block->frame)
|| (page_is_root(block->frame) && index->is_dummy));
ut_ad(!page_get_instant(block->frame) || page_is_root(block->frame));
while (ptr < rec_end) {
ptr = page_cur_parse_insert_rec(TRUE, ptr, end_ptr,
......@@ -2320,8 +2323,8 @@ page_cur_delete_rec(
ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table));
ut_ad(fil_page_index_page_check(page));
ut_ad(mach_read_from_8(page + PAGE_HEADER + PAGE_INDEX_ID) == index->id
|| (mtr ? mtr->is_inside_ibuf() : dict_index_is_ibuf(index))
|| recv_recovery_is_on());
|| index->is_dummy
|| (mtr ? mtr->is_inside_ibuf() : dict_index_is_ibuf(index)));
ut_ad(mtr == NULL || mtr->is_named_space(index->space));
/* The record must not be the supremum or infimum record. */
......
/*****************************************************************************
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2017, MariaDB Corporation.
Copyright (c) 2015, 2018, 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
......@@ -715,7 +715,7 @@ row_upd_rec_in_place(
ut_ad(index->is_instant());
break;
case REC_STATUS_NODE_PTR:
if (recv_recovery_is_on()
if (index->is_dummy
&& fil_page_get_type(page_align(rec))
== FIL_PAGE_RTREE) {
/* The function rtr_update_mbr_field_in_place()
......
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